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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 REPORTER_ASSERT(r, !cs == !rec.fExpectedToSucceed); | 154 REPORTER_ASSERT(r, !cs == !rec.fExpectedToSucceed); |
158 if (cs) { | 155 if (cs) { |
159 REPORTER_ASSERT(r, SkColorSpace::k2Dot2Curve_GammaNamed == cs->gamma
Named()); | 156 REPORTER_ASSERT(r, SkColorSpace::k2Dot2Curve_GammaNamed == cs->gamma
Named()); |
160 } | 157 } |
161 } | 158 } |
162 | 159 |
163 SkImageInfo info = SkImageInfo::MakeS32(10, 10, kPremul_SkAlphaType); | 160 SkImageInfo info = SkImageInfo::MakeS32(10, 10, kPremul_SkAlphaType); |
164 REPORTER_ASSERT(r, kSRGB_SkColorProfileType == info.profileType()); | 161 REPORTER_ASSERT(r, kSRGB_SkColorProfileType == info.profileType()); |
165 REPORTER_ASSERT(r, SkColorSpace::k2Dot2Curve_GammaNamed == info.colorSpace()
->gammaNamed()); | 162 REPORTER_ASSERT(r, SkColorSpace::k2Dot2Curve_GammaNamed == info.colorSpace()
->gammaNamed()); |
166 } | 163 } |
OLD | NEW |