Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1413)

Unified Diff: dm/DM.cpp

Issue 1999103002: Stop creating CodecSrcs with unused scale (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix line length Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DM.cpp
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 8685ec55670a669ddf545ab7bb5b3bca41ce7101..0cc27bdf04e86a1d065b15957524227eb5bdb87d 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -481,9 +481,8 @@ static void push_codec_srcs(Path path) {
return;
}
- // Native Scales
- // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875
- const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f, 1.0f };
+ // native scaling is only supported by WEBP and JPEG
+ bool supportsNativeScaling = false;
SkTArray<CodecSrc::Mode> nativeModes;
nativeModes.push_back(CodecSrc::kCodec_Mode);
@@ -493,9 +492,11 @@ static void push_codec_srcs(Path path) {
nativeModes.push_back(CodecSrc::kScanline_Mode);
nativeModes.push_back(CodecSrc::kStripe_Mode);
nativeModes.push_back(CodecSrc::kCroppedScanline_Mode);
+ supportsNativeScaling = true;
break;
case SkEncodedFormat::kWEBP_SkEncodedFormat:
nativeModes.push_back(CodecSrc::kSubset_Mode);
+ supportsNativeScaling = true;
break;
case SkEncodedFormat::kDNG_SkEncodedFormat:
break;
@@ -529,24 +530,26 @@ static void push_codec_srcs(Path path) {
}
for (CodecSrc::Mode mode : nativeModes) {
- for (float scale : nativeScales) {
- for (CodecSrc::DstColorType colorType : colorTypes) {
- for (SkAlphaType alphaType : alphaModes) {
- // Only test kCroppedScanline_Mode when the alpha type is opaque. The test is
- // slow and won't be interestingly different with different alpha types.
- if (CodecSrc::kCroppedScanline_Mode == mode &&
- kOpaque_SkAlphaType != alphaType) {
- continue;
- }
+ for (CodecSrc::DstColorType colorType : colorTypes) {
+ for (SkAlphaType alphaType : alphaModes) {
+ // Only test kCroppedScanline_Mode when the alpha type is opaque. The test is
+ // slow and won't be interestingly different with different alpha types.
+ if (CodecSrc::kCroppedScanline_Mode == mode &&
+ kOpaque_SkAlphaType != alphaType) {
+ continue;
+ }
- // Skip kNonNative on different native scales. It won't be interestingly
- // different.
- if (CodecSrc::kNonNative8888_Always_DstColorType == colorType && 1.0f != scale)
- {
- continue;
- }
+ push_codec_src(path, mode, colorType, alphaType, 1.0f);
- push_codec_src(path, mode, colorType, alphaType, scale);
+ // Skip kNonNative on different native scales. It won't be interestingly
+ // different.
+ if (supportsNativeScaling &&
+ CodecSrc::kNonNative8888_Always_DstColorType == colorType) {
+ // Native Scales
+ // SkJpegCodec natively supports scaling to the following:
+ for (auto scale : { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f }) {
+ push_codec_src(path, mode, colorType, alphaType, scale);
+ }
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698