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

Side by Side Diff: dm/DM.cpp

Issue 1999593003: Only decode opaque to premul in DM image (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Don't decode opaque to unpremul, either 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 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 folder.append("_kIndex8"); 366 folder.append("_kIndex8");
367 break; 367 break;
368 case CodecSrc::kNonNative8888_Always_DstColorType: 368 case CodecSrc::kNonNative8888_Always_DstColorType:
369 folder.append("_kNonNative"); 369 folder.append("_kNonNative");
370 break; 370 break;
371 default: 371 default:
372 break; 372 break;
373 } 373 }
374 374
375 switch (dstAlphaType) { 375 switch (dstAlphaType) {
376 case kOpaque_SkAlphaType:
377 folder.append("_opaque");
378 break;
379 case kPremul_SkAlphaType: 376 case kPremul_SkAlphaType:
380 folder.append("_premul"); 377 folder.append("_premul");
381 break; 378 break;
382 case kUnpremul_SkAlphaType: 379 case kUnpremul_SkAlphaType:
383 folder.append("_unpremul"); 380 folder.append("_unpremul");
384 break; 381 break;
385 default: 382 default:
386 break; 383 break;
387 } 384 }
388 385
(...skipping 18 matching lines...) Expand all
407 folder.append("_kIndex8"); 404 folder.append("_kIndex8");
408 break; 405 break;
409 case CodecSrc::kNonNative8888_Always_DstColorType: 406 case CodecSrc::kNonNative8888_Always_DstColorType:
410 folder.append("_kNonNative"); 407 folder.append("_kNonNative");
411 break; 408 break;
412 default: 409 default:
413 break; 410 break;
414 } 411 }
415 412
416 switch (dstAlphaType) { 413 switch (dstAlphaType) {
417 case kOpaque_SkAlphaType:
418 folder.append("_opaque");
419 break;
420 case kPremul_SkAlphaType: 414 case kPremul_SkAlphaType:
421 folder.append("_premul"); 415 folder.append("_premul");
422 break; 416 break;
423 case kUnpremul_SkAlphaType: 417 case kUnpremul_SkAlphaType:
424 folder.append("_unpremul"); 418 folder.append("_unpremul");
425 break; 419 break;
426 default: 420 default:
427 break; 421 break;
428 } 422 }
429 423
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 break; 511 break;
518 case kIndex_8_SkColorType: 512 case kIndex_8_SkColorType:
519 colorTypes.push_back(CodecSrc::kIndex8_Always_DstColorType); 513 colorTypes.push_back(CodecSrc::kIndex8_Always_DstColorType);
520 break; 514 break;
521 default: 515 default:
522 break; 516 break;
523 } 517 }
524 518
525 SkTArray<SkAlphaType> alphaModes; 519 SkTArray<SkAlphaType> alphaModes;
526 alphaModes.push_back(kPremul_SkAlphaType); 520 alphaModes.push_back(kPremul_SkAlphaType);
527 alphaModes.push_back(kUnpremul_SkAlphaType); 521 if (codec->getInfo().alphaType() != kOpaque_SkAlphaType) {
528 if (codec->getInfo().alphaType() == kOpaque_SkAlphaType) { 522 alphaModes.push_back(kUnpremul_SkAlphaType);
529 alphaModes.push_back(kOpaque_SkAlphaType);
530 } 523 }
531 524
532 for (CodecSrc::Mode mode : nativeModes) { 525 for (CodecSrc::Mode mode : nativeModes) {
533 for (CodecSrc::DstColorType colorType : colorTypes) { 526 for (CodecSrc::DstColorType colorType : colorTypes) {
534 for (SkAlphaType alphaType : alphaModes) { 527 for (SkAlphaType alphaType : alphaModes) {
535 // Only test kCroppedScanline_Mode when the alpha type is opaque . The test is 528 // Only test kCroppedScanline_Mode when the alpha type is premul . The test is
536 // slow and won't be interestingly different with different alph a types. 529 // slow and won't be interestingly different with different alph a types.
537 if (CodecSrc::kCroppedScanline_Mode == mode && 530 if (CodecSrc::kCroppedScanline_Mode == mode &&
538 kOpaque_SkAlphaType != alphaType) { 531 kPremul_SkAlphaType != alphaType) {
539 continue; 532 continue;
540 } 533 }
541 534
542 push_codec_src(path, mode, colorType, alphaType, 1.0f); 535 push_codec_src(path, mode, colorType, alphaType, 1.0f);
543 536
544 // Skip kNonNative on different native scales. It won't be inte restingly 537 // Skip kNonNative on different native scales. It won't be inte restingly
545 // different. 538 // different.
546 if (supportsNativeScaling && 539 if (supportsNativeScaling &&
547 CodecSrc::kNonNative8888_Always_DstColorType == colorTyp e) { 540 CodecSrc::kNonNative8888_Always_DstColorType == colorTyp e) {
548 // Native Scales 541 // Native Scales
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 #endif 1373 #endif
1381 } 1374 }
1382 } // namespace skiatest 1375 } // namespace skiatest
1383 1376
1384 #if !defined(SK_BUILD_FOR_IOS) 1377 #if !defined(SK_BUILD_FOR_IOS)
1385 int main(int argc, char** argv) { 1378 int main(int argc, char** argv) {
1386 SkCommandLineFlags::Parse(argc, argv); 1379 SkCommandLineFlags::Parse(argc, argv);
1387 return dm_main(); 1380 return dm_main();
1388 } 1381 }
1389 #endif 1382 #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