aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ColorSpaceTest.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-05-02 11:12:14 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-02 11:12:14 -0700
commitffc2aea3cb6981a5cc26f6c0f2ebf889ca5eb73f (patch)
tree9e66bb7012cea8b36482936760cb3d7f373351bf /tests/ColorSpaceTest.cpp
parentc578b06319f271ac46ac78e3b86f74fbceed360e (diff)
Introduce SkGammas type to represent ICC gamma curves
Diffstat (limited to 'tests/ColorSpaceTest.cpp')
-rw-r--r--tests/ColorSpaceTest.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp
index 313eed86f1..e5ecbc8346 100644
--- a/tests/ColorSpaceTest.cpp
+++ b/tests/ColorSpaceTest.cpp
@@ -35,12 +35,14 @@ DEF_TEST(ColorSpaceParsePngICCProfile, r) {
SkColorSpace* colorSpace = codec->getColorSpace();
REPORTER_ASSERT(r, nullptr != colorSpace);
- // No need to use almost equal here. The color profile that we have extracted
- // actually has a table of gammas. And our current implementation guesses 2.2f.
- SkFloat3 gammas = colorSpace->gamma();
- REPORTER_ASSERT(r, 2.2f == gammas.fVec[0]);
- REPORTER_ASSERT(r, 2.2f == gammas.fVec[1]);
- REPORTER_ASSERT(r, 2.2f == gammas.fVec[2]);
+ // The color profile that we have extracted has represents gamma with a lookup table.
+ // So we expect the gamma value to be zero.
+#ifdef SK_DEBUG
+ const SkColorSpace::SkGammas& gammas = colorSpace->gammas();
+ REPORTER_ASSERT(r, 0.0f == gammas.red());
+ REPORTER_ASSERT(r, 0.0f == gammas.green());
+ REPORTER_ASSERT(r, 0.0f == gammas.blue());
+#endif
// These nine values were extracted from the color profile in isolation (before
// we embedded it in the png). Here we check that we still extract the same values.
@@ -75,10 +77,12 @@ DEF_TEST(ColorSpaceParseJpegICCProfile, r) {
// It's important to use almost equal here. This profile sets gamma as
// 563 / 256, which actually comes out to about 2.19922.
- SkFloat3 gammas = colorSpace->gamma();
- REPORTER_ASSERT(r, almost_equal(2.2f, gammas.fVec[0]));
- REPORTER_ASSERT(r, almost_equal(2.2f, gammas.fVec[1]));
- REPORTER_ASSERT(r, almost_equal(2.2f, gammas.fVec[2]));
+#ifdef SK_DEBUG
+ const SkColorSpace::SkGammas& gammas = colorSpace->gammas();
+ REPORTER_ASSERT(r, almost_equal(2.2f, gammas.red()));
+ REPORTER_ASSERT(r, almost_equal(2.2f, gammas.green()));
+ REPORTER_ASSERT(r, almost_equal(2.2f, gammas.blue()));
+#endif
// These nine values were extracted from the color profile. Until we know any
// better, we'll assume these are the right values and test that we continue