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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 return false; | 347 return false; |
348 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: | 348 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: |
349 switch (dstColorType) { | 349 switch (dstColorType) { |
350 case CodecSrc::kGetFromCanvas_DstColorType: | 350 case CodecSrc::kGetFromCanvas_DstColorType: |
351 case CodecSrc::kIndex8_Always_DstColorType: | 351 case CodecSrc::kIndex8_Always_DstColorType: |
352 case CodecSrc::kGrayscale_Always_DstColorType: | 352 case CodecSrc::kGrayscale_Always_DstColorType: |
353 return true; | 353 return true; |
354 default: | 354 default: |
355 return false; | 355 return false; |
356 } | 356 } |
| 357 case SkBitmapRegionDecoderInterface::kCodec_Strategy: |
| 358 switch (dstColorType) { |
| 359 case CodecSrc::kGetFromCanvas_DstColorType: |
| 360 case CodecSrc::kIndex8_Always_DstColorType: |
| 361 case CodecSrc::kGrayscale_Always_DstColorType: |
| 362 return true; |
| 363 default: |
| 364 return false; |
| 365 } |
357 default: | 366 default: |
358 SkASSERT(false); | 367 SkASSERT(false); |
359 return false; | 368 return false; |
360 } | 369 } |
361 } | 370 } |
362 | 371 |
363 static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy str
ategy, | 372 static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy str
ategy, |
364 CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleS
ize) { | 373 CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleS
ize) { |
365 SkString folder; | 374 SkString folder; |
366 switch (strategy) { | 375 switch (strategy) { |
367 case SkBitmapRegionDecoderInterface::kCanvas_Strategy: | 376 case SkBitmapRegionDecoderInterface::kCanvas_Strategy: |
368 folder.append("brd_canvas"); | 377 folder.append("brd_canvas"); |
369 break; | 378 break; |
370 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: | 379 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: |
371 folder.append("brd_sample"); | 380 folder.append("brd_sample"); |
372 break; | 381 break; |
| 382 case SkBitmapRegionDecoderInterface::kCodec_Strategy: |
| 383 folder.append("brd_codec"); |
| 384 break; |
373 default: | 385 default: |
374 SkASSERT(false); | 386 SkASSERT(false); |
375 return; | 387 return; |
376 } | 388 } |
377 | 389 |
378 switch (mode) { | 390 switch (mode) { |
379 case BRDSrc::kFullImage_Mode: | 391 case BRDSrc::kFullImage_Mode: |
380 break; | 392 break; |
381 case BRDSrc::kDivisor_Mode: | 393 case BRDSrc::kDivisor_Mode: |
382 folder.append("_divisor"); | 394 folder.append("_divisor"); |
(...skipping 22 matching lines...) Expand all Loading... |
405 } | 417 } |
406 | 418 |
407 BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize); | 419 BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize); |
408 push_src("image", folder, src); | 420 push_src("image", folder, src); |
409 } | 421 } |
410 | 422 |
411 static void push_brd_srcs(Path path) { | 423 static void push_brd_srcs(Path path) { |
412 | 424 |
413 const SkBitmapRegionDecoderInterface::Strategy strategies[] = { | 425 const SkBitmapRegionDecoderInterface::Strategy strategies[] = { |
414 SkBitmapRegionDecoderInterface::kCanvas_Strategy, | 426 SkBitmapRegionDecoderInterface::kCanvas_Strategy, |
415 SkBitmapRegionDecoderInterface::kOriginal_Strategy | 427 SkBitmapRegionDecoderInterface::kOriginal_Strategy, |
| 428 SkBitmapRegionDecoderInterface::kCodec_Strategy, |
416 }; | 429 }; |
417 | 430 |
418 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | 431 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
419 | 432 |
420 // We will only test to one backend (8888), but we will test all of the | 433 // We will only test to one backend (8888), but we will test all of the |
421 // color types that we need to decode to on this backend. | 434 // color types that we need to decode to on this backend. |
422 const CodecSrc::DstColorType dstColorTypes[] = { | 435 const CodecSrc::DstColorType dstColorTypes[] = { |
423 CodecSrc::kGetFromCanvas_DstColorType, | 436 CodecSrc::kGetFromCanvas_DstColorType, |
424 CodecSrc::kIndex8_Always_DstColorType, | 437 CodecSrc::kIndex8_Always_DstColorType, |
425 CodecSrc::kGrayscale_Always_DstColorType, | 438 CodecSrc::kGrayscale_Always_DstColorType, |
426 }; | 439 }; |
427 | 440 |
428 const BRDSrc::Mode modes[] = { | 441 const BRDSrc::Mode modes[] = { |
429 BRDSrc::kFullImage_Mode, | 442 BRDSrc::kFullImage_Mode, |
430 BRDSrc::kDivisor_Mode | 443 BRDSrc::kDivisor_Mode |
431 }; | 444 }; |
432 | 445 |
433 for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) { | 446 for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) { |
434 | 447 |
435 // We disable png testing for kOriginal_Strategy because the implementat
ion leaks | 448 // We disable png testing for kOriginal_Strategy because the implementat
ion leaks |
436 // memory in our forked libpng. | 449 // memory in our forked libpng. |
437 // TODO (msarett): Decide if we want to test pngs in this mode and how w
e might do this. | 450 // TODO (msarett): Decide if we want to test pngs in this mode and how w
e might do this. |
438 if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy && | 451 if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy && |
439 (path.endsWith(".png") || path.endsWith(".PNG"))) { | 452 (path.endsWith(".png") || path.endsWith(".PNG"))) { |
440 continue; | 453 continue; |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 #endif // SK_PDF_IMAGE_STATS | 1121 #endif // SK_PDF_IMAGE_STATS |
1109 return 0; | 1122 return 0; |
1110 } | 1123 } |
1111 | 1124 |
1112 #if !defined(SK_BUILD_FOR_IOS) | 1125 #if !defined(SK_BUILD_FOR_IOS) |
1113 int main(int argc, char** argv) { | 1126 int main(int argc, char** argv) { |
1114 SkCommandLineFlags::Parse(argc, argv); | 1127 SkCommandLineFlags::Parse(argc, argv); |
1115 return dm_main(); | 1128 return dm_main(); |
1116 } | 1129 } |
1117 #endif | 1130 #endif |
OLD | NEW |