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