Convert animated unpremul images to premul during decode (flutter/engine#8698)

Skia allows drawing unpremul images, but filtering them can look bad.
Internally Skia performs this transformation when creating SkImages from
encoded data (so this already happens for MakeCrossContextFromEncoded),
and for consistency/quality it should be done here, too.

Fixes #28785
This commit is contained in:
Brian Osman
2019-04-23 13:47:23 -04:00
committed by GitHub
parent aef2cf9b84
commit 80ef739d5b

View File

@@ -401,7 +401,10 @@ sk_sp<SkImage> MultiFrameCodec::GetNextFrameImage(
: SkBitmap();
const bool frameAlreadyCached = bitmap.getPixels();
if (!frameAlreadyCached) {
const SkImageInfo info = codec_->getInfo().makeColorType(kN32_SkColorType);
SkImageInfo info = codec_->getInfo().makeColorType(kN32_SkColorType);
if (info.alphaType() == kUnpremul_SkAlphaType) {
info = info.makeAlphaType(kPremul_SkAlphaType);
}
bitmap.allocPixels(info);
SkCodec::Options options;