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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 | 61 |
62 DEF_TEST(ColorSpaceParsePngICCProfile, r) { | 62 DEF_TEST(ColorSpaceParsePngICCProfile, r) { |
63 SkAutoTDelete<SkStream> stream(resource("color_wheel_with_profile.png")); | 63 SkAutoTDelete<SkStream> stream(resource("color_wheel_with_profile.png")); |
64 REPORTER_ASSERT(r, nullptr != stream); | 64 REPORTER_ASSERT(r, nullptr != stream); |
65 if (!stream) { | 65 if (!stream) { |
66 return; | 66 return; |
67 } | 67 } |
68 | 68 |
69 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); | 69 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); |
70 if (!codec) { | 70 REPORTER_ASSERT(r, nullptr != codec); |
71 ERRORF(r, "Failed to create codec from a PNG. Is PNG support missing (or
too old)?"); | |
72 return; | |
73 } | |
74 | 71 |
75 #if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_M
INOR >= 6) | 72 #if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_M
INOR >= 6) |
76 SkColorSpace* colorSpace = codec->getColorSpace(); | 73 SkColorSpace* colorSpace = codec->getColorSpace(); |
77 REPORTER_ASSERT(r, nullptr != colorSpace); | 74 REPORTER_ASSERT(r, nullptr != colorSpace); |
78 | 75 |
79 test_space(r, colorSpace, &g_sRGB_XYZ[0], &g_sRGB_XYZ[3], &g_sRGB_XYZ[6], g_
sRGB_gamma); | 76 test_space(r, colorSpace, &g_sRGB_XYZ[0], &g_sRGB_XYZ[3], &g_sRGB_XYZ[6], g_
sRGB_gamma); |
80 #endif | 77 #endif |
81 } | 78 } |
82 | 79 |
83 DEF_TEST(ColorSpaceParseJpegICCProfile, r) { | 80 DEF_TEST(ColorSpaceParseJpegICCProfile, r) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return; | 131 return; |
135 } | 132 } |
136 sk_sp<SkColorSpace> monitorSpace = SkColorSpace::NewICC(monitorData->data(), | 133 sk_sp<SkColorSpace> monitorSpace = SkColorSpace::NewICC(monitorData->data(), |
137 monitorData->size())
; | 134 monitorData->size())
; |
138 sk_sp<SkData> newMonitorData = as_CSB(monitorSpace)->writeToICC(); | 135 sk_sp<SkData> newMonitorData = as_CSB(monitorSpace)->writeToICC(); |
139 sk_sp<SkColorSpace> newMonitorSpace = SkColorSpace::NewICC(newMonitorData->d
ata(), | 136 sk_sp<SkColorSpace> newMonitorSpace = SkColorSpace::NewICC(newMonitorData->d
ata(), |
140 newMonitorData->s
ize()); | 137 newMonitorData->s
ize()); |
141 REPORTER_ASSERT(r, monitorSpace->xyz() == newMonitorSpace->xyz()); | 138 REPORTER_ASSERT(r, monitorSpace->xyz() == newMonitorSpace->xyz()); |
142 REPORTER_ASSERT(r, as_CSB(monitorSpace)->gammas() == as_CSB(newMonitorSpace)
->gammas()); | 139 REPORTER_ASSERT(r, as_CSB(monitorSpace)->gammas() == as_CSB(newMonitorSpace)
->gammas()); |
143 } | 140 } |
OLD | NEW |