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

Unified Diff: src/codec/SkMaskSwizzler.cpp

Issue 1663303002: Fix bugs in SkBmpCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « src/codec/SkBmpStandardCodec.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkMaskSwizzler.cpp
diff --git a/src/codec/SkMaskSwizzler.cpp b/src/codec/SkMaskSwizzler.cpp
index 1b77a85b139c591736e9edd5e6f152b11d6e232f..7630a7b59f063b403cee46295ee1d59380a88456 100644
--- a/src/codec/SkMaskSwizzler.cpp
+++ b/src/codec/SkMaskSwizzler.cpp
@@ -235,18 +235,19 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(const SkImageInfo& dstInfo,
case 16:
switch (dstInfo.colorType()) {
case kN32_SkColorType:
- switch (dstInfo.alphaType()) {
- case kUnpremul_SkAlphaType:
- proc = &swizzle_mask16_to_n32_unpremul;
- break;
- case kPremul_SkAlphaType:
- proc = &swizzle_mask16_to_n32_premul;
- break;
- case kOpaque_SkAlphaType:
- proc = &swizzle_mask16_to_n32_opaque;
- break;
- default:
- break;
+ if (kOpaque_SkAlphaType == srcInfo.alphaType()) {
+ proc = &swizzle_mask16_to_n32_opaque;
+ } else {
+ switch (dstInfo.alphaType()) {
+ case kUnpremul_SkAlphaType:
+ proc = &swizzle_mask16_to_n32_unpremul;
+ break;
+ case kPremul_SkAlphaType:
+ proc = &swizzle_mask16_to_n32_premul;
+ break;
+ default:
+ break;
+ }
}
break;
case kRGB_565_SkColorType:
@@ -259,18 +260,19 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(const SkImageInfo& dstInfo,
case 24:
switch (dstInfo.colorType()) {
case kN32_SkColorType:
- switch (dstInfo.alphaType()) {
- case kUnpremul_SkAlphaType:
- proc = &swizzle_mask24_to_n32_unpremul;
- break;
- case kPremul_SkAlphaType:
- proc = &swizzle_mask24_to_n32_premul;
- break;
- case kOpaque_SkAlphaType:
- proc = &swizzle_mask24_to_n32_opaque;
- break;
- default:
- break;
+ if (kOpaque_SkAlphaType == srcInfo.alphaType()) {
+ proc = &swizzle_mask24_to_n32_opaque;
+ } else {
+ switch (dstInfo.alphaType()) {
+ case kUnpremul_SkAlphaType:
+ proc = &swizzle_mask24_to_n32_unpremul;
+ break;
+ case kPremul_SkAlphaType:
+ proc = &swizzle_mask24_to_n32_premul;
+ break;
+ default:
+ break;
+ }
}
break;
case kRGB_565_SkColorType:
@@ -283,18 +285,19 @@ SkMaskSwizzler* SkMaskSwizzler::CreateMaskSwizzler(const SkImageInfo& dstInfo,
case 32:
switch (dstInfo.colorType()) {
case kN32_SkColorType:
- switch (dstInfo.alphaType()) {
- case kUnpremul_SkAlphaType:
- proc = &swizzle_mask32_to_n32_unpremul;
- break;
- case kPremul_SkAlphaType:
- proc = &swizzle_mask32_to_n32_premul;
- break;
- case kOpaque_SkAlphaType:
- proc = &swizzle_mask32_to_n32_opaque;
- break;
- default:
- break;
+ if (kOpaque_SkAlphaType == srcInfo.alphaType()) {
+ proc = &swizzle_mask32_to_n32_opaque;
+ } else {
+ switch (dstInfo.alphaType()) {
+ case kUnpremul_SkAlphaType:
+ proc = &swizzle_mask32_to_n32_unpremul;
+ break;
+ case kPremul_SkAlphaType:
+ proc = &swizzle_mask32_to_n32_premul;
+ break;
+ default:
+ break;
+ }
}
break;
case kRGB_565_SkColorType:
« no previous file with comments | « src/codec/SkBmpStandardCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698