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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 push_src("image", folder, src); | 398 push_src("image", folder, src); |
399 } | 399 } |
400 | 400 |
401 static void push_brd_srcs(Path path) { | 401 static void push_brd_srcs(Path path) { |
402 | 402 |
403 const SkBitmapRegionDecoderInterface::Strategy strategies[] = { | 403 const SkBitmapRegionDecoderInterface::Strategy strategies[] = { |
404 SkBitmapRegionDecoderInterface::kCanvas_Strategy, | 404 SkBitmapRegionDecoderInterface::kCanvas_Strategy, |
405 SkBitmapRegionDecoderInterface::kOriginal_Strategy | 405 SkBitmapRegionDecoderInterface::kOriginal_Strategy |
406 }; | 406 }; |
407 | 407 |
408 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | |
scroggo
2015/09/11 14:59:47
Why did this move?
(I'm fine with the new locatio
msarett
2015/09/11 15:28:20
Yes that's why.
| |
409 | |
408 // We will only test to one backend (8888), but we will test all of the | 410 // We will only test to one backend (8888), but we will test all of the |
409 // color types that we need to decode to on this backend. | 411 // color types that we need to decode to on this backend. |
410 const CodecSrc::DstColorType dstColorTypes[] = { | 412 const CodecSrc::DstColorType dstColorTypes[] = { |
411 CodecSrc::kGetFromCanvas_DstColorType, | 413 CodecSrc::kGetFromCanvas_DstColorType, |
412 CodecSrc::kIndex8_Always_DstColorType, | 414 CodecSrc::kIndex8_Always_DstColorType, |
413 CodecSrc::kGrayscale_Always_DstColorType, | 415 CodecSrc::kGrayscale_Always_DstColorType, |
414 }; | 416 }; |
415 | 417 |
416 const BRDSrc::Mode modes[] = { | 418 const BRDSrc::Mode modes[] = { |
417 BRDSrc::kFullImage_Mode, | 419 BRDSrc::kFullImage_Mode, |
418 BRDSrc::kDivisor_Mode | 420 BRDSrc::kDivisor_Mode |
419 }; | 421 }; |
420 | 422 |
421 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | 423 for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) { |
422 | 424 |
423 for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) { | |
424 // We disable png testing for kOriginal_Strategy because the implementat ion leaks | 425 // We disable png testing for kOriginal_Strategy because the implementat ion leaks |
425 // memory in our forked libpng. | 426 // memory in our forked libpng. |
426 // TODO (msarett): Decide if we want to test pngs in this mode and how w e might do this. | 427 // TODO (msarett): Decide if we want to test pngs in this mode and how w e might do this. |
427 if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy && | 428 if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy && |
428 (path.endsWith(".png") || path.endsWith(".PNG"))) { | 429 (path.endsWith(".png") || path.endsWith(".PNG"))) { |
429 continue; | 430 continue; |
430 } | 431 } |
431 for (CodecSrc::DstColorType dstColorType : dstColorTypes) { | 432 for (uint32_t sampleSize : sampleSizes) { |
432 if (brd_color_type_supported(strategy, dstColorType)) { | 433 |
433 for (BRDSrc::Mode mode : modes) { | 434 // kOriginal_Strategy does not work for jpegs that are scaled to non -powers of two. |
434 for (uint32_t sampleSize : sampleSizes) { | 435 // We don't need to test this. We know it doesn't work, and it caus es images with |
436 // uninitialized memory to show up on Gold. | |
437 if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy & & | |
438 (path.endsWith(".jpg") || path.endsWith(".JPG") || | |
439 path.endsWith(".jpeg") || path.endsWith(".JPEG")) && !SkIsPo w2(sampleSize)) { | |
440 continue; | |
441 } | |
442 for (CodecSrc::DstColorType dstColorType : dstColorTypes) { | |
443 if (brd_color_type_supported(strategy, dstColorType)) { | |
444 for (BRDSrc::Mode mode : modes) { | |
435 push_brd_src(path, strategy, dstColorType, mode, sampleS ize); | 445 push_brd_src(path, strategy, dstColorType, mode, sampleS ize); |
436 } | 446 } |
437 } | 447 } |
438 } | 448 } |
439 } | 449 } |
440 } | 450 } |
441 } | 451 } |
442 | 452 |
443 static bool brd_supported(const char* ext) { | 453 static bool brd_supported(const char* ext) { |
444 static const char* const exts[] = { | 454 static const char* const exts[] = { |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1072 } | 1082 } |
1073 return 0; | 1083 return 0; |
1074 } | 1084 } |
1075 | 1085 |
1076 #if !defined(SK_BUILD_FOR_IOS) | 1086 #if !defined(SK_BUILD_FOR_IOS) |
1077 int main(int argc, char** argv) { | 1087 int main(int argc, char** argv) { |
1078 SkCommandLineFlags::Parse(argc, argv); | 1088 SkCommandLineFlags::Parse(argc, argv); |
1079 return dm_main(); | 1089 return dm_main(); |
1080 } | 1090 } |
1081 #endif | 1091 #endif |
OLD | NEW |