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

Side by Side Diff: dm/DM.cpp

Issue 1321433002: Add subsetting to SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-scan
Patch Set: Created 5 years, 2 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
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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 return false; 349 return false;
350 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: 350 case SkBitmapRegionDecoderInterface::kOriginal_Strategy:
351 switch (dstColorType) { 351 switch (dstColorType) {
352 case CodecSrc::kGetFromCanvas_DstColorType: 352 case CodecSrc::kGetFromCanvas_DstColorType:
353 case CodecSrc::kIndex8_Always_DstColorType: 353 case CodecSrc::kIndex8_Always_DstColorType:
354 case CodecSrc::kGrayscale_Always_DstColorType: 354 case CodecSrc::kGrayscale_Always_DstColorType:
355 return true; 355 return true;
356 default: 356 default:
357 return false; 357 return false;
358 } 358 }
359 case SkBitmapRegionDecoderInterface::kCodec_Strategy:
360 switch (dstColorType) {
361 case CodecSrc::kGetFromCanvas_DstColorType:
362 case CodecSrc::kIndex8_Always_DstColorType:
363 case CodecSrc::kGrayscale_Always_DstColorType:
364 return true;
365 default:
366 return false;
367 }
359 default: 368 default:
360 SkASSERT(false); 369 SkASSERT(false);
361 return false; 370 return false;
362 } 371 }
363 } 372 }
364 373
365 static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy str ategy, 374 static void push_brd_src(Path path, SkBitmapRegionDecoderInterface::Strategy str ategy,
366 CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleS ize) { 375 CodecSrc::DstColorType dstColorType, BRDSrc::Mode mode, uint32_t sampleS ize) {
367 SkString folder; 376 SkString folder;
368 switch (strategy) { 377 switch (strategy) {
369 case SkBitmapRegionDecoderInterface::kCanvas_Strategy: 378 case SkBitmapRegionDecoderInterface::kCanvas_Strategy:
370 folder.append("brd_canvas"); 379 folder.append("brd_canvas");
371 break; 380 break;
372 case SkBitmapRegionDecoderInterface::kOriginal_Strategy: 381 case SkBitmapRegionDecoderInterface::kOriginal_Strategy:
373 folder.append("brd_sample"); 382 folder.append("brd_sample");
374 break; 383 break;
384 case SkBitmapRegionDecoderInterface::kCodec_Strategy:
385 folder.append("brd_codec");
386 break;
375 default: 387 default:
376 SkASSERT(false); 388 SkASSERT(false);
377 return; 389 return;
378 } 390 }
379 391
380 switch (mode) { 392 switch (mode) {
381 case BRDSrc::kFullImage_Mode: 393 case BRDSrc::kFullImage_Mode:
382 break; 394 break;
383 case BRDSrc::kDivisor_Mode: 395 case BRDSrc::kDivisor_Mode:
384 folder.append("_divisor"); 396 folder.append("_divisor");
(...skipping 22 matching lines...) Expand all
407 } 419 }
408 420
409 BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize); 421 BRDSrc* src = new BRDSrc(path, strategy, mode, dstColorType, sampleSize);
410 push_src("image", folder, src); 422 push_src("image", folder, src);
411 } 423 }
412 424
413 static void push_brd_srcs(Path path) { 425 static void push_brd_srcs(Path path) {
414 426
415 const SkBitmapRegionDecoderInterface::Strategy strategies[] = { 427 const SkBitmapRegionDecoderInterface::Strategy strategies[] = {
416 SkBitmapRegionDecoderInterface::kCanvas_Strategy, 428 SkBitmapRegionDecoderInterface::kCanvas_Strategy,
417 SkBitmapRegionDecoderInterface::kOriginal_Strategy 429 SkBitmapRegionDecoderInterface::kOriginal_Strategy,
430 SkBitmapRegionDecoderInterface::kCodec_Strategy,
418 }; 431 };
419 432
420 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; 433 const uint32_t sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
421 434
422 // We will only test to one backend (8888), but we will test all of the 435 // We will only test to one backend (8888), but we will test all of the
423 // color types that we need to decode to on this backend. 436 // color types that we need to decode to on this backend.
424 const CodecSrc::DstColorType dstColorTypes[] = { 437 const CodecSrc::DstColorType dstColorTypes[] = {
425 CodecSrc::kGetFromCanvas_DstColorType, 438 CodecSrc::kGetFromCanvas_DstColorType,
426 CodecSrc::kIndex8_Always_DstColorType, 439 CodecSrc::kIndex8_Always_DstColorType,
427 CodecSrc::kGrayscale_Always_DstColorType, 440 CodecSrc::kGrayscale_Always_DstColorType,
428 }; 441 };
429 442
430 const BRDSrc::Mode modes[] = { 443 const BRDSrc::Mode modes[] = {
431 BRDSrc::kFullImage_Mode, 444 BRDSrc::kFullImage_Mode,
432 BRDSrc::kDivisor_Mode 445 BRDSrc::kDivisor_Mode
433 }; 446 };
434 447
435 for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) { 448 for (SkBitmapRegionDecoderInterface::Strategy strategy : strategies) {
436 449
437 // We disable png testing for kOriginal_Strategy because the implementat ion leaks 450 // We disable png testing for kOriginal_Strategy because the implementat ion leaks
438 // memory in our forked libpng. 451 // memory in our forked libpng.
439 // TODO (msarett): Decide if we want to test pngs in this mode and how w e might do this. 452 // TODO (msarett): Decide if we want to test pngs in this mode and how w e might do this.
440 if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy && 453 if (SkBitmapRegionDecoderInterface::kOriginal_Strategy == strategy &&
441 (path.endsWith(".png") || path.endsWith(".PNG"))) { 454 (path.endsWith(".png") || path.endsWith(".PNG"))) {
442 continue; 455 continue;
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 } 1120 }
1108 return 0; 1121 return 0;
1109 } 1122 }
1110 1123
1111 #if !defined(SK_BUILD_FOR_IOS) 1124 #if !defined(SK_BUILD_FOR_IOS)
1112 int main(int argc, char** argv) { 1125 int main(int argc, char** argv) {
1113 SkCommandLineFlags::Parse(argc, argv); 1126 SkCommandLineFlags::Parse(argc, argv);
1114 return dm_main(); 1127 return dm_main();
1115 } 1128 }
1116 #endif 1129 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | dm/DMSrcSink.cpp » ('j') | include/codec/SkCodec.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698