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

Unified Diff: tests/ColorSpaceTest.cpp

Issue 2304753002: Add SkColorSpacePrimaries to help with making D50 matrices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix compile bug Created 4 years, 2 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/SkColorSpace.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ColorSpaceTest.cpp
diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp
index a6ed9e3cf9c8c77a984b92985a90beb4f0065b83..a4eab92f5de78db4056e05f17f0d9d7cbcc72d45 100644
--- a/tests/ColorSpaceTest.cpp
+++ b/tests/ColorSpaceTest.cpp
@@ -271,3 +271,23 @@ DEF_TEST(ColorSpace_Equals, r) {
REPORTER_ASSERT(r, !SkColorSpace::Equals(upperRight.get(), adobe.get()));
REPORTER_ASSERT(r, !SkColorSpace::Equals(rgb1.get(), rgb2.get()));
}
+
+DEF_TEST(ColorSpace_Primaries, r) {
+ // sRGB primaries
+ SkColorSpacePrimaries primaries;
+ primaries.fRX = 0.64f;
+ primaries.fRY = 0.33f;
+ primaries.fGX = 0.30f;
+ primaries.fGY = 0.60f;
+ primaries.fBX = 0.15f;
+ primaries.fBY = 0.06f;
+ primaries.fWX = 0.3127f;
+ primaries.fWY = 0.3290f;
+
+ SkMatrix44 toXYZ(SkMatrix44::kUninitialized_Constructor);
+ bool result = primaries.toXYZD50(&toXYZ);
+ REPORTER_ASSERT(r, result);
+
+ sk_sp<SkColorSpace> space = SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderTargetGamma, toXYZ);
+ REPORTER_ASSERT(r, SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) == space);
+}
« no previous file with comments | « src/core/SkColorSpace.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698