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 /xmloff | |
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 'xmloff')
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 7 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 7f19e7fe3688..51976a625c97 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -1513,9 +1513,10 @@ void XMLShapeExport::ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix.set(1, 0, aMatrix.Line2.Column1); rMatrix.set(1, 1, aMatrix.Line2.Column2); rMatrix.set(1, 2, aMatrix.Line2.Column3); - rMatrix.set(2, 0, aMatrix.Line3.Column1); - rMatrix.set(2, 1, aMatrix.Line3.Column2); - rMatrix.set(2, 2, aMatrix.Line3.Column3); + // For this to be a valid 2D transform matrix, the last row must be [0,0,1] + assert( aMatrix.Line3.Column1 == 0 ); + assert( aMatrix.Line3.Column2 == 0 ); + assert( aMatrix.Line3.Column3 == 1 ); } void XMLShapeExport::ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMatrix, ::basegfx::B2DTuple& rTRScale, diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 74d5027e7c11..5e965eba5aaa 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -590,9 +590,9 @@ void SdXMLShapeContext::SetTransformation() aUnoMatrix.Line2.Column2 = aB2DHomMatrix.get(1, 1); aUnoMatrix.Line2.Column3 = aB2DHomMatrix.get(1, 2); - aUnoMatrix.Line3.Column1 = aB2DHomMatrix.get(2, 0); - aUnoMatrix.Line3.Column2 = aB2DHomMatrix.get(2, 1); - aUnoMatrix.Line3.Column3 = aB2DHomMatrix.get(2, 2); + aUnoMatrix.Line3.Column1 = 0; + aUnoMatrix.Line3.Column2 = 0; + aUnoMatrix.Line3.Column3 = 1; xPropSet->setPropertyValue("Transformation", Any(aUnoMatrix)); } |