include/basegfx/matrix/Matrix.hxx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
New commits: commit 560bfab85e0bd91a820c8c7dbe744628d807c1e6 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat Mar 28 20:21:12 2020 +0100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sat Jun 6 19:28:48 2020 +0200 basegfx: Fix the problem with Matrix Concatinate and Transform In Concatinate and Transform methods we change the instance variables during calculation (matrix multiplication), which leads to the wrong result. This change fixes both calculations. Change-Id: I9f7ef7323707df1ab4a764f97f9bae8593c42940 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91311 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit d088b243cad18777f785abf704b0310f057f740b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95639 Tested-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/basegfx/matrix/Matrix.hxx b/include/basegfx/matrix/Matrix.hxx index 9224e2784b60..e690216a3824 100644 --- a/include/basegfx/matrix/Matrix.hxx +++ b/include/basegfx/matrix/Matrix.hxx @@ -86,19 +86,28 @@ public: /// Multiply this * other. void Concatinate(const Matrix& other) { - ma = ma * other.ma + mb * other.mc; - mb = ma * other.mb + mb * other.md; - mc = mc * other.ma + md * other.mc; - md = mc * other.mb + md * other.md; - me = me * other.ma + mf * other.mc + other.me; - mf = me * other.mb + mf * other.md + other.mf; + double newA = ma * other.ma + mb * other.mc; + double newB = ma * other.mb + mb * other.md; + double newC = mc * other.ma + md * other.mc; + double newD = mc * other.mb + md * other.md; + double newE = me * other.ma + mf * other.mc + other.me; + double newF = me * other.mb + mf * other.md + other.mf; + + ma = newA; + mb = newB; + mc = newC; + md = newD; + me = newE; + mf = newF; } /// Transform the point (x, y) by this Matrix. template <typename T> void Transform(T& x, T& y) { - x = ma * x + mc * y + me; - y = mb * x + md * y + mf; + T newX = v00 * x + v01 * y + v02; + T newY = v10 * x + v11 * y + v12; + x = newX; + y = newY; } /// Transform the rectangle (left, right, top, bottom) by this Matrix. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits