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

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: 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..d796cdb41f2d73ded4b30afda3298db7f52e0851 100644
--- a/tests/ColorSpaceXformTest.cpp
+++ b/tests/ColorSpaceXformTest.cpp
@@ -19,7 +19,12 @@ 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);
msarett 2016/08/23 14:03:12 This test became useless when we added opts for sp
+
+ // Use constructor with kNone_ColorSpaceMatch to create SkColorSpaceXform. This way,
+ // we bypass the optimizations for when src == dst and actually do the color xform.
+ return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_Base
+ <SkColorSpace::kNonStandard_GammaNamed, kNone_ColorSpaceMatch>
+ (space, SkMatrix::I(), space));
}
};
@@ -37,19 +42,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);
msarett 2016/08/23 14:03:12 Turns out only testing RGBA->RGBA is a bad idea...
// 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