| 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 static SkStreamAsset* resource(const char path[]) { | 14 static SkStreamAsset* resource(const char path[]) { |
| 15 SkString fullPath = GetResourcePath(path); | 15 SkString fullPath = GetResourcePath(path); |
| 16 return SkStream::NewFromFile(fullPath.c_str()); | 16 return SkStream::NewFromFile(fullPath.c_str()); |
| 17 } | 17 } |
| 18 | 18 |
| 19 static void codec_yuv(skiatest::Reporter* reporter, | 19 static void codec_yuv(skiatest::Reporter* reporter, |
| 20 const char path[], | 20 const char path[], |
| 21 SkISize expectedSizes[3]) { | 21 SkISize expectedSizes[3]) { |
| 22 SkAutoTDelete<SkStream> stream(resource(path)); | 22 SkAutoTDelete<SkStream> stream(resource(path)); |
| 23 if (!stream) { | 23 if (!stream) { |
| 24 SkDebugf("Missing resource '%s'\n", path); | 24 INFOF(reporter, "Missing resource '%s'\n", path); |
| 25 return; | 25 return; |
| 26 } | 26 } |
| 27 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); | 27 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); |
| 28 REPORTER_ASSERT(reporter, codec); | 28 REPORTER_ASSERT(reporter, codec); |
| 29 if (!codec) { | 29 if (!codec) { |
| 30 return; | 30 return; |
| 31 } | 31 } |
| 32 | 32 |
| 33 // Test queryYUV8() | 33 // Test queryYUV8() |
| 34 SkCodec::YUVSizeInfo info; | 34 SkCodec::YUVSizeInfo info; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 codec_yuv(r, "brickwork-texture.jpg", sizes); | 112 codec_yuv(r, "brickwork-texture.jpg", sizes); |
| 113 codec_yuv(r, "brickwork_normal-map.jpg", sizes); | 113 codec_yuv(r, "brickwork_normal-map.jpg", sizes); |
| 114 | 114 |
| 115 // A CMYK encoded image should fail. | 115 // A CMYK encoded image should fail. |
| 116 codec_yuv(r, "CMYK.jpg", nullptr); | 116 codec_yuv(r, "CMYK.jpg", nullptr); |
| 117 // A grayscale encoded image should fail. | 117 // A grayscale encoded image should fail. |
| 118 codec_yuv(r, "grayscale.jpg", nullptr); | 118 codec_yuv(r, "grayscale.jpg", nullptr); |
| 119 // A PNG should fail. | 119 // A PNG should fail. |
| 120 codec_yuv(r, "arrow.png", nullptr); | 120 codec_yuv(r, "arrow.png", nullptr); |
| 121 } | 121 } |
| OLD | NEW |