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

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: 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
269 // 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.
270 // The native scales are included to make sure that SkScaledCodec defaults t o the native
271 // scaling strategy when possible.
272 // 0.1, 0.16, 0.2 etc allow us to test SkScaledCodec with sampleSize 10, 6, 5, etc.
268 // 0.4, 0.7 etc allow to test what happens when the client requests a scale that 273 // 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 274 // 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, 275 const float samplingScales[] = { 0.1f, 0.125f, 0.166f, 0.2f, 0.25f, 0.333f, 0.375f, 0.4f, 0.5f,
271 0.625f, 0.750f, 0.8f, 0.875f, 1.0f }; 276 0.6f, 0.625f, 0.750f, 0.8f, 0.875f, 1.0f };
272 277
273 const CodecSrc::Mode modes[] = { CodecSrc::kCodec_Mode, CodecSrc::kScaledCod ec_Mode, 278 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kSca nline_Mode,
274 CodecSrc::kScanline_Mode, CodecSrc::kScanline_Subset_Mode, CodecSrc: :kStripe_Mode, 279 CodecSrc::kScanline_Subset_Mode, CodecSrc::kStripe_Mode, CodecSrc::k Subset_Mode };
275 CodecSrc::kSubset_Mode };
276 280
277 const CodecSrc::DstColorType colorTypes[] = { CodecSrc::kGetFromCanvas_DstCo lorType, 281 const CodecSrc::Mode samplingModes[] = { CodecSrc::kScaledCodec_Mode };
278 CodecSrc::kGrayscale_Always_DstColorType, CodecSrc::kIndex8_Always_D stColorType };
279 282
280 for (float scale : scales) { 283 CodecSrc::DstColorType colorTypes[3];
284 uint32_t numColorTypes;
285 switch (codec->getInfo().colorType()) {
286 case kGray_8_SkColorType:
287 // FIXME: Is this a long term solution for testing wbmps decodes to kIndex8?
288 // Further discussion on this topic is at skbug.com/3683
289 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
290 colorTypes[1] = CodecSrc::kGrayscale_Always_DstColorType;
291 colorTypes[2] = CodecSrc::kIndex8_Always_DstColorType;
292 numColorTypes = 3;
293 break;
294 case kIndex_8_SkColorType:
295 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
296 colorTypes[1] = CodecSrc::kIndex8_Always_DstColorType;
297 numColorTypes = 2;
298 break;
299 default:
300 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType;
301 numColorTypes = 1;
302 break;
303 }
304
305 for (float scale : nativeScales) {
281 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) { 306 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) {
282 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni nitialized/ 307 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni nitialized/
283 // compute their colors based on uninitialized values. 308 // compute their colors based on uninitialized values.
284 continue; 309 continue;
285 } 310 }
286 311
287 for (CodecSrc::Mode mode : modes) { 312 for (CodecSrc::Mode mode : nativeModes) {
288 for (CodecSrc::DstColorType colorType : colorTypes) { 313 for (uint32_t i = 0; i < numColorTypes; i++) {
289 push_codec_src(path, mode, colorType, scale); 314 push_codec_src(path, mode, colorTypes[i], scale);
290 } 315 }
291 } 316 }
292 } 317 }
318
319 for (float scale : samplingScales) {
320 if (scale != 1.0f && (path.endsWith(".webp") || path.endsWith(".WEBP"))) {
321 // FIXME: skbug.com/4038 Scaling webp seems to leave some pixels uni nitialized/
322 // compute their colors based on uninitialized values.
323 continue;
324 }
325
326 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
327 for (uint32_t i = 0; i < numColorTypes; i++) {
328 push_codec_src(path, mode, colorTypes[i], scale);
329 }
330 }
331 }
293 } 332 }
294 333
295 static bool codec_supported(const char* ext) { 334 static bool codec_supported(const char* ext) {
296 // FIXME: Once other versions of SkCodec are available, we can add them to t his 335 // 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 ). 336 // list (and eventually we can remove this check once they are all supported ).
298 static const char* const exts[] = { 337 static const char* const exts[] = {
299 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp", 338 "bmp", "gif", "jpg", "jpeg", "png", "ico", "wbmp", "webp",
300 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP", 339 "BMP", "GIF", "JPG", "JPEG", "PNG", "ICO", "WBMP", "WEBP",
301 }; 340 };
302 341
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 } 963 }
925 return 0; 964 return 0;
926 } 965 }
927 966
928 #if !defined(SK_BUILD_FOR_IOS) 967 #if !defined(SK_BUILD_FOR_IOS)
929 int main(int argc, char** argv) { 968 int main(int argc, char** argv) {
930 SkCommandLineFlags::Parse(argc, argv); 969 SkCommandLineFlags::Parse(argc, argv);
931 return dm_main(); 970 return dm_main();
932 } 971 }
933 #endif 972 #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