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

Unified Diff: dm/DM.cpp

Issue 1314163007: Remove unwanted images in Gold (Closed) Base URL: https://skia.googlesource.com/skia.git@dm-fix
Patch Set: Created 5 years, 3 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 2ecba1da7a5d5b086e3a7bd821d9f31e8c146608..8ee0e5a872946cc89d1931e4b80e9ad9a006385a 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -260,33 +260,72 @@ static void push_codec_srcs(Path path) {
return;
}
- // Choose scales for scaling tests.
+ // Native Scales
// TODO (msarett): Implement scaling tests for SkImageDecoder in order to compare with these
// tests. SkImageDecoder supports downscales by integer factors.
// SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875
- // 0.1, 0.16, 0.2 etc allow us to test SkScaledCodec with sampleSize 10, 6, 5, etc
+ const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f, 1.0f };
+
+ // SkScaledCodec Scales
scroggo 2015/09/02 15:54:16 I think it would make more sense to move the SkSca
msarett 2015/09/02 18:16:16 Done.
+ // The native scales are included to make sure that SkScaledCodec defaults to the native
+ // scaling strategy when possible.
+ // 0.1, 0.16, 0.2 etc allow us to test SkScaledCodec with sampleSize 10, 6, 5, etc.
// 0.4, 0.7 etc allow to test what happens when the client requests a scale that
- // does not exactly match a sampleSize or native scaling capability
- const float scales[] = { 0.1f, 0.125f, 0.166f, 0.2f, 0.25f, 0.333f, 0.375f, 0.4f, 0.5f, 0.6f,
- 0.625f, 0.750f, 0.8f, 0.875f, 1.0f };
+ // does not exactly match a sampleSize or native scaling capability.
+ const float samplingScales[] = { 0.1f, 0.125f, 0.166f, 0.2f, 0.25f, 0.333f, 0.375f, 0.4f, 0.5f,
+ 0.6f, 0.625f, 0.750f, 0.8f, 0.875f, 1.0f };
+
+ const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kScanline_Mode,
+ CodecSrc::kScanline_Subset_Mode, CodecSrc::kStripe_Mode, CodecSrc::kSubset_Mode };
+
+ const CodecSrc::Mode samplingModes[] = { CodecSrc::kScaledCodec_Mode };
+
+ CodecSrc::DstColorType colorTypes[3];
+ uint32_t numColorTypes;
+ switch (codec->getInfo().colorType()) {
+ case kGray_8_SkColorType:
+ // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8?
+ // Further discussion on this topic is at skbug.com/3683
+ colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
+ colorTypes[1] = CodecSrc::kGrayscale_Always_DstColorType;
+ colorTypes[2] = CodecSrc::kIndex8_Always_DstColorType;
+ numColorTypes = 3;
+ break;
+ case kIndex_8_SkColorType:
+ colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
+ colorTypes[1] = CodecSrc::kIndex8_Always_DstColorType;
+ numColorTypes = 2;
+ break;
+ default:
+ colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
+ numColorTypes = 1;
+ break;
+ }
- const CodecSrc::Mode modes[] = { CodecSrc::kCodec_Mode, CodecSrc::kScaledCodec_Mode,
- CodecSrc::kScanline_Mode, CodecSrc::kScanline_Subset_Mode, CodecSrc::kStripe_Mode,
- CodecSrc::kSubset_Mode };
+ for (float scale : nativeScales) {
+ if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) {
+ // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uninitialized/
+ // compute their colors based on uninitialized values.
+ continue;
+ }
- const CodecSrc::DstColorType colorTypes[] = { CodecSrc::kGetFromCanvas_DstColorType,
- CodecSrc::kGrayscale_Always_DstColorType, CodecSrc::kIndex8_Always_DstColorType };
+ for (CodecSrc::Mode mode : nativeModes) {
+ for (uint32_t i = 0; i < numColorTypes; i++) {
+ push_codec_src(path, mode, colorTypes[i], scale);
+ }
+ }
+ }
- for (float scale : scales) {
+ for (float scale : samplingScales) {
if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) {
// FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uninitialized/
// compute their colors based on uninitialized values.
continue;
}
- for (CodecSrc::Mode mode : modes) {
- for (CodecSrc::DstColorType colorType : colorTypes) {
- push_codec_src(path, mode, colorType, scale);
+ for (CodecSrc::Mode mode : samplingModes) {
scroggo 2015/09/02 15:54:16 There is only one mode in samplingModes. Would it
msarett 2015/09/02 18:16:16 I think we may want to add a mode when we add subs
+ for (uint32_t i = 0; i < numColorTypes; i++) {
+ push_codec_src(path, mode, colorTypes[i], 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