Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index 028dff886b444d5b54736794cd357f16b759b5ab..33848975e98e1461bb4e3e9fc7f2d58476bbc8a6 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -314,7 +314,7 @@ static void premultiply_if_necessary(SkBitmap& bitmap) { |
} |
static bool get_decode_info(SkImageInfo* decodeInfo, SkColorType canvasColorType, |
- CodecSrc::DstColorType dstColorType) { |
+ CodecSrc::DstColorType dstColorType, SkAlphaType dstAlphaType) { |
switch (dstColorType) { |
case CodecSrc::kIndex8_Always_DstColorType: |
if (kRGB_565_SkColorType == canvasColorType) { |
@@ -348,6 +348,7 @@ static bool get_decode_info(SkImageInfo* decodeInfo, SkColorType canvasColorType |
break; |
} |
+ *decodeInfo = decodeInfo->makeAlphaType(dstAlphaType); |
return true; |
} |
@@ -373,8 +374,9 @@ Error CodecSrc::draw(SkCanvas* canvas) const { |
return SkStringPrintf("Couldn't create codec for %s.", fPath.c_str()); |
} |
- SkImageInfo decodeInfo = codec->getInfo().makeAlphaType(fDstAlphaType); |
- if (!get_decode_info(&decodeInfo, canvas->imageInfo().colorType(), fDstColorType)) { |
+ SkImageInfo decodeInfo = codec->getInfo(); |
+ if (!get_decode_info(&decodeInfo, canvas->imageInfo().colorType(), fDstColorType, |
+ fDstAlphaType)) { |
return Error::Nonfatal("Testing non-565 to 565 is uninteresting."); |
} |
@@ -656,8 +658,9 @@ Error AndroidCodecSrc::draw(SkCanvas* canvas) const { |
return SkStringPrintf("Couldn't create android codec for %s.", fPath.c_str()); |
} |
- SkImageInfo decodeInfo = codec->getInfo().makeAlphaType(fDstAlphaType); |
- if (!get_decode_info(&decodeInfo, canvas->imageInfo().colorType(), fDstColorType)) { |
+ SkImageInfo decodeInfo = codec->getInfo(); |
+ if (!get_decode_info(&decodeInfo, canvas->imageInfo().colorType(), fDstColorType, |
+ fDstAlphaType)) { |
return Error::Nonfatal("Testing non-565 to 565 is uninteresting."); |
} |
@@ -793,11 +796,6 @@ Error ImageGenSrc::draw(SkCanvas* canvas) const { |
// Test various color and alpha types on CPU |
SkImageInfo decodeInfo = gen->getInfo().makeAlphaType(fDstAlphaType); |
- if (kGray_8_SkColorType == decodeInfo.colorType() && |
- kOpaque_SkAlphaType != decodeInfo.alphaType()) { |
- return Error::Nonfatal("Avoid requesting non-opaque kGray8 decodes."); |
- } |
- |
int bpp = SkColorTypeBytesPerPixel(decodeInfo.colorType()); |
size_t rowBytes = decodeInfo.width() * bpp; |
SkAutoMalloc pixels(decodeInfo.height() * rowBytes); |