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

Side by Side Diff: dm/DM.cpp

Issue 1314163007: Remove unwanted images in Gold (Closed) Base URL: https://skia.googlesource.com/skia.git@dm-fix
Patch Set: Fix name of codec_subset test 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 case CodecSrc::kScanline_Mode: 218 case CodecSrc::kScanline_Mode:
219 folder.append("scanline"); 219 folder.append("scanline");
220 break; 220 break;
221 case CodecSrc::kScanline_Subset_Mode: 221 case CodecSrc::kScanline_Subset_Mode:
222 folder.append("scanline_subset"); 222 folder.append("scanline_subset");
223 break; 223 break;
224 case CodecSrc::kStripe_Mode: 224 case CodecSrc::kStripe_Mode:
225 folder.append("stripe"); 225 folder.append("stripe");
226 break; 226 break;
227 case CodecSrc::kSubset_Mode: 227 case CodecSrc::kSubset_Mode:
228 folder.append("subset"); 228 folder.append("codec_subset");
229 break; 229 break;
230 } 230 }
231 231
232 switch (dstColorType) { 232 switch (dstColorType) {
233 case CodecSrc::kGrayscale_Always_DstColorType: 233 case CodecSrc::kGrayscale_Always_DstColorType:
234 folder.append("_kGray8"); 234 folder.append("_kGray8");
235 break; 235 break;
236 case CodecSrc::kIndex8_Always_DstColorType: 236 case CodecSrc::kIndex8_Always_DstColorType:
237 folder.append("_kIndex8"); 237 folder.append("_kIndex8");
238 break; 238 break;
(...skipping 14 matching lines...) Expand all
253 if (!encoded) { 253 if (!encoded) {
254 SkDebugf("Couldn't read %s.", path.c_str()); 254 SkDebugf("Couldn't read %s.", path.c_str());
255 return; 255 return;
256 } 256 }
257 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); 257 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
258 if (nullptr == codec.get()) { 258 if (nullptr == codec.get()) {
259 SkDebugf("Couldn't create codec for %s.", path.c_str()); 259 SkDebugf("Couldn't create codec for %s.", path.c_str());
260 return; 260 return;
261 } 261 }
262 262
263 // Choose scales for scaling tests. 263 // Native Scales
264 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co mpare with these 264 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co mpare with these
265 // tests. SkImageDecoder supports downscales by integer fac tors. 265 // tests. SkImageDecoder supports downscales by integer fac tors.
266 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875 266 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875
267 // 0.1, 0.16, 0.2 etc allow us to test SkScaledCodec with sampleSize 10, 6, 5, etc 267 const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f, 0.875f, 1.0f };
268 // 0.4, 0.7 etc allow to test what happens when the client requests a scale that
269 // does not exactly match a sampleSize or native scaling capability
270 const float scales[] = { 0.1f, 0.125f, 0.166f, 0.2f, 0.25f, 0.333f, 0.375f, 0.4f, 0.5f, 0.6f,
271 0.625f, 0.750f, 0.8f, 0.875f, 1.0f };
272 268
273 const CodecSrc::Mode modes[] = { CodecSrc::kCodec_Mode, CodecSrc::kScaledCod ec_Mode, 269 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kSca nline_Mode,
274 CodecSrc::kScanline_Mode, CodecSrc::kScanline_Subset_Mode, CodecSrc: :kStripe_Mode, 270 CodecSrc::kScanline_Subset_Mode, CodecSrc::kStripe_Mode, CodecSrc::k Subset_Mode };
275 CodecSrc::kSubset_Mode };
276 271
277 const CodecSrc::DstColorType colorTypes[] = { CodecSrc::kGetFromCanvas_DstCo lorType, 272 CodecSrc::DstColorType colorTypes[3];
278 CodecSrc::kGrayscale_Always_DstColorType, CodecSrc::kIndex8_Always_D stColorType }; 273 uint32_t numColorTypes;
274 switch (codec->getInfo().colorType()) {
275 case kGray_8_SkColorType:
276 // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8?
277 // Further discussion on this topic is at skbug.com/3683
278 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
279 colorTypes[1] = CodecSrc::kGrayscale_Always_DstColorType;
280 colorTypes[2] = CodecSrc::kIndex8_Always_DstColorType;
281 numColorTypes = 3;
282 break;
283 case kIndex_8_SkColorType:
284 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
285 colorTypes[1] = CodecSrc::kIndex8_Always_DstColorType;
286 numColorTypes = 2;
287 break;
288 default:
289 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
290 numColorTypes = 1;
291 break;
292 }
279 293
280 for (float scale : scales) { 294 for (float scale : nativeScales) {
281 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) { 295 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) {
282 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni nitialized/ 296 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni nitialized/
283 // compute their colors based on uninitialized values. 297 // compute their colors based on uninitialized values.
284 continue; 298 continue;
285 } 299 }
286 300
287 for (CodecSrc::Mode mode : modes) { 301 for (CodecSrc::Mode mode : nativeModes) {
288 for (CodecSrc::DstColorType colorType : colorTypes) { 302 for (uint32_t i = 0; i < numColorTypes; i++) {
289 push_codec_src(path, mode, colorType, scale); 303 push_codec_src(path, mode, colorTypes[i], scale);
290 } 304 }
291 } 305 }
292 } 306 }
307
308 // SkScaledCodec Scales
309 // The native scales are included to make sure that SkScaledCodec defaults t o the native
310 // scaling strategy when possible.
311 // 0.1, 0.16, 0.2 etc allow us to test SkScaledCodec with sampleSize 10, 6, 5, etc.
312 // 0.4, 0.7 etc allow to test what happens when the client requests a scale that
313 // does not exactly match a sampleSize or native scaling capability.
314 const float samplingScales[] = { 0.1f, 0.125f, 0.166f, 0.2f, 0.25f, 0.333f, 0.375f, 0.4f, 0.5f,
315 0.6f, 0.625f, 0.750f, 0.8f, 0.875f, 1.0f };
316
317 for (float scale : samplingScales) {
318 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) {
319 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni nitialized/
320 // compute their colors based on uninitialized values.
321 continue;
322 }
323
324 for (uint32_t i = 0; i < numColorTypes; i++) {
325 push_codec_src(path, CodecSrc::kScaledCodec_Mode, colorTypes[i], sca le);
326 }
327 }
293 } 328 }
294 329
295 static bool codec_supported(const char* ext) { 330 static bool codec_supported(const char* ext) {
296 // FIXME: Once other versions of SkCodec are available, we can add them to t his 331 // FIXME: Once other versions of SkCodec are available, we can add them to t his
297 // list (and eventually we can remove this check once they are all supported ). 332 // list (and eventually we can remove this check once they are all supported ).
298 static const char* const exts[] = { 333 static const char* const exts[] = {
299 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp", 334 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp",
300 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP", 335 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP",
301 }; 336 };
302 337
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 } 959 }
925 return 0; 960 return 0;
926 } 961 }
927 962
928 #if !defined(SK_BUILD_FOR_IOS) 963 #if !defined(SK_BUILD_FOR_IOS)
929 int main(int argc, char** argv) { 964 int main(int argc, char** argv) {
930 SkCommandLineFlags::Parse(argc, argv); 965 SkCommandLineFlags::Parse(argc, argv);
931 return dm_main(); 966 return dm_main();
932 } 967 }
933 #endif 968 #endif
OLDNEW
« 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