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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 return false; | 385 return false; |
386 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: | 386 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: |
387 switch (dstColorType) { | 387 switch (dstColorType) { |
388 case CodecSrc::kGetFromCanvas_DstColorType: | 388 case CodecSrc::kGetFromCanvas_DstColorType: |
389 case CodecSrc::kIndex8_Always_DstColorType: | 389 case CodecSrc::kIndex8_Always_DstColorType: |
390 case CodecSrc::kGrayscale_Always_DstColorType: | 390 case CodecSrc::kGrayscale_Always_DstColorType: |
391 return true; | 391 return true; |
392 default: | 392 default: |
393 return false; | 393 return false; |
394 } | 394 } |
| 395 case SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy: |
| 396 switch (dstColorType) { |
| 397 case CodecSrc::kGetFromCanvas_DstColorType: |
| 398 case CodecSrc::kIndex8_Always_DstColorType: |
| 399 case CodecSrc::kGrayscale_Always_DstColorType: |
| 400 return true; |
| 401 default: |
| 402 return false; |
| 403 } |
395 default: | 404 default: |
396 SkASSERT(false); | 405 SkASSERT(false); |
397 return false; | 406 return false; |
398 } | 407 } |
399 } | 408 } |
400 | 409 |
401 static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy str
ategy, | 410 static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy str
ategy, |
402 CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleS
ize) { | 411 CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleS
ize) { |
403 SkString folder; | 412 SkString folder; |
404 switch (strategy) { | 413 switch (strategy) { |
405 case SkBitmapRegionDecoderInterface::kCanvas_Strategy: | 414 case SkBitmapRegionDecoderInterface::kCanvas_Strategy: |
406 folder.append("brd_canvas"); | 415 folder.append("brd_canvas"); |
407 break; | 416 break; |
408 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: | 417 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: |
409 folder.append("brd_sample"); | 418 folder.append("brd_sample"); |
410 break; | 419 break; |
| 420 case SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy: |
| 421 folder.append("brd_android_codec"); |
| 422 break; |
411 default: | 423 default: |
412 SkASSERT(false); | 424 SkASSERT(false); |
413 return; | 425 return; |
414 } | 426 } |
415 | 427 |
416 switch (mode) { | 428 switch (mode) { |
417 case BRDSrc::kFullImage_Mode: | 429 case BRDSrc::kFullImage_Mode: |
418 break; | 430 break; |
419 case BRDSrc::kDivisor_Mode: | 431 case BRDSrc::kDivisor_Mode: |
420 folder.append("_divisor"); | 432 folder.append("_divisor"); |
(...skipping 22 matching lines...) Expand all Loading... |
443 } | 455 } |
444 | 456 |
445 BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize); | 457 BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize); |
446 push_src("image", folder, src); | 458 push_src("image", folder, src); |
447 } | 459 } |
448 | 460 |
449 static void push_brd_srcs(Path path) { | 461 static void push_brd_srcs(Path path) { |
450 | 462 |
451 const SkBitmapRegionDecoderInterface::Strategy strategies[] = { | 463 const SkBitmapRegionDecoderInterface::Strategy strategies[] = { |
452 SkBitmapRegionDecoderInterface::kCanvas_Strategy, | 464 SkBitmapRegionDecoderInterface::kCanvas_Strategy, |
453 SkBitmapRegionDecoderInterface::kOriginal_Strategy | 465 SkBitmapRegionDecoderInterface::kOriginal_Strategy, |
| 466 SkBitmapRegionDecoderInterface::kAndroidCodec_Strategy, |
454 }; | 467 }; |
455 | 468 |
456 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | 469 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
457 | 470 |
458 // We will only test to one backend (8888), but we will test all of the | 471 // We will only test to one backend (8888), but we will test all of the |
459 // color types that we need to decode to on this backend. | 472 // color types that we need to decode to on this backend. |
460 const CodecSrc::DstColorType dstColorTypes[] = { | 473 const CodecSrc::DstColorType dstColorTypes[] = { |
461 CodecSrc::kGetFromCanvas_DstColorType, | 474 CodecSrc::kGetFromCanvas_DstColorType, |
462 CodecSrc::kIndex8_Always_DstColorType, | 475 CodecSrc::kIndex8_Always_DstColorType, |
463 CodecSrc::kGrayscale_Always_DstColorType, | 476 CodecSrc::kGrayscale_Always_DstColorType, |
464 }; | 477 }; |
465 | 478 |
466 const BRDSrc::Mode modes[] = { | 479 const BRDSrc::Mode modes[] = { |
467 BRDSrc::kFullImage_Mode, | 480 BRDSrc::kFullImage_Mode, |
468 BRDSrc::kDivisor_Mode | 481 BRDSrc::kDivisor_Mode, |
469 }; | 482 }; |
470 | 483 |
471 for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) { | 484 for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) { |
472 | 485 |
473 // We disable png testing for kOriginal_Strategy because the implementat
ion leaks | 486 // We disable png testing for kOriginal_Strategy because the implementat
ion leaks |
474 // memory in our forked libpng. | 487 // memory in our forked libpng. |
475 // TODO (msarett): Decide if we want to test pngs in this mode and how w
e might do this. | 488 // TODO (msarett): Decide if we want to test pngs in this mode and how w
e might do this. |
476 if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy && | 489 if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy && |
477 (path.endsWith(".png") || path.endsWith(".PNG"))) { | 490 (path.endsWith(".png") || path.endsWith(".PNG"))) { |
478 continue; | 491 continue; |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 #endif // SK_PDF_IMAGE_STATS | 1161 #endif // SK_PDF_IMAGE_STATS |
1149 return 0; | 1162 return 0; |
1150 } | 1163 } |
1151 | 1164 |
1152 #if !defined(SK_BUILD_FOR_IOS) | 1165 #if !defined(SK_BUILD_FOR_IOS) |
1153 int main(int argc, char** argv) { | 1166 int main(int argc, char** argv) { |
1154 SkCommandLineFlags::Parse(argc, argv); | 1167 SkCommandLineFlags::Parse(argc, argv); |
1155 return dm_main(); | 1168 return dm_main(); |
1156 } | 1169 } |
1157 #endif | 1170 #endif |
OLD | NEW |