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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
100 sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::NewNamed(SkColorSpace::k
SRGB_Named); | 100 sk_sp<SkColorSpace> namedColorSpace = SkColorSpace::NewNamed(SkColorSpace::k
SRGB_Named); |
101 | 101 |
102 // Create an sRGB color space by value | 102 // Create an sRGB color space by value |
103 SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor); | 103 SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor); |
104 srgbToxyzD50.set3x3ColMajorf(g_sRGB_XYZ); | 104 srgbToxyzD50.set3x3RowMajorf(g_sRGB_XYZ); |
105 sk_sp<SkColorSpace> rgbColorSpace = SkColorSpace::NewRGB(SkColorSpace::kSRGB
_GammaNamed, | 105 sk_sp<SkColorSpace> rgbColorSpace = SkColorSpace::NewRGB(SkColorSpace::kSRGB
_GammaNamed, |
106 srgbToxyzD50); | 106 srgbToxyzD50); |
107 REPORTER_ASSERT(r, rgbColorSpace == namedColorSpace); | 107 REPORTER_ASSERT(r, rgbColorSpace == namedColorSpace); |
108 | 108 |
109 // Change a single value from the sRGB matrix | 109 // Change a single value from the sRGB matrix |
110 srgbToxyzD50.set(2, 2, 0.5f); | 110 srgbToxyzD50.set(2, 2, 0.5f); |
111 sk_sp<SkColorSpace> strangeColorSpace = SkColorSpace::NewRGB(SkColorSpace::k
SRGB_GammaNamed, | 111 sk_sp<SkColorSpace> strangeColorSpace = SkColorSpace::NewRGB(SkColorSpace::k
SRGB_GammaNamed, |
112 srgbToxyzD50); | 112 srgbToxyzD50); |
113 REPORTER_ASSERT(r, strangeColorSpace != namedColorSpace); | 113 REPORTER_ASSERT(r, strangeColorSpace != namedColorSpace); |
114 } | 114 } |
(...skipping 81 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 |