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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 push_src("image", "stripe", new CodecSrc(path, CodecSrc::kStripe_Mode, | 261 push_src("image", "stripe", new CodecSrc(path, CodecSrc::kStripe_Mode, |
262 CodecSrc::kGetFromCanvas_DstColorType, scale)); | 262 CodecSrc::kGetFromCanvas_DstColorType, scale)); |
263 // Note: The only codec which supports subsets natively is SkWebpCodec,
which will never | 263 // Note: The only codec which supports subsets natively is SkWebpCodec,
which will never |
264 // report kIndex_8 or kGray_8, so there is no need to test kSubset_mode
with those color | 264 // report kIndex_8 or kGray_8, so there is no need to test kSubset_mode
with those color |
265 // types specifically requested. | 265 // types specifically requested. |
266 push_src("image", "codec_subset", new CodecSrc(path, CodecSrc::kSubset_M
ode, | 266 push_src("image", "codec_subset", new CodecSrc(path, CodecSrc::kSubset_M
ode, |
267 CodecSrc::kGetFromCanvas_DstColorType, scale)); | 267 CodecSrc::kGetFromCanvas_DstColorType, scale)); |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
| 271 static void push_brd_srcs(Path path) { |
| 272 // Choose sample sizes to test. |
| 273 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
| 274 |
| 275 for (uint32_t sampleSize : sampleSizes) { |
| 276 // Directly specify the color types that we want to test on. We will |
| 277 // only test on the 8888 backend to avoid duplication of tests. |
| 278 |
| 279 // Canvas Strategy supports N32 and 565 |
| 280 push_src("image", "brd_canvas_kN32", new BRDSrc(path, |
| 281 SkBitmapRegionDecoder::kCanvas_Strategy, BRDSrc::kNormal_Mode, |
| 282 kN32_SkColorType, sampleSize)); |
| 283 push_src("image", "brd_canvas_subset_kN32", new BRDSrc(path, |
| 284 SkBitmapRegionDecoder::kCanvas_Strategy, BRDSrc::kSubset_Mode, |
| 285 kN32_SkColorType, sampleSize)); |
| 286 push_src("image", "brd_canvas_k565", new BRDSrc(path, |
| 287 SkBitmapRegionDecoder::kCanvas_Strategy, BRDSrc::kNormal_Mode, |
| 288 kRGB_565_SkColorType, sampleSize)); |
| 289 push_src("image", "brd_canvas_subset_k565", new BRDSrc(path, |
| 290 SkBitmapRegionDecoder::kCanvas_Strategy, BRDSrc::kSubset_Mode, |
| 291 kRGB_565_SkColorType, sampleSize)); |
| 292 |
| 293 // Sample Strategy supports N32, 565, Alpha8, and Index8 |
| 294 push_src("image", "brd_sample_kN32", new BRDSrc(path, |
| 295 SkBitmapRegionDecoder::kSample_Strategy, BRDSrc::kNormal_Mode, |
| 296 kN32_SkColorType, sampleSize)); |
| 297 push_src("image", "brd_sample_subset_kN32", new BRDSrc(path, |
| 298 SkBitmapRegionDecoder::kSample_Strategy, BRDSrc::kSubset_Mode, |
| 299 kN32_SkColorType, sampleSize)); |
| 300 push_src("image", "brd_sample_k565", new BRDSrc(path, |
| 301 SkBitmapRegionDecoder::kSample_Strategy, BRDSrc::kNormal_Mode, |
| 302 kRGB_565_SkColorType, sampleSize)); |
| 303 push_src("image", "brd_sample_subset_k565", new BRDSrc(path, |
| 304 SkBitmapRegionDecoder::kSample_Strategy, BRDSrc::kSubset_Mode, |
| 305 kRGB_565_SkColorType, sampleSize)); |
| 306 push_src("image", "brd_sample_kAlpha", new BRDSrc(path, |
| 307 SkBitmapRegionDecoder::kSample_Strategy, BRDSrc::kNormal_Mode, |
| 308 kAlpha_8_SkColorType, sampleSize)); |
| 309 push_src("image", "brd_sample_subset_kAlpha", new BRDSrc(path, |
| 310 SkBitmapRegionDecoder::kSample_Strategy, BRDSrc::kSubset_Mode, |
| 311 kAlpha_8_SkColorType, sampleSize)); |
| 312 push_src("image", "brd_sample_kIndex", new BRDSrc(path, |
| 313 SkBitmapRegionDecoder::kSample_Strategy, BRDSrc::kNormal_Mode, |
| 314 kIndex_8_SkColorType, sampleSize)); |
| 315 push_src("image", "brd_sample_subset_kIndex", new BRDSrc(path, |
| 316 SkBitmapRegionDecoder::kSample_Strategy, BRDSrc::kSubset_Mode, |
| 317 kIndex_8_SkColorType, sampleSize)); |
| 318 } |
| 319 |
| 320 } |
| 321 |
271 static bool codec_supported(const char* ext) { | 322 static bool codec_supported(const char* ext) { |
272 // FIXME: Once other versions of SkCodec are available, we can add them to t
his | 323 // FIXME: Once other versions of SkCodec are available, we can add them to t
his |
273 // list (and eventually we can remove this check once they are all supported
). | 324 // list (and eventually we can remove this check once they are all supported
). |
274 static const char* const exts[] = { | 325 static const char* const exts[] = { |
275 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp", | 326 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp", |
276 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP", | 327 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP", |
277 }; | 328 }; |
278 | 329 |
279 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | 330 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { |
280 if (0 == strcmp(exts[i], ext)) { | 331 if (0 == strcmp(exts[i], ext)) { |
(...skipping 27 matching lines...) Expand all Loading... |
308 if (sk_isdir(flag)) { | 359 if (sk_isdir(flag)) { |
309 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 360 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { |
310 SkOSFile::Iter it(flag, exts[j]); | 361 SkOSFile::Iter it(flag, exts[j]); |
311 for (SkString file; it.next(&file); ) { | 362 for (SkString file; it.next(&file); ) { |
312 SkString path = SkOSPath::Join(flag, file.c_str()); | 363 SkString path = SkOSPath::Join(flag, file.c_str()); |
313 push_src("image", "decode", new ImageSrc(path)); // Decode e
ntire image | 364 push_src("image", "decode", new ImageSrc(path)); // Decode e
ntire image |
314 push_src("image", "subset", new ImageSrc(path, 2)); // Decod
e into 2x2 subsets | 365 push_src("image", "subset", new ImageSrc(path, 2)); // Decod
e into 2x2 subsets |
315 if (codec_supported(exts[j])) { | 366 if (codec_supported(exts[j])) { |
316 push_codec_srcs(path); | 367 push_codec_srcs(path); |
317 } | 368 } |
| 369 push_brd_srcs(path); |
318 } | 370 } |
319 } | 371 } |
320 } else if (sk_exists(flag)) { | 372 } else if (sk_exists(flag)) { |
321 // assume that FLAGS_images[i] is a valid image if it is a file. | 373 // assume that FLAGS_images[i] is a valid image if it is a file. |
322 push_src("image", "decode", new ImageSrc(flag)); // Decode entire im
age. | 374 push_src("image", "decode", new ImageSrc(flag)); // Decode entire im
age. |
323 push_src("image", "subset", new ImageSrc(flag, 2)); // Decode into 2
x 2 subsets | 375 push_src("image", "subset", new ImageSrc(flag, 2)); // Decode into 2
x 2 subsets |
324 push_codec_srcs(flag); | 376 push_codec_srcs(flag); |
| 377 push_brd_srcs(flag); |
325 } | 378 } |
326 } | 379 } |
327 } | 380 } |
328 | 381 |
329 static GrGLStandard get_gpu_api() { | 382 static GrGLStandard get_gpu_api() { |
330 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } | 383 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } |
331 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } | 384 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } |
332 return kNone_GrGLStandard; | 385 return kNone_GrGLStandard; |
333 } | 386 } |
334 | 387 |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 } | 896 } |
844 return 0; | 897 return 0; |
845 } | 898 } |
846 | 899 |
847 #if !defined(SK_BUILD_FOR_IOS) | 900 #if !defined(SK_BUILD_FOR_IOS) |
848 int main(int argc, char** argv) { | 901 int main(int argc, char** argv) { |
849 SkCommandLineFlags::Parse(argc, argv); | 902 SkCommandLineFlags::Parse(argc, argv); |
850 return dm_main(); | 903 return dm_main(); |
851 } | 904 } |
852 #endif | 905 #endif |
OLD | NEW |