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 "CrashHandler.h" | 8 #include "CrashHandler.h" |
9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 return; | 190 return; |
191 } | 191 } |
192 | 192 |
193 // Build additional test cases for images that decode natively to non-canvas types | 193 // Build additional test cases for images that decode natively to non-canvas types |
194 switch(codec->getInfo().colorType()) { | 194 switch(codec->getInfo().colorType()) { |
195 case kGray_8_SkColorType: | 195 case kGray_8_SkColorType: |
196 push_src("image", "codec kGray8", new CodecSrc(path, CodecSrc::kNorm al_Mode, | 196 push_src("image", "codec kGray8", new CodecSrc(path, CodecSrc::kNorm al_Mode, |
197 CodecSrc::kGrayscale_Always_DstColorType)); | 197 CodecSrc::kGrayscale_Always_DstColorType)); |
198 push_src("image", "scanline kGray8", new CodecSrc(path, CodecSrc::kS canline_Mode, | 198 push_src("image", "scanline kGray8", new CodecSrc(path, CodecSrc::kS canline_Mode, |
199 CodecSrc::kGrayscale_Always_DstColorType)); | 199 CodecSrc::kGrayscale_Always_DstColorType)); |
200 // Intentional fall through | 200 break; |
201 // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8? | 201 // Disallowing fall through |
202 // FIXME: Without fall through we skip testing wbmp decodes to kInde x8. | |
203 // With fall through we test jpg decodes to kIndex8, which ar e disallowed. | |
scroggo
2015/04/10 17:19:05
Won't we just return Error::Nonfatal?
msarett
2015/04/13 20:54:04
This code from my last CL was actually buggy. It
| |
202 // Further discussion on this topic is at skbug.com/3683 | 204 // Further discussion on this topic is at skbug.com/3683 |
203 case kIndex_8_SkColorType: | 205 case kIndex_8_SkColorType: |
204 push_src("image", "codec kIndex8", new CodecSrc(path, CodecSrc::kNorma l_Mode, | 206 push_src("image", "codec kIndex8", new CodecSrc(path, CodecSrc::kNorma l_Mode, |
205 CodecSrc::kIndex8_Always_DstColorType)); | 207 CodecSrc::kIndex8_Always_DstColorType)); |
206 push_src("image", "scanline kIndex8", new CodecSrc(path, CodecSrc::kSc anline_Mode, | 208 push_src("image", "scanline kIndex8", new CodecSrc(path, CodecSrc::kSc anline_Mode, |
207 CodecSrc::kIndex8_Always_DstColorType)); | 209 CodecSrc::kIndex8_Always_DstColorType)); |
208 break; | 210 break; |
209 default: | 211 default: |
210 // Do nothing | 212 // Do nothing |
211 break; | 213 break; |
212 } | 214 } |
213 | 215 |
214 // Decode all images to the canvas color type | 216 // Decode all images to the canvas color type |
215 push_src("image", "codec", new CodecSrc(path, CodecSrc::kNormal_Mode, | 217 push_src("image", "codec", new CodecSrc(path, CodecSrc::kNormal_Mode, |
216 CodecSrc::kGetFromCanvas_DstColorType)); | 218 CodecSrc::kGetFromCanvas_DstColorType)); |
217 push_src("image", "scanline", new CodecSrc(path, CodecSrc::kScanline_Mode, | 219 push_src("image", "scanline", new CodecSrc(path, CodecSrc::kScanline_Mode, |
218 CodecSrc::kGetFromCanvas_DstColorType)); | 220 CodecSrc::kGetFromCanvas_DstColorType)); |
219 } | 221 } |
220 | 222 |
221 static bool codec_supported(const char* ext) { | 223 static bool codec_supported(const char* ext) { |
222 // FIXME: Once other versions of SkCodec are available, we can add them to t his | 224 // FIXME: Once other versions of SkCodec are available, we can add them to t his |
223 // list (and eventually we can remove this check once they are all supported ). | 225 // list (and eventually we can remove this check once they are all supported ). |
224 static const char* const exts[] = { | 226 static const char* const exts[] = { |
225 "bmp", "gif", "png", "ico", "wbmp", | 227 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", |
226 "BMP", "GIF", "PNG", "ICO", "WBMP" | 228 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP" |
227 }; | 229 }; |
228 | 230 |
229 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | 231 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { |
230 if (0 == strcmp(exts[i], ext)) { | 232 if (0 == strcmp(exts[i], ext)) { |
231 return true; | 233 return true; |
232 } | 234 } |
233 } | 235 } |
234 return false; | 236 return false; |
235 } | 237 } |
236 | 238 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
743 } | 745 } |
744 return 0; | 746 return 0; |
745 } | 747 } |
746 | 748 |
747 #if !defined(SK_BUILD_FOR_IOS) | 749 #if !defined(SK_BUILD_FOR_IOS) |
748 int main(int argc, char** argv) { | 750 int main(int argc, char** argv) { |
749 SkCommandLineFlags::Parse(argc, argv); | 751 SkCommandLineFlags::Parse(argc, argv); |
750 return dm_main(); | 752 return dm_main(); |
751 } | 753 } |
752 #endif | 754 #endif |
OLD | NEW |