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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 push_src("image", "stripe", new CodecSrc(path, CodecSrc::kStripe_Mode, | 275 push_src("image", "stripe", new CodecSrc(path, CodecSrc::kStripe_Mode, |
276 CodecSrc::kGetFromCanvas_DstColorType, scale)); | 276 CodecSrc::kGetFromCanvas_DstColorType, scale)); |
277 // Note: The only codec which supports subsets natively is SkWebpCodec, which will never | 277 // Note: The only codec which supports subsets natively is SkWebpCodec, which will never |
278 // report kIndex_8 or kGray_8, so there is no need to test kSubset_mode with those color | 278 // report kIndex_8 or kGray_8, so there is no need to test kSubset_mode with those color |
279 // types specifically requested. | 279 // types specifically requested. |
280 push_src("image", "codec_subset", new CodecSrc(path, CodecSrc::kSubset_M ode, | 280 push_src("image", "codec_subset", new CodecSrc(path, CodecSrc::kSubset_M ode, |
281 CodecSrc::kGetFromCanvas_DstColorType, scale)); | 281 CodecSrc::kGetFromCanvas_DstColorType, scale)); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 static void push_brd_srcs(Path path) { | |
286 // Choose sample sizes to test. | |
287 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | |
288 | |
289 for (uint32_t sampleSize : sampleSizes) { | |
290 // Directly specify the color types that we want to test on. We will | |
291 // only test on the 8888 backend to avoid duplication of tests. | |
292 | |
293 // Canvas Strategy supports N32 and 565 | |
294 push_src("image", "brd_canvas_kN32", new BRDSrc(path, | |
scroggo
2015/09/01 22:05:28
I think this can be cleaned up to behave similarly
msarett
2015/09/02 18:02:23
Yes it can! Done.
| |
295 SkBitmapRegionDecoder::kCanvas_Strategy, BRDSrc::kFullImage_Mode , | |
296 kN32_SkColorType, sampleSize)); | |
297 push_src("image", "brd_canvas_subset_kN32", new BRDSrc(path, | |
298 SkBitmapRegionDecoder::kCanvas_Strategy, BRDSrc::kDivisor_Mode, | |
299 kN32_SkColorType, sampleSize)); | |
300 push_src("image", "brd_canvas_k565", new BRDSrc(path, | |
301 SkBitmapRegionDecoder::kCanvas_Strategy, BRDSrc::kFullImage_Mode , | |
302 kRGB_565_SkColorType, sampleSize)); | |
303 push_src("image", "brd_canvas_subset_k565", new BRDSrc(path, | |
304 SkBitmapRegionDecoder::kCanvas_Strategy, BRDSrc::kDivisor_Mode, | |
305 kRGB_565_SkColorType, sampleSize)); | |
306 | |
307 // Sample Strategy supports N32, 565, Alpha8, and Index8 | |
308 push_src("image", "brd_sample_kN32", new BRDSrc(path, | |
309 SkBitmapRegionDecoder::kOriginal_Strategy, BRDSrc::kFullImage_Mo de, | |
310 kN32_SkColorType, sampleSize)); | |
311 push_src("image", "brd_sample_subset_kN32", new BRDSrc(path, | |
312 SkBitmapRegionDecoder::kOriginal_Strategy, BRDSrc::kDivisor_Mode , | |
313 kN32_SkColorType, sampleSize)); | |
314 push_src("image", "brd_sample_k565", new BRDSrc(path, | |
315 SkBitmapRegionDecoder::kOriginal_Strategy, BRDSrc::kFullImage_Mo de, | |
316 kRGB_565_SkColorType, sampleSize)); | |
317 push_src("image", "brd_sample_subset_k565", new BRDSrc(path, | |
318 SkBitmapRegionDecoder::kOriginal_Strategy, BRDSrc::kDivisor_Mode , | |
319 kRGB_565_SkColorType, sampleSize)); | |
320 push_src("image", "brd_sample_kAlpha", new BRDSrc(path, | |
321 SkBitmapRegionDecoder::kOriginal_Strategy, BRDSrc::kFullImage_Mo de, | |
322 kAlpha_8_SkColorType, sampleSize)); | |
323 push_src("image", "brd_sample_subset_kAlpha", new BRDSrc(path, | |
324 SkBitmapRegionDecoder::kOriginal_Strategy, BRDSrc::kDivisor_Mode , | |
325 kAlpha_8_SkColorType, sampleSize)); | |
326 push_src("image", "brd_sample_kIndex", new BRDSrc(path, | |
327 SkBitmapRegionDecoder::kOriginal_Strategy, BRDSrc::kFullImage_Mo de, | |
328 kIndex_8_SkColorType, sampleSize)); | |
329 push_src("image", "brd_sample_subset_kIndex", new BRDSrc(path, | |
330 SkBitmapRegionDecoder::kOriginal_Strategy, BRDSrc::kDivisor_Mode , | |
331 kIndex_8_SkColorType, sampleSize)); | |
332 } | |
333 | |
334 } | |
335 | |
285 static bool codec_supported(const char* ext) { | 336 static bool codec_supported(const char* ext) { |
scroggo
2015/09/01 22:05:28
I was glancing at this earlier - do we still need
msarett
2015/09/02 18:02:23
You are correct that it's no longer needed. I wil
| |
286 // FIXME: Once other versions of SkCodec are available, we can add them to t his | 337 // FIXME: Once other versions of SkCodec are available, we can add them to t his |
287 // list (and eventually we can remove this check once they are all supported ). | 338 // list (and eventually we can remove this check once they are all supported ). |
288 static const char* const exts[] = { | 339 static const char* const exts[] = { |
289 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp", | 340 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp", |
290 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP", | 341 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP", |
291 }; | 342 }; |
292 | 343 |
293 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | 344 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { |
294 if (0 == strcmp(exts[i], ext)) { | 345 if (0 == strcmp(exts[i], ext)) { |
295 return true; | 346 return true; |
(...skipping 26 matching lines...) Expand all Loading... | |
322 if (sk_isdir(flag)) { | 373 if (sk_isdir(flag)) { |
323 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 374 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { |
324 SkOSFile::Iter it(flag, exts[j]); | 375 SkOSFile::Iter it(flag, exts[j]); |
325 for (SkString file; it.next(&file); ) { | 376 for (SkString file; it.next(&file); ) { |
326 SkString path = SkOSPath::Join(flag, file.c_str()); | 377 SkString path = SkOSPath::Join(flag, file.c_str()); |
327 push_src("image", "decode", new ImageSrc(path)); // Decode e ntire image | 378 push_src("image", "decode", new ImageSrc(path)); // Decode e ntire image |
328 push_src("image", "subset", new ImageSrc(path, 2)); // Decod e into 2x2 subsets | 379 push_src("image", "subset", new ImageSrc(path, 2)); // Decod e into 2x2 subsets |
329 if (codec_supported(exts[j])) { | 380 if (codec_supported(exts[j])) { |
330 push_codec_srcs(path); | 381 push_codec_srcs(path); |
331 } | 382 } |
383 push_brd_srcs(path); | |
332 } | 384 } |
333 } | 385 } |
334 } else if (sk_exists(flag)) { | 386 } else if (sk_exists(flag)) { |
335 // assume that FLAGS_images[i] is a valid image if it is a file. | 387 // assume that FLAGS_images[i] is a valid image if it is a file. |
336 push_src("image", "decode", new ImageSrc(flag)); // Decode entire im age. | 388 push_src("image", "decode", new ImageSrc(flag)); // Decode entire im age. |
337 push_src("image", "subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subsets | 389 push_src("image", "subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subsets |
338 push_codec_srcs(flag); | 390 push_codec_srcs(flag); |
391 push_brd_srcs(flag); | |
339 } | 392 } |
340 } | 393 } |
341 } | 394 } |
342 | 395 |
343 static GrGLStandard get_gpu_api() { | 396 static GrGLStandard get_gpu_api() { |
344 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } | 397 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } |
345 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } | 398 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } |
346 return kNone_GrGLStandard; | 399 return kNone_GrGLStandard; |
347 } | 400 } |
348 | 401 |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
913 } | 966 } |
914 return 0; | 967 return 0; |
915 } | 968 } |
916 | 969 |
917 #if !defined(SK_BUILD_FOR_IOS) | 970 #if !defined(SK_BUILD_FOR_IOS) |
918 int main(int argc, char** argv) { | 971 int main(int argc, char** argv) { |
919 SkCommandLineFlags::Parse(argc, argv); | 972 SkCommandLineFlags::Parse(argc, argv); |
920 return dm_main(); | 973 return dm_main(); |
921 } | 974 } |
922 #endif | 975 #endif |
OLD | NEW |