| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkCodec.h" | 9 #include "SkCodec.h" |
| 10 #include "SkColorSpace.h" | 10 #include "SkColorSpace.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); | 67 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); |
| 68 REPORTER_ASSERT(r, nullptr != codec); | 68 REPORTER_ASSERT(r, nullptr != codec); |
| 69 | 69 |
| 70 #if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_M
INOR >= 6) | 70 #if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_M
INOR >= 6) |
| 71 SkColorSpace* colorSpace = codec->getColorSpace(); | 71 SkColorSpace* colorSpace = codec->getColorSpace(); |
| 72 REPORTER_ASSERT(r, nullptr != colorSpace); | 72 REPORTER_ASSERT(r, nullptr != colorSpace); |
| 73 | 73 |
| 74 const float red[] = { 0.436066f, 0.222488f, 0.013916f }; | 74 const float red[] = { 0.436066f, 0.222488f, 0.013916f }; |
| 75 const float green[] = { 0.385147f, 0.716873f, 0.0970764f }; | 75 const float green[] = { 0.385147f, 0.716873f, 0.0970764f }; |
| 76 const float blue[] = { 0.143066f, 0.0606079f, 0.714096f }; | 76 const float blue[] = { 0.143066f, 0.0606079f, 0.714096f }; |
| 77 const float gamma[] = { 0, 0, 0 }; // table-based gamma returns 0 from this
its float-getter | 77 const float gamma[] = { 2.2f, 2.2f, 2.2f }; |
| 78 test_space(r, colorSpace, red, green, blue, gamma); | 78 test_space(r, colorSpace, red, green, blue, gamma); |
| 79 #endif | 79 #endif |
| 80 } | 80 } |
| 81 | 81 |
| 82 DEF_TEST(ColorSpaceParseJpegICCProfile, r) { | 82 DEF_TEST(ColorSpaceParseJpegICCProfile, r) { |
| 83 SkAutoTDelete<SkStream> stream(resource("icc-v2-gbr.jpg")); | 83 SkAutoTDelete<SkStream> stream(resource("icc-v2-gbr.jpg")); |
| 84 REPORTER_ASSERT(r, nullptr != stream); | 84 REPORTER_ASSERT(r, nullptr != stream); |
| 85 if (!stream) { | 85 if (!stream) { |
| 86 return; | 86 return; |
| 87 } | 87 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 112 sk_sp<SkColorSpace> rgbColorSpace = SkColorSpace::NewRGB( | 112 sk_sp<SkColorSpace> rgbColorSpace = SkColorSpace::NewRGB( |
| 113 SkColorSpace::SkGammas(2.2f, 2.2f, 2.2f), srgbToxyzD50); | 113 SkColorSpace::SkGammas(2.2f, 2.2f, 2.2f), srgbToxyzD50); |
| 114 REPORTER_ASSERT(r, namedColorSpace == namedColorSpace); | 114 REPORTER_ASSERT(r, namedColorSpace == namedColorSpace); |
| 115 | 115 |
| 116 // Change a single value from the sRGB matrix | 116 // Change a single value from the sRGB matrix |
| 117 srgbToxyzD50.set(2, 2, 0.5f); | 117 srgbToxyzD50.set(2, 2, 0.5f); |
| 118 sk_sp<SkColorSpace> strangeColorSpace = SkColorSpace::NewRGB( | 118 sk_sp<SkColorSpace> strangeColorSpace = SkColorSpace::NewRGB( |
| 119 SkColorSpace::SkGammas(2.2f, 2.2f, 2.2f), srgbToxyzD50); | 119 SkColorSpace::SkGammas(2.2f, 2.2f, 2.2f), srgbToxyzD50); |
| 120 REPORTER_ASSERT(r, strangeColorSpace != namedColorSpace); | 120 REPORTER_ASSERT(r, strangeColorSpace != namedColorSpace); |
| 121 } | 121 } |
| OLD | NEW |