diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-05-17 20:13:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-18 21:18:06 +0200 |
commit | fdd06037e0cf902d71270c4bf7a867efc7c9c1f4 (patch) | |
tree | 2a4629ee1b809eacf596907948e227dd6df21b67 /sw/source/core/edit/edfcol.cxx | |
parent | 1b9702920dc7a3c36b19bbcae81176b0ad1bb0cd (diff) |
improved B2DHomMatrix
since we know that this is a matrix only used for 2D transforms,
we know that the last row of the matrix is always { 0, 0, 1 }.
Therefore, we don't need to store that information, and
we can simplify some of the computations.
Also remove operations like operator+ which are not legal for
such a matrix.
Change-Id: I482de9a45ebbedf79e3b6033575aab590e61c2d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151909
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/edit/edfcol.cxx')
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 47b4eb61684d..1be771b89174 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -1379,9 +1379,10 @@ static sal_Int16 lcl_GetAngle(const drawing::HomogenMatrix3& rMatrix) aTransformation.set(1, 0, rMatrix.Line2.Column1); aTransformation.set(1, 1, rMatrix.Line2.Column2); aTransformation.set(1, 2, rMatrix.Line2.Column3); - aTransformation.set(2, 0, rMatrix.Line3.Column1); - aTransformation.set(2, 1, rMatrix.Line3.Column2); - aTransformation.set(2, 2, rMatrix.Line3.Column3); + // For this to be a valid 2D transform matrix, the last row must be [0,0,1] + assert( rMatrix.Line3.Column1 == 0 ); + assert( rMatrix.Line3.Column2 == 0 ); + assert( rMatrix.Line3.Column3 == 1 ); aTransformation.decompose(aScale, aTranslate, fRotate, fShear); sal_Int16 nDeg = round(basegfx::rad2deg(fRotate)); @@ -1553,9 +1554,9 @@ static void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark, aMatrix.Line2.Column1 = aTransformation.get(1, 0); aMatrix.Line2.Column2 = aTransformation.get(1, 1); aMatrix.Line2.Column3 = aTransformation.get(1, 2); - aMatrix.Line3.Column1 = aTransformation.get(2, 0); - aMatrix.Line3.Column2 = aTransformation.get(2, 1); - aMatrix.Line3.Column3 = aTransformation.get(2, 2); + aMatrix.Line3.Column1 = 0; + aMatrix.Line3.Column2 = 0; + aMatrix.Line3.Column3 = 1; uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); xPropertySet->setPropertyValue(UNO_NAME_ANCHOR_TYPE, uno::Any(text::TextContentAnchorType_AT_CHARACTER)); uno::Reference<text::XTextContent> xTextContent(xShape, uno::UNO_QUERY); |