OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCodec.h" | 8 #include "SkCodec.h" |
9 #include "Resources.h" | 9 #include "Resources.h" |
10 #include "SkStream.h" | 10 #include "SkStream.h" |
11 #include "SkTemplates.h" | 11 #include "SkTemplates.h" |
12 #include "Test.h" | 12 #include "Test.h" |
13 | 13 |
| 14 #ifdef SK_CODEC_DECODES_JPEG |
| 15 |
14 static SkStreamAsset* resource(const char path[]) { | 16 static SkStreamAsset* resource(const char path[]) { |
15 SkString fullPath = GetResourcePath(path); | 17 SkString fullPath = GetResourcePath(path); |
16 return SkStream::NewFromFile(fullPath.c_str()); | 18 return SkStream::NewFromFile(fullPath.c_str()); |
17 } | 19 } |
18 | 20 |
19 static void codec_yuv(skiatest::Reporter* reporter, | 21 static void codec_yuv(skiatest::Reporter* reporter, |
20 const char path[], | 22 const char path[], |
21 SkISize expectedSizes[3]) { | 23 SkISize expectedSizes[3]) { |
22 SkAutoTDelete<SkStream> stream(resource(path)); | 24 SkAutoTDelete<SkStream> stream(resource(path)); |
23 if (!stream) { | 25 if (!stream) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 codec_yuv(r, "brickwork-texture.jpg", sizes); | 114 codec_yuv(r, "brickwork-texture.jpg", sizes); |
113 codec_yuv(r, "brickwork_normal-map.jpg", sizes); | 115 codec_yuv(r, "brickwork_normal-map.jpg", sizes); |
114 | 116 |
115 // A CMYK encoded image should fail. | 117 // A CMYK encoded image should fail. |
116 codec_yuv(r, "CMYK.jpg", nullptr); | 118 codec_yuv(r, "CMYK.jpg", nullptr); |
117 // A grayscale encoded image should fail. | 119 // A grayscale encoded image should fail. |
118 codec_yuv(r, "grayscale.jpg", nullptr); | 120 codec_yuv(r, "grayscale.jpg", nullptr); |
119 // A PNG should fail. | 121 // A PNG should fail. |
120 codec_yuv(r, "arrow.png", nullptr); | 122 codec_yuv(r, "arrow.png", nullptr); |
121 } | 123 } |
| 124 |
| 125 #endif |
OLD | NEW |