diff options
author | scroggo <scroggo@chromium.org> | 2016-05-20 11:08:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-20 11:08:27 -0700 |
commit | f2c96a2a6fa22c674083db701d15702636f9d5fc (patch) | |
tree | 3a81bd2048cb558a033f51961db47501afb38c8d /dm | |
parent | e76ca8b9c25672be79b670514a7fe0bceadd35e6 (diff) |
Only decode opaque to premul in DM image
Previously, we would test decoding an opaque SkCodec to all three:
kUnpremul,
kPremul,
kOpaque
The image should look the same in all three cases. We already test for
that in CodecTest [1], where we require that the result matches exactly.
CodecTest runs on a smaller set of images, but it covers a variety of
opaque images. No need to test on all opaque images.
Running locally on my Mac laptop, the following command:
dm --src image --images resources/
dropped from:
5932 srcs
11.2s
to:
3544 srcs
6.69s
for a 40% speedup.
BUG=skia:5307
[1] https://skia.googlesource.com/skia/+/master/tests/CodecTest.cpp#119
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1999593003
Review-Url: https://codereview.chromium.org/1999593003
Diffstat (limited to 'dm')
-rw-r--r-- | dm/DM.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -373,9 +373,6 @@ static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorTyp } switch (dstAlphaType) { - case kOpaque_SkAlphaType: - folder.append("_opaque"); - break; case kPremul_SkAlphaType: folder.append("_premul"); break; @@ -414,9 +411,6 @@ static void push_android_codec_src(Path path, CodecSrc::DstColorType dstColorTyp } switch (dstAlphaType) { - case kOpaque_SkAlphaType: - folder.append("_opaque"); - break; case kPremul_SkAlphaType: folder.append("_premul"); break; @@ -524,18 +518,17 @@ static void push_codec_srcs(Path path) { SkTArray<SkAlphaType> alphaModes; alphaModes.push_back(kPremul_SkAlphaType); - alphaModes.push_back(kUnpremul_SkAlphaType); - if (codec->getInfo().alphaType() == kOpaque_SkAlphaType) { - alphaModes.push_back(kOpaque_SkAlphaType); + if (codec->getInfo().alphaType() != kOpaque_SkAlphaType) { + alphaModes.push_back(kUnpremul_SkAlphaType); } for (CodecSrc::Mode mode : nativeModes) { for (CodecSrc::DstColorType colorType : colorTypes) { for (SkAlphaType alphaType : alphaModes) { - // Only test kCroppedScanline_Mode when the alpha type is opaque. The test is + // Only test kCroppedScanline_Mode when the alpha type is premul. The test is // slow and won't be interestingly different with different alpha types. if (CodecSrc::kCroppedScanline_Mode == mode && - kOpaque_SkAlphaType != alphaType) { + kPremul_SkAlphaType != alphaType) { continue; } |