diff options
29 files changed, 104 insertions, 65 deletions
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 5c68036f7644..895116c1861b 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -176,6 +176,14 @@ public: point *= rMatrix; } } + + void translate(double fTranslateX, double fTranslateY) + { + for (auto& point : maVector) + { + point += basegfx::B2DPoint(fTranslateX, fTranslateY); + } + } }; class ControlVectorPair2D @@ -1092,6 +1100,28 @@ public: } } + void translate(double fTranslateX, double fTranslateY) + { + mpBufferedData.reset(); + + if(moControlVector) + { + for(sal_uInt32 a(0); a < maPoints.count(); a++) + { + basegfx::B2DPoint aCandidate = maPoints.getCoordinate(a); + aCandidate += basegfx::B2DPoint(fTranslateX, fTranslateY); + maPoints.setCoordinate(a, aCandidate); + } + + if(!moControlVector->isUsed()) + moControlVector.reset(); + } + else + { + maPoints.translate(fTranslateX, fTranslateY); + } + } + void addOrReplaceSystemDependentData(basegfx::SystemDependentData_SharedPtr& rData) const { if(!mpBufferedData) @@ -1480,6 +1510,14 @@ namespace basegfx } } + void B2DPolygon::translate(double fTranslateX, double fTranslateY) + { + if(count()) + { + mpPolygon->translate(fTranslateX, fTranslateY); + } + } + void B2DPolygon::addOrReplaceSystemDependentDataInternal(SystemDependentData_SharedPtr& rData) const { mpPolygon->addOrReplaceSystemDependentData(rData); diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index f7203a46d88e..35a801684a86 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -177,6 +177,12 @@ public: aPolygon.transform(rMatrix); } + void translate(double fTranslateX, double fTranslateY) + { + for (auto& aPolygon : maPolygons) + aPolygon.translate(fTranslateX, fTranslateY); + } + void makeUnique() { for (auto& aPolygon : maPolygons) @@ -397,6 +403,14 @@ public: } } + void B2DPolyPolygon::translate(double fTranslateX, double fTranslateY) + { + if(count()) + { + mpPolyPolygon->translate(fTranslateX, fTranslateY); + } + } + const B2DPolygon* B2DPolyPolygon::begin() const { return mpPolyPolygon->begin(); diff --git a/basegfx/source/tools/unopolypolygon.cxx b/basegfx/source/tools/unopolypolygon.cxx index 310e5f3e8ce0..2ff9a16cdc8a 100644 --- a/basegfx/source/tools/unopolypolygon.cxx +++ b/basegfx/source/tools/unopolypolygon.cxx @@ -113,8 +113,7 @@ namespace basegfx::unotools if( !aOffset.equalZero() ) { - const B2DHomMatrix aTranslate(utils::createTranslateB2DHomMatrix(aOffset)); - aSrcPoly.transform( aTranslate ); + aSrcPoly.translate( aOffset ); } maPolyPoly.append( aSrcPoly ); diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx index 428b8aa04a00..360bec01199d 100644 --- a/cui/source/tabpages/tplneend.cxx +++ b/cui/source/tabpages/tplneend.cxx @@ -368,7 +368,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickAddHdl_Impl, weld::Button&, void) basegfx::B2DRange aNewRange(basegfx::utils::getRange(aNewPolyPolygon)); // normalize - aNewPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix( -aNewRange.getMinX(), -aNewRange.getMinY())); + aNewPolyPolygon.translate( -aNewRange.getMinX(), -aNewRange.getMinY() ); pConvPolyObj.clear(); diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index 4b8a5cb4ab86..ea848dd6d21e 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -914,7 +914,7 @@ namespace drawinglayer::primitive2d { basegfx::B2DPolygon aNew(aPolygon); - aNew.transform(basegfx::utils::createTranslateB2DHomMatrix(fDelta * fUnitScale, 0.0)); + aNew.translate(fDelta * fUnitScale, 0.0); aContainer[a] = new PolyPolygonColorPrimitive2D( basegfx::B2DPolyPolygon(aNew), basegfx::interpolate(getColorA(), getColorB(), fUnitScale)); diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index c77c653d4ebd..05b0bba59c62 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -2337,14 +2337,12 @@ namespace wmfemfhelper // prepare translation, add current transformation basegfx::B2DVector aVector(pA->GetHorzMove(), pA->GetVertMove()); aVector *= rPropertyHolders.Current().getTransformation(); - basegfx::B2DHomMatrix aTransform( - basegfx::utils::createTranslateB2DHomMatrix(aVector)); // transform existing region basegfx::B2DPolyPolygon aClipPolyPolygon( rPropertyHolders.Current().getClipPolyPolygon()); - aClipPolyPolygon.transform(aTransform); + aClipPolyPolygon.translate(aVector); HandleNewClipRegion(aClipPolyPolygon, rTargetHolders, rPropertyHolders); } } diff --git a/include/basegfx/polygon/b2dpolygon.hxx b/include/basegfx/polygon/b2dpolygon.hxx index 5cbcbd7caea2..475733ed677c 100644 --- a/include/basegfx/polygon/b2dpolygon.hxx +++ b/include/basegfx/polygon/b2dpolygon.hxx @@ -226,6 +226,10 @@ namespace basegfx /// apply transformation given in matrix form void transform(const basegfx::B2DHomMatrix& rMatrix); + /** Translate (ie. move). + Much faster equivalent of transform(createTranslateB2DHomMatrix(xx)). */ + void translate(double fTranslateX, double fTranslateY); + // exclusive management op's for SystemDependentData at B2DPolygon template<class T> std::shared_ptr<T> getSystemDependentData(basegfx::SDD_Type aType) const diff --git a/include/basegfx/polygon/b2dpolypolygon.hxx b/include/basegfx/polygon/b2dpolypolygon.hxx index ffd69b23ad07..eb7b4d0f7444 100644 --- a/include/basegfx/polygon/b2dpolypolygon.hxx +++ b/include/basegfx/polygon/b2dpolypolygon.hxx @@ -113,6 +113,15 @@ namespace basegfx // apply transformation given in matrix form to the polygon void transform(const basegfx::B2DHomMatrix& rMatrix); + /** Translate (ie. move). + Much faster equivalent of transform(createTranslateB2DHomMatrix(xx)). */ + void translate(double fTranslateX, double fTranslateY); + + inline void translate(const B2DTuple& rTranslate) + { + translate(rTranslate.getX(), rTranslate.getY()); + } + // polygon iterators (same iterator validity conditions as for vector) const B2DPolygon* begin() const; const B2DPolygon* end() const; diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index f1a2a257be0d..009cdbdb910c 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -1590,7 +1590,7 @@ void CustomAnimationEffect::updateSdrPathObjFromPath( SdrPathObj& rPathObj ) const ::tools::Rectangle aBoundRect( pObj->GetCurrentBoundRect() ); const Point aCenter( aBoundRect.Center() ); - aPolyPoly.transform(basegfx::utils::createTranslateB2DHomMatrix(aCenter.X(), aCenter.Y())); + aPolyPoly.translate(aCenter.X(), aCenter.Y()); } } @@ -1620,7 +1620,7 @@ void CustomAnimationEffect::updatePathFromSdrPathObj( const SdrPathObj& rPathObj const Point aCenter( aBoundRect.Center() ); - aPolyPoly.transform(basegfx::utils::createTranslateB2DHomMatrix(-aCenter.X(), -aCenter.Y())); + aPolyPoly.translate(-aCenter.X(), -aCenter.Y()); SdrPage* pPage = pObj->getSdrPageFromSdrObject(); if( pPage ) diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index bffecd48cd89..22a82491e351 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -879,9 +879,7 @@ void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList ) aPos = mxOrigin->getPosition(); if( (aPos.X != maOriginPos.X) || (aPos.Y != maOriginPos.Y) ) { - const basegfx::B2DHomMatrix aTransform(basegfx::utils::createTranslateB2DHomMatrix( - aPos.X - maOriginPos.X, aPos.Y - maOriginPos.Y)); - mxPolyPoly.transform( aTransform ); + mxPolyPoly.translate(aPos.X - maOriginPos.X, aPos.Y - maOriginPos.Y); mpPathObj->SetPathPoly( mxPolyPoly ); maOriginPos = aPos; } diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx index 3fd98a7425f3..5c8081a6855e 100644 --- a/sd/source/ui/func/fumorph.cxx +++ b/sd/source/ui/func/fumorph.cxx @@ -496,7 +496,7 @@ void FuMorph::ImpMorphPolygons( const ::basegfx::B2DPoint aRealS(aStartCenter + (aDelta * fValue)); const ::basegfx::B2DPoint aDiff(aRealS - aNewS); - aNewPolyPoly2D.transform(basegfx::utils::createTranslateB2DHomMatrix(aDiff)); + aNewPolyPoly2D.translate(aDiff); rPolyPolyList3D.push_back( std::move(aNewPolyPoly2D) ); } } diff --git a/slideshow/source/engine/transitions/fourboxwipe.cxx b/slideshow/source/engine/transitions/fourboxwipe.cxx index 74833c2e05ae..bb35d4eea5b5 100644 --- a/slideshow/source/engine/transitions/fourboxwipe.cxx +++ b/slideshow/source/engine/transitions/fourboxwipe.cxx @@ -64,8 +64,7 @@ namespace slideshow::internal { square4.flip(); // flip direction res.append( square4 ); - aTransform = basegfx::utils::createTranslateB2DHomMatrix(0.5, 0.5); - res.transform( aTransform ); + res.translate( 0.5, 0.5 ); return res; } diff --git a/slideshow/source/engine/transitions/randomwipe.cxx b/slideshow/source/engine/transitions/randomwipe.cxx index 58047a676f82..dec874c8b90d 100644 --- a/slideshow/source/engine/transitions/randomwipe.cxx +++ b/slideshow/source/engine/transitions/randomwipe.cxx @@ -71,7 +71,7 @@ RandomWipe::RandomWipe( sal_Int32 nElements, bool randomBars ) { ::basegfx::B2DPoint const & point = m_positions[ pos ]; ::basegfx::B2DPolygon poly( m_rect ); - poly.transform(basegfx::utils::createTranslateB2DHomMatrix(point.getX(), point.getY())); + poly.translate(point.getX(), point.getY()); res.append( poly ); } return res; diff --git a/slideshow/source/engine/transitions/sweepwipe.cxx b/slideshow/source/engine/transitions/sweepwipe.cxx index 8fcce26fdeb6..1cb978e33237 100644 --- a/slideshow/source/engine/transitions/sweepwipe.cxx +++ b/slideshow/source/engine/transitions/sweepwipe.cxx @@ -40,8 +40,7 @@ namespace slideshow::internal { if (m_center) { - aTransform = basegfx::utils::createTranslateB2DHomMatrix(0.5, 0.0); - poly.transform( aTransform ); + poly.translate( 0.5, 0.0 ); } ::basegfx::B2DPolyPolygon res(poly); diff --git a/slideshow/source/engine/transitions/waterfallwipe.cxx b/slideshow/source/engine/transitions/waterfallwipe.cxx index c3ef81ca5f7c..fb3c687c7b93 100644 --- a/slideshow/source/engine/transitions/waterfallwipe.cxx +++ b/slideshow/source/engine/transitions/waterfallwipe.cxx @@ -52,7 +52,7 @@ WaterfallWipe::WaterfallWipe( sal_Int32 nElements, bool flipOnYAxis ) ::basegfx::B2DPolyPolygon WaterfallWipe::operator () ( double t ) { ::basegfx::B2DPolygon poly( m_waterfall ); - poly.transform(basegfx::utils::createTranslateB2DHomMatrix(0.0, ::basegfx::pruneScaleValue(2.0 * t))); + poly.translate(0.0, ::basegfx::pruneScaleValue(2.0 * t)); poly.setB2DPoint( 0, ::basegfx::B2DPoint( 0.0, -1.0 ) ); poly.setB2DPoint( poly.count()-1, ::basegfx::B2DPoint( 1.0, -1.0 ) ); diff --git a/slideshow/source/engine/transitions/zigzagwipe.cxx b/slideshow/source/engine/transitions/zigzagwipe.cxx index 9b1f14221175..27ba1a6024ce 100644 --- a/slideshow/source/engine/transitions/zigzagwipe.cxx +++ b/slideshow/source/engine/transitions/zigzagwipe.cxx @@ -44,7 +44,7 @@ ZigZagWipe::ZigZagWipe( sal_Int32 nZigs ) : m_zigEdge( 1.0 / nZigs ) ::basegfx::B2DPolyPolygon ZigZagWipe::operator () ( double t ) { ::basegfx::B2DPolyPolygon res(m_stdZigZag); - res.transform(basegfx::utils::createTranslateB2DHomMatrix((1.0 + m_zigEdge) * t, 0.0)); + res.translate((1.0 + m_zigEdge) * t, 0.0); return res; } diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index b18c43f3e8af..46e02bfc97cb 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -2471,8 +2471,7 @@ void EnhancedCustomShape2d::CreateSubPath( basegfx::B2DPoint aCurrentPointB2D( aNewB2DPolygon.getB2DPoint(aNewB2DPolygon.count() - 1 ) ); const double fDx(aCurrentPointB2D.getX() - aTempB2DPolygon.getB2DPoint(0).getX()); const double fDy(aCurrentPointB2D.getY() - aTempB2DPolygon.getB2DPoint(0).getY()); - aMatrix = basegfx::utils::createTranslateB2DHomMatrix(fDx, fDy); - aTempB2DPolygon.transform(aMatrix); + aTempB2DPolygon.translate(fDx, fDy); aNewB2DPolygon.append(aTempB2DPolygon); } diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index d6d6446e589f..33787b598dc5 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -154,8 +154,7 @@ namespace sdr::contact // create shadow outline basegfx::B2DPolygon aShadowOutline(aObjectOutline); - aShadowOutline.transform( - basegfx::utils::createTranslateB2DHomMatrix(nXDist, nYDist)); + aShadowOutline.translate(nXDist, nYDist); // clip shadow outline against object outline const basegfx::B2DPolyPolygon aClippedShadow( diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 2782930b0fd7..42e5a267985a 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2262,7 +2262,7 @@ PointerStyle SdrPathObj::GetCreatePointer() const void SdrPathObj::NbcMove(const Size& rSiz) { - maPathPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix(rSiz.Width(), rSiz.Height())); + maPathPolygon.translate(rSiz.Width(), rSiz.Height()); // #i19871# first modify locally, then call parent (to get correct SnapRect with GluePoints) SdrTextObj::NbcMove(rSiz); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index a05db720cdb1..8b235a21517a 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -858,8 +858,7 @@ void SdrTextObj::impDecomposeContourTextPrimitive( aPolyPolygon.transform(aRemoveRotShear); // Move Top/Left to origin basegfx::B2DRange aBoundRange = aPolyPolygon.getB2DRange(); - aPolyPolygon.transform( - basegfx::utils::createTranslateB2DHomMatrix(-aBoundRange.getMinimum())); + aPolyPolygon.translate(-aBoundRange.getMinimum()); // Calculate the translation needed to bring the text to the original position of // aPolyPolygon. diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 89ef01f54a51..6f375b76ea1e 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -239,7 +239,7 @@ basegfx::B2DPolyPolygon SdrVirtObj::TakeXorPoly() const if(m_aAnchor.X() || m_aAnchor.Y()) { - aPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix(m_aAnchor.X(), m_aAnchor.Y())); + aPolyPolygon.translate(m_aAnchor.X(), m_aAnchor.Y()); } return aPolyPolygon; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 37ea26ef7ec4..10c85e86f090 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2207,7 +2207,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn if( pSdrObject->getSdrModelFromSdrObject().IsWriter() ) { Point aPoint( pSdrObject->GetAnchorPos() ); - aNewPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix(aPoint.X(), aPoint.Y())); + aNewPolyPolygon.translate(aPoint.X(), aPoint.Y()); } pEdgeObj->SetEdgeTrackPath( aNewPolyPolygon ); return true; @@ -2744,7 +2744,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() ) { Point aPoint( GetSdrObject()->GetAnchorPos() ); - aPolyPoly.transform(basegfx::utils::createTranslateB2DHomMatrix(-aPoint.X(), -aPoint.Y())); + aPolyPoly.translate(-aPoint.X(), -aPoint.Y()); } // Reintroduction of fix for issue #i59051# (#i108851#) ForceMetricTo100th_mm( aPolyPoly ); diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index d37d12502109..7b735e37439b 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -2508,7 +2508,7 @@ void SwDrawVirtObj::RecalcBoundRect() basegfx::B2DPolyPolygon SwDrawVirtObj::TakeXorPoly() const { basegfx::B2DPolyPolygon aRetval(mxRefObj->TakeXorPoly()); - aRetval.transform(basegfx::utils::createTranslateB2DHomMatrix(GetOffset().X(), GetOffset().Y())); + aRetval.translate(GetOffset().X(), GetOffset().Y()); return aRetval; } @@ -2516,7 +2516,7 @@ basegfx::B2DPolyPolygon SwDrawVirtObj::TakeXorPoly() const basegfx::B2DPolyPolygon SwDrawVirtObj::TakeContour() const { basegfx::B2DPolyPolygon aRetval(mxRefObj->TakeContour()); - aRetval.transform(basegfx::utils::createTranslateB2DHomMatrix(GetOffset().X(), GetOffset().Y())); + aRetval.translate(GetOffset().X(), GetOffset().Y()); return aRetval; } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 991f40fdd013..ee24aaf4173b 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -2694,15 +2694,11 @@ css::drawing::PolyPolygonBezierCoords SwXShape::ConvertPolyPolygonBezierToLayout // apply translation difference to PolyPolygonBezier. if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 ) { - const basegfx::B2DHomMatrix aMatrix(basegfx::utils::createTranslateB2DHomMatrix( - aTranslateDiff.X, aTranslateDiff.Y)); - for(drawing::PointSequence& rInnerSequence : asNonConstRange(aConvertedPath.Coordinates)) { for(awt::Point& rPoint : asNonConstRange(rInnerSequence)) { - basegfx::B2DPoint aNewCoordinatePair(rPoint.X, rPoint.Y); - aNewCoordinatePair *= aMatrix; + basegfx::B2DPoint aNewCoordinatePair(rPoint.X + aTranslateDiff.X, rPoint.Y + aTranslateDiff.Y); rPoint.X = basegfx::fround(aNewCoordinatePair.getX()); rPoint.Y = basegfx::fround(aNewCoordinatePair.getY()); } diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 4ca3628ecf58..f36447b3d211 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -332,9 +332,8 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) // Make relative to range 0..21600, 0..21600 Point aCenter(pSdrObj->GetSnapRect().Center()); - basegfx::B2DHomMatrix aTranslateToOrigin( - basegfx::utils::createTranslateB2DHomMatrix(-aCenter.X(), -aCenter.Y())); - aPolyPolygon.transform(aTranslateToOrigin); + // translate to origin + aPolyPolygon.translate(-aCenter.X(), -aCenter.Y()); const double fWidth(pSdrObj->GetLogicRect().getOpenWidth()); double fScaleX = fWidth == 0.0 ? 1.0 : 21600.0 / fWidth; const double fHeight(pSdrObj->GetLogicRect().getOpenHeight()); @@ -342,9 +341,8 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) basegfx::B2DHomMatrix aScale(basegfx::utils::createScaleB2DHomMatrix(fScaleX, fScaleY)); aPolyPolygon.transform(aScale); - basegfx::B2DHomMatrix aTranslateToCenter( - basegfx::utils::createTranslateB2DHomMatrix(10800.0, 10800.0)); - aPolyPolygon.transform(aTranslateToCenter); + // translate to center + aPolyPolygon.translate(10800.0, 10800.0); break; } // end case OBJ_CUSTOMSHAPE case SdrObjKind::Line: @@ -383,9 +381,8 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) // Make relative to range 0..21600, 0..21600 Point aCenter(pSdrObj->GetSnapRect().Center()); - basegfx::B2DHomMatrix aTranslateToOrigin( - basegfx::utils::createTranslateB2DHomMatrix(-aCenter.X(), -aCenter.Y())); - aPolyPolygon.transform(aTranslateToOrigin); + // translate to origin + aPolyPolygon.translate(-aCenter.X(), -aCenter.Y()); const double fWidth(pSdrObj->GetLogicRect().getOpenWidth()); double fScaleX = fWidth == 0.0 ? 1.0 : 21600.0 / fWidth; @@ -395,9 +392,7 @@ tools::Polygon lcl_CreateContourPolygon(SdrObject* pSdrObj) basegfx::utils::createScaleB2DHomMatrix(fScaleX, fScaleY)); aPolyPolygon.transform(aScale); - basegfx::B2DHomMatrix aTranslateToCenter( - basegfx::utils::createTranslateB2DHomMatrix(10800.0, 10800.0)); - aPolyPolygon.transform(aTranslateToCenter); + aPolyPolygon.translate(10800.0, 10800.0); break; } case SdrObjKind::NONE: diff --git a/sw/source/writerfilter/dmapper/GraphicImport.cxx b/sw/source/writerfilter/dmapper/GraphicImport.cxx index 23330a742f26..a9f6a48428b4 100644 --- a/sw/source/writerfilter/dmapper/GraphicImport.cxx +++ b/sw/source/writerfilter/dmapper/GraphicImport.cxx @@ -1234,9 +1234,7 @@ void GraphicImport::lcl_attribute(Id nName, const Value& rValue) o3tl::convert(1.0, o3tl::Length::twip, o3tl::Length::mm100)); aShapePolygon.transform(aMatrix); // Wrap polygon treats left/top of shape as origin, shift shape polygon accordingly - aMatrix = basegfx::utils::createTranslateB2DHomMatrix( - -aImportPosition.X, -aImportPosition.Y); - aShapePolygon.transform(aMatrix); + aShapePolygon.translate(-aImportPosition.X, -aImportPosition.Y); aShapeRange = aShapePolygon.getB2DRange(); } else // can this happen? diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index 44e51c42c75b..f394bbfda1b5 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -307,9 +307,8 @@ void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, SalGraphics& rGraphics if (y > aSVGRect.getCenterY()) y = y + fDeltaY; - aGradient.maPoint1 = basegfx::B2DPoint(x, y); - aGradient.maPoint1 *= basegfx::utils::createTranslateB2DHomMatrix( - aTargetSurface.getMinX() - 0.5, aTargetSurface.getMinY() - 0.5); + aGradient.maPoint1 = basegfx::B2DPoint(x + aTargetSurface.getMinX() - 0.5, + y + aTargetSurface.getMinY() - 0.5); x = pLinearGradient->x2; y = pLinearGradient->y2; @@ -319,9 +318,8 @@ void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, SalGraphics& rGraphics if (y > aSVGRect.getCenterY()) y = y + fDeltaY; - aGradient.maPoint2 = basegfx::B2DPoint(x, y); - aGradient.maPoint2 *= basegfx::utils::createTranslateB2DHomMatrix( - aTargetSurface.getMinX() - 0.5, aTargetSurface.getMinY() - 0.5); + aGradient.maPoint2 = basegfx::B2DPoint(x + aTargetSurface.getMinX() - 0.5, + y + aTargetSurface.getMinY() - 0.5); for (gfx::GradientStop const& rStop : pLinearGradient->maGradientStops) { @@ -369,8 +367,8 @@ void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, SalGraphics& rGraphics rPolygon.setB2DPoint(i, basegfx::B2DPoint(x, y)); } } - aPolyPolygon.transform(basegfx::utils::createTranslateB2DHomMatrix( - aTargetSurface.getMinX() - 0.5, aTargetSurface.getMinY() - 0.5)); + aPolyPolygon.translate(aTargetSurface.getMinX() - 0.5, + aTargetSurface.getMinY() - 0.5); if (rPath.mpFillColor) { diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx index f503248dd7b2..40d7817afcb0 100644 --- a/vcl/source/gdi/gdimetafiletools.cxx +++ b/vcl/source/gdi/gdimetafiletools.cxx @@ -357,10 +357,7 @@ void clipMetafileContentAgainstOwnRegions(GDIMetaFile& rSource) if((aHorMove || aVerMove) && !aClips.empty() && aClips.back().count()) { - aClips.back().transform( - basegfx::utils::createTranslateB2DHomMatrix( - aHorMove, - aVerMove)); + aClips.back().translate(aHorMove, aVerMove); } break; } diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 07ca0e54d527..15baf036ce55 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -416,7 +416,7 @@ void vcl::Region::Move( tools::Long nHorzMove, tools::Long nVertMove ) { basegfx::B2DPolyPolygon aPoly(*getB2DPolyPolygon()); - aPoly.transform(basegfx::utils::createTranslateB2DHomMatrix(nHorzMove, nVertMove)); + aPoly.translate(nHorzMove, nVertMove); if (aPoly.count()) mpB2DPolyPolygon = aPoly; else |