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 /svx | |
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 'svx')
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index f46727299cef..8494f493513d 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2076,9 +2076,10 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn aNewHomogenMatrix.set(1, 0, aMatrix.Line2.Column1); aNewHomogenMatrix.set(1, 1, aMatrix.Line2.Column2); aNewHomogenMatrix.set(1, 2, aMatrix.Line2.Column3); - aNewHomogenMatrix.set(2, 0, aMatrix.Line3.Column1); - aNewHomogenMatrix.set(2, 1, aMatrix.Line3.Column2); - aNewHomogenMatrix.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 ); // tdf#117145 metric of SdrModel is app-specific, metric of UNO API is 100thmm // Need to adapt aNewHomogenMatrix from 100thmm to app-specific @@ -2578,9 +2579,9 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn aMatrix.Line2.Column1 = aNewHomogenMatrix.get(1, 0); aMatrix.Line2.Column2 = aNewHomogenMatrix.get(1, 1); aMatrix.Line2.Column3 = aNewHomogenMatrix.get(1, 2); - aMatrix.Line3.Column1 = aNewHomogenMatrix.get(2, 0); - aMatrix.Line3.Column2 = aNewHomogenMatrix.get(2, 1); - aMatrix.Line3.Column3 = aNewHomogenMatrix.get(2, 2); + aMatrix.Line3.Column1 = 0; + aMatrix.Line3.Column2 = 0; + aMatrix.Line3.Column3 = 1; rValue <<= aMatrix; |