svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx |    3 +--
 svx/source/svdraw/svdoashp.cxx                            |   12 ++++++------
 svx/source/svdraw/svdograf.cxx                            |    8 +-------
 svx/source/svdraw/svdopath.cxx                            |    2 +-
 svx/source/svdraw/svdotext.cxx                            |    2 +-
 xmloff/source/draw/ximpshap.cxx                           |    4 ++--
 6 files changed, 12 insertions(+), 19 deletions(-)

New commits:
commit 4f591786ccbb4274aa575c20d3d31a9ca8d3da8d
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Feb 17 15:03:42 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Feb 17 12:48:36 2025 +0100

    Simplify some uses of basegfx::utils::create*B2DHomMatrix
    
    The additional zero checks are unneeded (the creation functions do
    that internally). And in one case, a simpler function exists.
    
    Change-Id: I481b3d22b8081cbfad545c343b04f7f3330b0eba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181769
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx 
b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 710510882204..73da479d0929 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -214,9 +214,8 @@ namespace sdr::contact
                 }
 
                 // fill object matrix
-                const basegfx::B2DHomMatrix 
aObjectMatrix(basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
+                const basegfx::B2DHomMatrix 
aObjectMatrix(basegfx::utils::createScaleTranslateB2DHomMatrix(
                     aObjectRange.getWidth(), aObjectRange.getHeight(),
-                    /*fShearX=*/0, /*fRotate=*/0,
                     aObjectRange.getMinX(), aObjectRange.getMinY()));
 
                 // create primitive
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 996071b27e92..51a2fc58b98a 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2964,8 +2964,8 @@ void SdrObjCustomShape::AdjustToMaxRect(const 
tools::Rectangle& rMaxRect, bool b
     basegfx::B2DHomMatrix aMathMatrix;
     aMathMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
             aScale,
-            basegfx::fTools::equalZero(fShearX) ? 0.0 : -fShearX,
-            basegfx::fTools::equalZero(fRotate) ? 0.0 : fRotate,
+            -fShearX,
+            fRotate,
             aTranslate);
 
     // Calculate scaling factors from size of the transformed unit polygon as 
ersatz for the not
@@ -2995,8 +2995,8 @@ void SdrObjCustomShape::AdjustToMaxRect(const 
tools::Rectangle& rMaxRect, bool b
     aMathMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
     aMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
             aScale,
-            basegfx::fTools::equalZero(fShearX) ? 0.0 : -fShearX,
-            basegfx::fTools::equalZero(fRotate) ? 0.0 : fRotate,
+            -fShearX,
+            fRotate,
             aTranslate);
 
     // Now use TRSetBaseGeometry to actually perform scale, shear, rotate and 
translate
@@ -3103,7 +3103,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const 
basegfx::B2DHomMatrix& rMatrix,
     if (aScale.getX() > 2.0 && aScale.getY() > 2.0)
         aScale -= basegfx::B2DTuple(1.0, 1.0);
     basegfx::B2DHomMatrix aMathMat = 
basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
-                    aScale, -fShearX, basegfx::fTools::equalZero(fRotate) ? 
0.0 : fRotate,
+                    aScale, -fShearX, fRotate,
                     aTranslate);
     // Use matrix to get current center
     basegfx::B2DPoint aCenter(0.5,0.5);
@@ -3200,7 +3200,7 @@ bool 
SdrObjCustomShape::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegf
     rMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
         aScale,
         basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
-        basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
+        -fRotate,
         aTranslate);
 
     return false;
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 82a312c77d9c..7a074bf29ed1 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -1143,15 +1143,9 @@ void SdrGrafObj::addCropHandles(SdrHdlList& rTarget) 
const
 
         aMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
 
-        if(!basegfx::fTools::equalZero(fShearX))
-        {
-            // shearX is used, correct it
-            fShearX = -fShearX;
-        }
-
         aMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
             aScale,
-            fShearX,
+            -fShearX,
             fRotate,
             aTranslate);
     }
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index f4a3cd80e458..2782930b0fd7 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2876,7 +2876,7 @@ bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& 
rMatrix, basegfx::B2DP
     rMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
         aScale,
         basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
-        basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
+        -fRotate,
         aTranslate);
 
     return true;
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index d00f40a8ce19..d0ac761a205e 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1590,7 +1590,7 @@ bool SdrTextObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& 
rMatrix, basegfx::B2DP
     rMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
         aScale,
         basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
-        basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
+        -fRotate,
         aTranslate);
 
     return false;
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 6b742be164ae..26b4d7f1e95b 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -583,8 +583,8 @@ void SdXMLShapeContext::SetTransformation()
     basegfx::B2DHomMatrix aB2DHomMatrix;
     aB2DHomMatrix = 
basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
                                 aScale,
-                                basegfx::fTools::equalZero(fShearX) ? 0.0 : 
-fShearX,
-                                basegfx::fTools::equalZero(fRotate) ? 0.0 : 
fRotate,
+                                -fShearX,
+                                fRotate,
                             aTranslate);
     drawing::HomogenMatrix3 aUnoMatrix;
 

Reply via email to