summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-01-31 09:42:50 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-01-31 09:30:16 +0000
commitf4804a8fb60cc999c9b08bf451732749b44eb355 (patch)
treee7c04a7f723af3fb946eaafdf038ab9a9b60ec1c /svx/source
parent75c0d7827625c683d52a9e2f3a7c514df890107b (diff)
Some simplification after 743dd1d3c1142c1c99b0844cc26dd0be91a1de40
MapMode ctor taking origin and scales sets mbSimple to false, so avoid calling it when these are the defaults. Some calculations become unneeded when the fraction is (1, 1). Change-Id: I19a98ad2cac0a66b9bd7b72620180addb3f7fec4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146375 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/customshapes/EnhancedCustomShape3d.cxx7
-rw-r--r--svx/source/svdraw/svdmodel.cxx2
-rw-r--r--svx/source/svdraw/svdograf.cxx12
-rw-r--r--svx/source/svdraw/svdotext.cxx6
-rw-r--r--svx/source/svdraw/svdxcgv.cxx18
5 files changed, 9 insertions, 36 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index 9a0ef6bebf92..468a1c66fa93 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -238,13 +238,6 @@ rtl::Reference<SdrObject> EnhancedCustomShape3d::Create3DObject(
rtl::Reference<SdrObject> pRet;
const SdrCustomShapeGeometryItem& rGeometryItem(rSdrObjCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY));
double fMap(1.0), *pMap = nullptr;
- Fraction aFraction(1, 1);
-
- if ( aFraction.GetNumerator() != 1 || aFraction.GetDenominator() != 1 )
- {
- fMap *= double(aFraction);
- pMap = &fMap;
- }
if ( rSdrObjCustomShape.getSdrModelFromSdrObject().GetScaleUnit() != MapUnit::Map100thMM )
{
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 73d99b29d5ad..eb971b7f6b30 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -682,7 +682,7 @@ void SdrModel::ImpSetOutlinerDefaults( SdrOutliner* pOutliner, bool bInit )
if ( !GetRefDevice() )
{
- MapMode aMapMode(m_eObjUnit, Point(0,0), Fraction(1,1), Fraction(1,1));
+ MapMode aMapMode(m_eObjUnit);
pOutliner->SetRefMapMode(aMapMode);
}
}
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 9ac5536c5716..d9becdfdb80d 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -387,11 +387,7 @@ Graphic SdrGrafObj::GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformF
{
// Refactored most of the code to GraphicObject, where
// everybody can use e.g. the cropping functionality
- MapMode aDestMap(
- getSdrModelFromSdrObject().GetScaleUnit(),
- Point(),
- Fraction(1,1),
- Fraction(1,1));
+ MapMode aDestMap(getSdrModelFromSdrObject().GetScaleUnit());
const Size aDestSize( GetLogicRect().GetSize() );
GraphicAttr aActAttr = GetGraphicAttr(nTransformFlags);
@@ -869,11 +865,7 @@ GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedVectorGraphicData() const
{
ScopedVclPtrInstance< VirtualDevice > pOut;
const tools::Rectangle aBoundRect(GetCurrentBoundRect());
- const MapMode aMap(
- getSdrModelFromSdrObject().GetScaleUnit(),
- Point(),
- Fraction(1,1),
- Fraction(1,1));
+ const MapMode aMap(getSdrModelFromSdrObject().GetScaleUnit());
pOut->EnableOutput(false);
pOut->SetMapMode(aMap);
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index ad27f101c6cb..078e067aa14e 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1324,11 +1324,7 @@ void SdrTextObj::UpdateOutlinerFormatting( SdrOutliner& rOutl, tools::Rectangle&
Fraction aFitXCorrection(1,1);
const bool bContourFrame(IsContourTextFrame());
- const MapMode aMapMode(
- getSdrModelFromSdrObject().GetScaleUnit(),
- Point(0,0),
- Fraction(1,1),
- Fraction(1,1));
+ const MapMode aMapMode(getSdrModelFromSdrObject().GetScaleUnit());
rOutl.SetRefMapMode(aMapMode);
ImpSetupDrawOutlinerForPaint(
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 4c425a627bc5..19b06a9d4ca0 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -163,8 +163,7 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList*
pObj->FitFrameToTextSize();
Size aSiz(pObj->GetLogicRect().GetSize());
MapUnit eMap = GetModel().GetScaleUnit();
- Fraction aMap(1,1);
- ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions);
+ ImpPasteObject(pObj.get(), *pLst, aPos, aSiz, MapMode(eMap), nOptions);
return true;
}
@@ -203,8 +202,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, EETextFormat eFormat, const Point&
pObj->FitFrameToTextSize();
Size aSiz(pObj->GetLogicRect().GetSize());
MapUnit eMap = GetModel().GetScaleUnit();
- Fraction aMap(1,1);
- ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions);
+ ImpPasteObject(pObj.get(), *pLst, aPos, aSiz, MapMode(eMap), nOptions);
// b4967543
if(pObj->GetOutlinerParaObject())
@@ -401,11 +399,8 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po
MapUnit eSrcMU=rMap.GetMapUnit();
MapUnit eDstMU = GetModel().GetScaleUnit();
FrPair aMapFact(GetMapFactor(eSrcMU,eDstMU));
- Fraction aDstFr(1,1);
- nSizX *= double(aMapFact.X() * rMap.GetScaleX() * aDstFr);
- nSizX *= aDstFr.GetDenominator();
+ nSizX *= double(aMapFact.X() * rMap.GetScaleX());
nSizY *= double(aMapFact.Y() * rMap.GetScaleY());
- nSizY /= aDstFr.GetNumerator();
tools::Long xs=nSizX;
tools::Long ys=nSizY;
// set the pos to 0, 0 for online case
@@ -530,7 +525,7 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) co
{
tools::Rectangle aBound( GetMarkedObjBoundRect() );
Size aBoundSize( aBound.GetWidth(), aBound.GetHeight() );
- MapMode aMap(GetModel().GetScaleUnit(), Point(), Fraction(1,1), Fraction(1,1));
+ MapMode aMap(GetModel().GetScaleUnit());
if( bNoVDevIfOneMtfMarked )
{
@@ -648,10 +643,7 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject)
ScopedVclPtrInstance< VirtualDevice > pOut;
GDIMetaFile aMtf;
const tools::Rectangle aBoundRect(rSdrObject.GetCurrentBoundRect());
- const MapMode aMap(rSdrObject.getSdrModelFromSdrObject().GetScaleUnit(),
- Point(),
- Fraction(1,1),
- Fraction(1,1));
+ const MapMode aMap(rSdrObject.getSdrModelFromSdrObject().GetScaleUnit());
pOut->EnableOutput(false);
pOut->SetMapMode(aMap);