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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 return; | 200 return; |
201 } | 201 } |
202 | 202 |
203 // Build additional test cases for images that decode natively to non-canvas types | 203 // Build additional test cases for images that decode natively to non-canvas types |
204 switch(codec->getInfo().colorType()) { | 204 switch(codec->getInfo().colorType()) { |
205 case kGray_8_SkColorType: | 205 case kGray_8_SkColorType: |
206 push_src("image", "codec_kGray8", new CodecSrc(path, CodecSrc::kNorm al_Mode, | 206 push_src("image", "codec_kGray8", new CodecSrc(path, CodecSrc::kNorm al_Mode, |
207 CodecSrc::kGrayscale_Always_DstColorType)); | 207 CodecSrc::kGrayscale_Always_DstColorType)); |
208 push_src("image", "scanline_kGray8", new CodecSrc(path, CodecSrc::kS canline_Mode, | 208 push_src("image", "scanline_kGray8", new CodecSrc(path, CodecSrc::kS canline_Mode, |
209 CodecSrc::kGrayscale_Always_DstColorType)); | 209 CodecSrc::kGrayscale_Always_DstColorType)); |
210 push_src("image", "scanline_kGray8", new CodecSrc(path, CodecSrc::kS ubset_Mode, | |
211 CodecSrc::kGrayscale_Always_DstColorType)); | |
210 // Intentional fall through | 212 // Intentional fall through |
211 // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8? | 213 // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8? |
212 // Further discussion on this topic is at skbug.com/3683 | 214 // Further discussion on this topic is at skbug.com/3683 |
213 case kIndex_8_SkColorType: | 215 case kIndex_8_SkColorType: |
214 push_src("image", "codec_kIndex8", new CodecSrc(path, CodecSrc::kNorma l_Mode, | 216 push_src("image", "codec_kIndex8", new CodecSrc(path, CodecSrc::kNorma l_Mode, |
215 CodecSrc::kIndex8_Always_DstColorType)); | 217 CodecSrc::kIndex8_Always_DstColorType)); |
216 push_src("image", "scanline_kIndex8", new CodecSrc(path, CodecSrc::kSc anline_Mode, | 218 push_src("image", "scanline_kIndex8", new CodecSrc(path, CodecSrc::kSc anline_Mode, |
217 CodecSrc::kIndex8_Always_DstColorType)); | 219 CodecSrc::kIndex8_Always_DstColorType)); |
220 push_src("image", "scanline_kIndex8", new CodecSrc(path, CodecSrc::kSu bset_Mode, | |
221 CodecSrc::kIndex8_Always_DstColorType)); | |
218 break; | 222 break; |
219 default: | 223 default: |
220 // Do nothing | 224 // Do nothing |
221 break; | 225 break; |
222 } | 226 } |
223 | 227 |
224 // Decode all images to the canvas color type | 228 // Decode all images to the canvas color type |
225 push_src("image", "codec", new CodecSrc(path, CodecSrc::kNormal_Mode, | 229 push_src("image", "codec", new CodecSrc(path, CodecSrc::kNormal_Mode, |
226 CodecSrc::kGetFromCanvas_DstColorType)); | 230 CodecSrc::kGetFromCanvas_DstColorType)); |
227 push_src("image", "scanline", new CodecSrc(path, CodecSrc::kScanline_Mode, | 231 push_src("image", "scanline", new CodecSrc(path, CodecSrc::kScanline_Mode, |
228 CodecSrc::kGetFromCanvas_DstColorType)); | 232 CodecSrc::kGetFromCanvas_DstColorType)); |
233 push_src("image", "subset", new CodecSrc(path, CodecSrc::kSubset_Mode, | |
234 CodecSrc::kGetFromCanvas_DstColorType)); | |
229 } | 235 } |
230 | 236 |
231 static bool codec_supported(const char* ext) { | 237 static bool codec_supported(const char* ext) { |
232 // FIXME: Once other versions of SkCodec are available, we can add them to t his | 238 // FIXME: Once other versions of SkCodec are available, we can add them to t his |
233 // list (and eventually we can remove this check once they are all supported ). | 239 // list (and eventually we can remove this check once they are all supported ). |
234 static const char* const exts[] = { | 240 static const char* const exts[] = { |
235 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", | 241 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", |
236 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP" | 242 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP" |
237 }; | 243 }; |
238 | 244 |
(...skipping 27 matching lines...) Expand all Loading... | |
266 for (int i = 0; i < FLAGS_images.count(); i++) { | 272 for (int i = 0; i < FLAGS_images.count(); i++) { |
267 const char* flag = FLAGS_images[i]; | 273 const char* flag = FLAGS_images[i]; |
268 if (sk_isdir(flag)) { | 274 if (sk_isdir(flag)) { |
269 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 275 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { |
270 SkOSFile::Iter it(flag, exts[j]); | 276 SkOSFile::Iter it(flag, exts[j]); |
271 for (SkString file; it.next(&file); ) { | 277 for (SkString file; it.next(&file); ) { |
272 SkString path = SkOSPath::Join(flag, file.c_str()); | 278 SkString path = SkOSPath::Join(flag, file.c_str()); |
273 push_src("image", "decode", new ImageSrc(path)); // Decode e ntire image | 279 push_src("image", "decode", new ImageSrc(path)); // Decode e ntire image |
274 push_src("image", "subset", new ImageSrc(path, 2)); // Decod e into 2x2 subsets | 280 push_src("image", "subset", new ImageSrc(path, 2)); // Decod e into 2x2 subsets |
275 if (codec_supported(exts[j])) { | 281 if (codec_supported(exts[j])) { |
276 push_codec_srcs(path); | 282 push_codec_srcs(path); //hits bp |
scroggo
2015/05/18 14:03:58
Was this accidentally left in?
emmaleeroach
2015/05/18 20:04:27
Yea, I removed it
| |
277 } | 283 } |
278 } | 284 } |
279 } | 285 } |
280 } else if (sk_exists(flag)) { | 286 } else if (sk_exists(flag)) { |
281 // assume that FLAGS_images[i] is a valid image if it is a file. | 287 // assume that FLAGS_images[i] is a valid image if it is a file. |
282 push_src("image", "decode", new ImageSrc(flag)); // Decode entire im age. | 288 push_src("image", "decode", new ImageSrc(flag)); // Decode entire im age. |
283 push_src("image", "subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subsets | 289 push_src("image", "subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subsets |
284 push_codec_srcs(flag); | 290 push_codec_srcs(flag); |
285 } | 291 } |
286 } | 292 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
758 } | 764 } |
759 return 0; | 765 return 0; |
760 } | 766 } |
761 | 767 |
762 #if !defined(SK_BUILD_FOR_IOS) | 768 #if !defined(SK_BUILD_FOR_IOS) |
763 int main(int argc, char** argv) { | 769 int main(int argc, char** argv) { |
764 SkCommandLineFlags::Parse(argc, argv); | 770 SkCommandLineFlags::Parse(argc, argv); |
765 return dm_main(); | 771 return dm_main(); |
766 } | 772 } |
767 #endif | 773 #endif |
OLD | NEW |