From a980b29c490a18d28c7d21b6172b82a61dda042a Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Wed, 16 Oct 2019 21:01:16 +0000 Subject: [PATCH] Bug 1589204 - Fix a bug in Matrix4x4Flagged::operator*. r=mstange Differential Revision: https://phabricator.services.mozilla.com/D49486 --HG-- extra : moz-landing-system : lando --- gfx/2d/Matrix.h | 2 +- gfx/tests/gtest/TestMatrix.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h index a80461384461..68830c9e49cb 100644 --- a/gfx/2d/Matrix.h +++ b/gfx/2d/Matrix.h @@ -2150,7 +2150,7 @@ class Matrix4x4TypedFlagged matrix._14 = _11 * aMatrix._14 + _12 * aMatrix._24; matrix._24 = _21 * aMatrix._14 + _22 * aMatrix._24; matrix._34 = aMatrix._34; - matrix._44 = _41 * aMatrix._14 + _42 * aMatrix._24; + matrix._44 = _41 * aMatrix._14 + _42 * aMatrix._24 + aMatrix._44; matrix.Analyze(); return matrix; } diff --git a/gfx/tests/gtest/TestMatrix.cpp b/gfx/tests/gtest/TestMatrix.cpp index bc2f9e63cd2e..919e81a54c8d 100644 --- a/gfx/tests/gtest/TestMatrix.cpp +++ b/gfx/tests/gtest/TestMatrix.cpp @@ -59,3 +59,12 @@ TEST(Matrix, TransformAndClipRect) EXPECT_TRUE(NudgedToInt(m.TransformAndClipBounds(Rect(150, 50, 100, 200), c)) .IsEqualInterior(Rect(150, 100, 50, 100))); } + +TEST(Matrix4x4Flagged, Mult) +{ + Matrix4x4Flagged a = Matrix4x4::Translation(Point(42, 42)); + Matrix4x4 b = Matrix4x4::Scaling(2, 2, 1); + Matrix4x4Flagged actual = a * b; + Matrix4x4Flagged expected(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 84, 84, 0, 1); + EXPECT_EQ(expected, actual); +} \ No newline at end of file