Fix generic color space xform, ColorSpaceXformTest
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2275563002
Review-Url: https://codereview.chromium.org/2275563002
diff --git a/tests/ColorSpaceXformTest.cpp b/tests/ColorSpaceXformTest.cpp
index 464801a..415063d 100644
--- a/tests/ColorSpaceXformTest.cpp
+++ b/tests/ColorSpaceXformTest.cpp
@@ -19,7 +19,9 @@
// Logically we can pass any matrix here. For simplicty, pass I(), i.e. D50 XYZ gamut.
sk_sp<SkColorSpace> space(new SkColorSpace_Base(
nullptr, SkColorSpace::kNonStandard_GammaNamed, gammas, SkMatrix::I(), nullptr));
- return SkColorSpaceXform::New(space, space);
+
+ // Use special testing entry point, so we don't skip the xform, even though src == dst.
+ return SlowIdentityXform(space);
}
};
@@ -37,19 +39,19 @@
// Create and perform an identity xform.
std::unique_ptr<SkColorSpaceXform> xform = ColorSpaceXformTest::CreateIdentityXform(gammas);
- xform->apply(dstPixels, srcPixels, width, kRGBA_8888_SkColorType, kOpaque_SkAlphaType);
+ xform->apply(dstPixels, srcPixels, width, kN32_SkColorType, kOpaque_SkAlphaType);
// Since the src->dst matrix is the identity, and the gamma curves match,
// the pixels should be unchanged.
for (int i = 0; i < width; i++) {
REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 0) & 0xFF),
- ((dstPixels[i] >> 0) & 0xFF)));
+ SkGetPackedR32(dstPixels[i])));
REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 8) & 0xFF),
- ((dstPixels[i] >> 8) & 0xFF)));
+ SkGetPackedG32(dstPixels[i])));
REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 16) & 0xFF),
- ((dstPixels[i] >> 16) & 0xFF)));
+ SkGetPackedB32(dstPixels[i])));
REPORTER_ASSERT(r, almost_equal(((srcPixels[i] >> 24) & 0xFF),
- ((dstPixels[i] >> 24) & 0xFF)));
+ SkGetPackedA32(dstPixels[i])));
}
}