Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: tests/ColorSpaceXformTest.cpp

Issue 2275563002: Fix generic color space xform, ColorSpaceXformTest (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add helper function for testing Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkColorSpaceXform.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ColorSpaceXformTest.cpp
diff --git a/tests/ColorSpaceXformTest.cpp b/tests/ColorSpaceXformTest.cpp
index 464801aa62f88075a225db0fb11dfabf8ca23497..415063d46238797c925e32d6952eacda73f8e24b 100644
--- a/tests/ColorSpaceXformTest.cpp
+++ b/tests/ColorSpaceXformTest.cpp
@@ -19,7 +19,9 @@ public:
// 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 @@ static void test_identity_xform(skiatest::Reporter* r, const sk_sp<SkGammas>& ga
// 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])));
}
}
« no previous file with comments | « src/core/SkColorSpaceXform.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698