summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2025-02-17 15:03:42 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2025-02-17 12:48:36 +0100
commit4f591786ccbb4274aa575c20d3d31a9ca8d3da8d (patch)
treee659ea041fa8368282052fe733a487971f5c9f3d /svx
parentd58a0238561584cb5440e8df79fbf06737ae42af (diff)
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.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx3
-rw-r--r--svx/source/svdraw/svdoashp.cxx12
-rw-r--r--svx/source/svdraw/svdograf.cxx8
-rw-r--r--svx/source/svdraw/svdopath.cxx2
-rw-r--r--svx/source/svdraw/svdotext.cxx2
5 files changed, 10 insertions, 17 deletions
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;