summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2023-05-17 20:13:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-05-18 21:18:06 +0200
commitfdd06037e0cf902d71270c4bf7a867efc7c9c1f4 (patch)
tree2a4629ee1b809eacf596907948e227dd6df21b67 /oox
parent1b9702920dc7a3c36b19bbcae81176b0ad1bb0cd (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 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx6
-rw-r--r--oox/source/shape/WpsContext.cxx7
2 files changed, 7 insertions, 6 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 9417551b0f86..b9aebab1b31d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1118,9 +1118,9 @@ Reference< XShape > const & Shape::createAndInsert(
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;
maShapeProperties.setProperty(PROP_Transformation, aMatrix);
}
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 8e0cb8b544df..beaefc33fbbc 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -606,9 +606,10 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
aTransformation.set(1, 0, aMatrix.Line2.Column1);
aTransformation.set(1, 1, aMatrix.Line2.Column2);
aTransformation.set(1, 2, aMatrix.Line2.Column3);
- aTransformation.set(2, 0, aMatrix.Line3.Column1);
- aTransformation.set(2, 1, aMatrix.Line3.Column2);
- aTransformation.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);
basegfx::B2DTuple aScale;
basegfx::B2DTuple aTranslate;
double fRotate = 0;