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