diff options
-rw-r--r-- | src/core/SkColorSpace.cpp | 6 | ||||
-rw-r--r-- | tests/ColorSpaceTest.cpp | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp index 3a5d9c196a..6302075658 100644 --- a/src/core/SkColorSpace.cpp +++ b/src/core/SkColorSpace.cpp @@ -136,6 +136,9 @@ sk_sp<SkColorSpace> SkColorSpace::NewNamed(Named named) { sRGBOnce([] { SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor); srgbToxyzD50.set3x3RowMajorf(gSRGB_toXYZD50); + + // Force the mutable type mask to be computed. This avoids races. + (void)srgbToxyzD50.getType(); sRGB.reset(new SkColorSpace_Base(kSRGB_GammaNamed, srgbToxyzD50, kSRGB_Named)); }); return sRGB; @@ -144,6 +147,9 @@ sk_sp<SkColorSpace> SkColorSpace::NewNamed(Named named) { adobeRGBOnce([] { SkMatrix44 adobergbToxyzD50(SkMatrix44::kUninitialized_Constructor); adobergbToxyzD50.set3x3RowMajorf(gAdobeRGB_toXYZD50); + + // Force the mutable type mask to be computed. This avoids races. + (void)adobergbToxyzD50.getType(); adobeRGB.reset(new SkColorSpace_Base(k2Dot2Curve_GammaNamed, adobergbToxyzD50, kAdobeRGB_Named)); }); diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp index abc02b74d8..393d75310b 100644 --- a/tests/ColorSpaceTest.cpp +++ b/tests/ColorSpaceTest.cpp @@ -24,7 +24,7 @@ static void test_space(skiatest::Reporter* r, SkColorSpace* space, REPORTER_ASSERT(r, expectedGamma == space->gammaNamed()); - SkMatrix44 mat = space->xyz(); + const SkMatrix44& mat = space->xyz(); const float src[] = { 1, 0, 0, 1, 0, 1, 0, 1, |