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 22 matching lines...) Expand all Loading... |
33 const float* ref[3] = { red, green, blue }; | 33 const float* ref[3] = { red, green, blue }; |
34 float dst[4]; | 34 float dst[4]; |
35 for (int i = 0; i < 3; ++i) { | 35 for (int i = 0; i < 3; ++i) { |
36 mat.mapScalars(&src[i*4], dst); | 36 mat.mapScalars(&src[i*4], dst); |
37 REPORTER_ASSERT(r, almost_equal(ref[i][0], dst[0])); | 37 REPORTER_ASSERT(r, almost_equal(ref[i][0], dst[0])); |
38 REPORTER_ASSERT(r, almost_equal(ref[i][1], dst[1])); | 38 REPORTER_ASSERT(r, almost_equal(ref[i][1], dst[1])); |
39 REPORTER_ASSERT(r, almost_equal(ref[i][2], dst[2])); | 39 REPORTER_ASSERT(r, almost_equal(ref[i][2], dst[2])); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 static SkStreamAsset* resource(const char path[]) { | |
44 SkString fullPath = GetResourcePath(path); | |
45 return SkStream::NewFromFile(fullPath.c_str()); | |
46 } | |
47 | |
48 static void test_path(skiatest::Reporter* r, const char* path, | 43 static void test_path(skiatest::Reporter* r, const char* path, |
49 const float red[], const float green[], const float blue[]
, | 44 const float red[], const float green[], const float blue[]
, |
50 const SkGammaNamed expectedGamma) { | 45 const SkGammaNamed expectedGamma) { |
51 SkAutoTDelete<SkStream> stream(resource(path)); | 46 SkAutoTDelete<SkStream> stream(GetResourceAsStream(path)); |
52 REPORTER_ASSERT(r, nullptr != stream); | 47 REPORTER_ASSERT(r, nullptr != stream); |
53 if (!stream) { | 48 if (!stream) { |
54 return; | 49 return; |
55 } | 50 } |
56 | 51 |
57 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); | 52 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release())); |
58 REPORTER_ASSERT(r, nullptr != codec); | 53 REPORTER_ASSERT(r, nullptr != codec); |
59 if (!codec) { | 54 if (!codec) { |
60 return; | 55 return; |
61 } | 56 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 REPORTER_ASSERT(r, !SkColorSpace::Equals(srgb.get(), nullptr)); | 243 REPORTER_ASSERT(r, !SkColorSpace::Equals(srgb.get(), nullptr)); |
249 REPORTER_ASSERT(r, !SkColorSpace::Equals(adobe.get(), srgb.get())); | 244 REPORTER_ASSERT(r, !SkColorSpace::Equals(adobe.get(), srgb.get())); |
250 REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), srgb.get())); | 245 REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), srgb.get())); |
251 REPORTER_ASSERT(r, !SkColorSpace::Equals(z32.get(), z30.get())); | 246 REPORTER_ASSERT(r, !SkColorSpace::Equals(z32.get(), z30.get())); |
252 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), srgb.get())); | 247 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), srgb.get())); |
253 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), upperRight.get()))
; | 248 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperLeft.get(), upperRight.get()))
; |
254 REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), upperRight.get())); | 249 REPORTER_ASSERT(r, !SkColorSpace::Equals(z30.get(), upperRight.get())); |
255 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperRight.get(), adobe.get())); | 250 REPORTER_ASSERT(r, !SkColorSpace::Equals(upperRight.get(), adobe.get())); |
256 REPORTER_ASSERT(r, !SkColorSpace::Equals(rgb1.get(), rgb2.get())); | 251 REPORTER_ASSERT(r, !SkColorSpace::Equals(rgb1.get(), rgb2.get())); |
257 } | 252 } |
OLD | NEW |