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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 SkAutoTDelete<SkStream> stream(resource("color_wheel_with_profile.png")); | 58 SkAutoTDelete<SkStream> stream(resource("color_wheel_with_profile.png")); |
59 REPORTER_ASSERT(r, nullptr != stream); | 59 REPORTER_ASSERT(r, nullptr != stream); |
60 if (!stream) { | 60 if (!stream) { |
61 return; | 61 return; |
62 } | 62 } |
63 | 63 |
64 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); | 64 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); |
65 REPORTER_ASSERT(r, nullptr != codec); | 65 REPORTER_ASSERT(r, nullptr != codec); |
66 | 66 |
67 #if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_M
INOR >= 6) | 67 #if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_M
INOR >= 6) |
68 SkColorSpace* colorSpace = codec->getColorSpace(); | 68 SkColorSpace* colorSpace = codec->getInfo().colorSpace(); |
69 REPORTER_ASSERT(r, nullptr != colorSpace); | 69 REPORTER_ASSERT(r, nullptr != colorSpace); |
70 | 70 |
71 test_space(r, colorSpace, &g_sRGB_XYZ[0], &g_sRGB_XYZ[3], &g_sRGB_XYZ[6], | 71 test_space(r, colorSpace, &g_sRGB_XYZ[0], &g_sRGB_XYZ[3], &g_sRGB_XYZ[6], |
72 SkColorSpace::kSRGB_GammaNamed); | 72 SkColorSpace::kSRGB_GammaNamed); |
73 #endif | 73 #endif |
74 } | 74 } |
75 | 75 |
76 DEF_TEST(ColorSpaceParseJpegICCProfile, r) { | 76 DEF_TEST(ColorSpaceParseJpegICCProfile, r) { |
77 SkAutoTDelete<SkStream> stream(resource("icc-v2-gbr.jpg")); | 77 SkAutoTDelete<SkStream> stream(resource("icc-v2-gbr.jpg")); |
78 REPORTER_ASSERT(r, nullptr != stream); | 78 REPORTER_ASSERT(r, nullptr != stream); |
79 if (!stream) { | 79 if (!stream) { |
80 return; | 80 return; |
81 } | 81 } |
82 | 82 |
83 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); | 83 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); |
84 REPORTER_ASSERT(r, nullptr != codec); | 84 REPORTER_ASSERT(r, nullptr != codec); |
85 if (!codec) { | 85 if (!codec) { |
86 return; | 86 return; |
87 } | 87 } |
88 | 88 |
89 SkColorSpace* colorSpace = codec->getColorSpace(); | 89 SkColorSpace* colorSpace = codec->getInfo().colorSpace(); |
90 REPORTER_ASSERT(r, nullptr != colorSpace); | 90 REPORTER_ASSERT(r, nullptr != colorSpace); |
91 | 91 |
92 const float red[] = { 0.385117f, 0.716904f, 0.0970612f }; | 92 const float red[] = { 0.385117f, 0.716904f, 0.0970612f }; |
93 const float green[] = { 0.143051f, 0.0606079f, 0.713913f }; | 93 const float green[] = { 0.143051f, 0.0606079f, 0.713913f }; |
94 const float blue[] = { 0.436035f, 0.222488f, 0.013916f }; | 94 const float blue[] = { 0.436035f, 0.222488f, 0.013916f }; |
95 test_space(r, colorSpace, red, green, blue, SkColorSpace::k2Dot2Curve_GammaN
amed); | 95 test_space(r, colorSpace, red, green, blue, SkColorSpace::k2Dot2Curve_GammaN
amed); |
96 } | 96 } |
97 | 97 |
98 DEF_TEST(ColorSpaceSRGBCompare, r) { | 98 DEF_TEST(ColorSpaceSRGBCompare, r) { |
99 // Create an sRGB color space by name | 99 // Create an sRGB color space by name |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 DEF_TEST(ColorSpace_Serialize, r) { | 197 DEF_TEST(ColorSpace_Serialize, r) { |
198 test_serialize(r, SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named).get(), t
rue); | 198 test_serialize(r, SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named).get(), t
rue); |
199 test_serialize(r, SkColorSpace::NewNamed(SkColorSpace::kAdobeRGB_Named).get(
), true); | 199 test_serialize(r, SkColorSpace::NewNamed(SkColorSpace::kAdobeRGB_Named).get(
), true); |
200 | 200 |
201 sk_sp<SkData> monitorData = SkData::MakeFromFileName( | 201 sk_sp<SkData> monitorData = SkData::MakeFromFileName( |
202 GetResourcePath("monitor_profiles/HP_ZR30w.icc").c_str()); | 202 GetResourcePath("monitor_profiles/HP_ZR30w.icc").c_str()); |
203 test_serialize(r, SkColorSpace::NewICC(monitorData->data(), monitorData->siz
e()).get(), false); | 203 test_serialize(r, SkColorSpace::NewICC(monitorData->data(), monitorData->siz
e()).get(), false); |
204 } | 204 } |
205 | 205 |
OLD | NEW |