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
This commit is contained in:
parent
d58a023856
commit
4f591786cc
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user