diff options
-rw-r--r-- | include/basegfx/matrix/Matrix.hxx | 25 |
1 files changed, 17 insertions, 8 deletions
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. |