Index: src/images/SkDecodingImageGenerator.cpp |
diff --git a/src/images/SkDecodingImageGenerator.cpp b/src/images/SkDecodingImageGenerator.cpp |
index 016362f43c24b741def05a605bb1fe18f765bf0c..5b842abf5f671da0c9d68dd1bdfec68cbf6f08c7 100644 |
--- a/src/images/SkDecodingImageGenerator.cpp |
+++ b/src/images/SkDecodingImageGenerator.cpp |
@@ -175,6 +175,8 @@ bool DecodingImageGenerator::getPixels(const SkImageInfo& info, |
} |
decoder->setDitherImage(fDitherImage); |
decoder->setSampleSize(fSampleSize); |
+ decoder->setRequireUnpremultipliedColors( |
+ info.fAlphaType == kUnpremul_SkAlphaType); |
SkBitmap bitmap; |
TargetAllocator allocator(fInfo, pixels, rowBytes); |
@@ -224,6 +226,7 @@ SkImageGenerator* CreateDecodingImageGenerator( |
} |
SkBitmap bitmap; |
decoder->setSampleSize(opts.fSampleSize); |
+ decoder->setRequireUnpremultipliedColors(opts.fRequireUnpremul); |
if (!decoder->decode(stream, &bitmap, |
SkImageDecoder::kDecodeBounds_Mode)) { |
return NULL; |
@@ -248,6 +251,10 @@ SkImageGenerator* CreateDecodingImageGenerator( |
} |
info.fColorType = opts.fRequestedColorType; |
} |
+ |
+ if (opts.fRequireUnpremul && info.fAlphaType != kOpaque_SkAlphaType) { |
+ info.fAlphaType = kUnpremul_SkAlphaType; |
+ } |
return SkNEW_ARGS(DecodingImageGenerator, |
(data, autoStream.detach(), info, |
opts.fSampleSize, opts.fDitherImage)); |