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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } | 387 } |
388 | 388 |
389 if (1.0f != scale) { | 389 if (1.0f != scale) { |
390 folder.appendf("_%.3f", scale); | 390 folder.appendf("_%.3f", scale); |
391 } | 391 } |
392 | 392 |
393 CodecSrc* src = new CodecSrc(path, mode, dstColorType, dstAlphaType, scale); | 393 CodecSrc* src = new CodecSrc(path, mode, dstColorType, dstAlphaType, scale); |
394 push_src("image", folder, src); | 394 push_src("image", folder, src); |
395 } | 395 } |
396 | 396 |
397 static void push_android_codec_src(Path path, AndroidCodecSrc::Mode mode, | 397 static void push_android_codec_src(Path path, CodecSrc::DstColorType dstColorTyp
e, |
398 CodecSrc::DstColorType dstColorType, SkAlphaType dstAlphaType, int sampl
eSize) { | 398 SkAlphaType dstAlphaType, int sampleSize) { |
399 SkString folder; | 399 SkString folder; |
400 switch (mode) { | 400 folder.append("scaled_codec"); |
401 case AndroidCodecSrc::kFullImage_Mode: | |
402 folder.append("scaled_codec"); | |
403 break; | |
404 case AndroidCodecSrc::kDivisor_Mode: | |
405 folder.append("scaled_codec_divisor"); | |
406 break; | |
407 } | |
408 | 401 |
409 switch (dstColorType) { | 402 switch (dstColorType) { |
410 case CodecSrc::kGrayscale_Always_DstColorType: | 403 case CodecSrc::kGrayscale_Always_DstColorType: |
411 folder.append("_kGray8"); | 404 folder.append("_kGray8"); |
412 break; | 405 break; |
413 case CodecSrc::kIndex8_Always_DstColorType: | 406 case CodecSrc::kIndex8_Always_DstColorType: |
414 folder.append("_kIndex8"); | 407 folder.append("_kIndex8"); |
415 break; | 408 break; |
416 case CodecSrc::kNonNative8888_Always_DstColorType: | 409 case CodecSrc::kNonNative8888_Always_DstColorType: |
417 folder.append("_kNonNative"); | 410 folder.append("_kNonNative"); |
(...skipping 13 matching lines...) Expand all Loading... |
431 folder.append("_unpremul"); | 424 folder.append("_unpremul"); |
432 break; | 425 break; |
433 default: | 426 default: |
434 break; | 427 break; |
435 } | 428 } |
436 | 429 |
437 if (1 != sampleSize) { | 430 if (1 != sampleSize) { |
438 folder.appendf("_%.3f", 1.0f / (float) sampleSize); | 431 folder.appendf("_%.3f", 1.0f / (float) sampleSize); |
439 } | 432 } |
440 | 433 |
441 AndroidCodecSrc* src = new AndroidCodecSrc(path, mode, dstColorType, dstAlph
aType, sampleSize); | 434 AndroidCodecSrc* src = new AndroidCodecSrc(path, dstColorType, dstAlphaType,
sampleSize); |
442 push_src("image", folder, src); | 435 push_src("image", folder, src); |
443 } | 436 } |
444 | 437 |
445 static void push_image_gen_src(Path path, ImageGenSrc::Mode mode, SkAlphaType al
phaType, bool isGpu) | 438 static void push_image_gen_src(Path path, ImageGenSrc::Mode mode, SkAlphaType al
phaType, bool isGpu) |
446 { | 439 { |
447 SkString folder; | 440 SkString folder; |
448 switch (mode) { | 441 switch (mode) { |
449 case ImageGenSrc::kCodec_Mode: | 442 case ImageGenSrc::kCodec_Mode: |
450 folder.append("gen_codec"); | 443 folder.append("gen_codec"); |
451 break; | 444 break; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 push_codec_src(path, mode, colorType, alphaType, scale); | 550 push_codec_src(path, mode, colorType, alphaType, scale); |
558 } | 551 } |
559 } | 552 } |
560 } | 553 } |
561 } | 554 } |
562 | 555 |
563 if (FLAGS_simpleCodec) { | 556 if (FLAGS_simpleCodec) { |
564 return; | 557 return; |
565 } | 558 } |
566 | 559 |
567 // https://bug.skia.org/4428 | |
568 bool subset = false; | |
569 // The following image types are supported by BitmapRegionDecoder, | |
570 // so we will test full image decodes and subset decodes. | |
571 static const char* const exts[] = { | |
572 "jpg", "jpeg", "png", "webp", | |
573 "JPG", "JPEG", "PNG", "WEBP", | |
574 }; | |
575 for (const char* ext : exts) { | |
576 if (path.endsWith(ext)) { | |
577 subset = true; | |
578 break; | |
579 } | |
580 } | |
581 | |
582 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; | 560 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; |
583 | 561 |
584 for (int sampleSize : sampleSizes) { | 562 for (int sampleSize : sampleSizes) { |
585 for (CodecSrc::DstColorType colorType : colorTypes) { | 563 for (CodecSrc::DstColorType colorType : colorTypes) { |
586 for (SkAlphaType alphaType : alphaModes) { | 564 for (SkAlphaType alphaType : alphaModes) { |
587 // We can exercise all of the kNonNative support code in the swi
zzler with just a | 565 // We can exercise all of the kNonNative support code in the swi
zzler with just a |
588 // few sample sizes. Skip the rest. | 566 // few sample sizes. Skip the rest. |
589 if (CodecSrc::kNonNative8888_Always_DstColorType == colorType &&
sampleSize > 3) { | 567 if (CodecSrc::kNonNative8888_Always_DstColorType == colorType &&
sampleSize > 3) { |
590 continue; | 568 continue; |
591 } | 569 } |
592 | 570 |
593 push_android_codec_src(path, AndroidCodecSrc::kFullImage_Mode, c
olorType, | 571 push_android_codec_src(path, colorType, alphaType, sampleSize); |
594 alphaType, sampleSize); | |
595 if (subset) { | |
596 push_android_codec_src(path, AndroidCodecSrc::kDivisor_Mode,
colorType, | |
597 alphaType, sampleSize); | |
598 } | |
599 } | 572 } |
600 } | 573 } |
601 } | 574 } |
602 | 575 |
603 static const char* const rawExts[] = { | 576 static const char* const rawExts[] = { |
604 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", | 577 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", |
605 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", | 578 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", |
606 }; | 579 }; |
607 | 580 |
608 // There is not currently a reason to test RAW images on image generator. | 581 // There is not currently a reason to test RAW images on image generator. |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 #endif | 1423 #endif |
1451 } | 1424 } |
1452 } // namespace skiatest | 1425 } // namespace skiatest |
1453 | 1426 |
1454 #if !defined(SK_BUILD_FOR_IOS) | 1427 #if !defined(SK_BUILD_FOR_IOS) |
1455 int main(int argc, char** argv) { | 1428 int main(int argc, char** argv) { |
1456 SkCommandLineFlags::Parse(argc, argv); | 1429 SkCommandLineFlags::Parse(argc, argv); |
1457 return dm_main(); | 1430 return dm_main(); |
1458 } | 1431 } |
1459 #endif | 1432 #endif |
OLD | NEW |