SkMatrix44(const SkMatrix&) needs to initialize the type mask
authorfs <fs@opera.com>
Tue, 16 Dec 2014 16:36:11 +0000 (08:36 -0800)
committerCommit bot <commit-bot@chromium.org>
Tue, 16 Dec 2014 16:36:11 +0000 (08:36 -0800)
Review URL: https://codereview.chromium.org/791723006

src/utils/SkMatrix44.cpp
tests/Matrix44Test.cpp

index 1835635f1d2fc4944b57014949de8d3e306ddb15..731cb4137721f69d88cefb6cc360d1b470ca226c 100644 (file)
@@ -939,7 +939,7 @@ static void initFromMatrix(SkMScalar dst[4][4], const SkMatrix& src) {
 }
 
 SkMatrix44::SkMatrix44(const SkMatrix& src) {
-    initFromMatrix(fMat, src);
+    this->operator=(src);
 }
 
 SkMatrix44& SkMatrix44::operator=(const SkMatrix& src) {
index 13ead192b3609e022c968fbf9727c868f0f7c736..221c37d08093705a842bdbb27fc8f9731d509978 100644 (file)
@@ -104,6 +104,14 @@ static void test_constructor(skiatest::Reporter* reporter) {
     REPORTER_ASSERT(reporter, testMatrix == placeholderMatrix);
     REPORTER_ASSERT(reporter, testMatrix->isIdentity());
     REPORTER_ASSERT(reporter, *testMatrix == SkMatrix44::I());
+
+    // Verify that that constructing from an SkMatrix initializes everything.
+    SkMatrix44 scaleMatrix(SkMatrix44::kUninitialized_Constructor);
+    scaleMatrix.setScale(3, 4, 5);
+    REPORTER_ASSERT(reporter, scaleMatrix.isScale());
+    testMatrix = new(&scaleMatrix) SkMatrix44(SkMatrix::I());
+    REPORTER_ASSERT(reporter, testMatrix->isIdentity());
+    REPORTER_ASSERT(reporter, *testMatrix == SkMatrix44::I());
 }
 
 static void test_translate(skiatest::Reporter* reporter) {