Skip to content

Commit

Permalink
Convert animated unpremul images to premul during decode (flutter#8698)
Browse files Browse the repository at this point in the history
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 flutter#28785
  • Loading branch information
brianosman authored Apr 23, 2019
1 parent c63d1cf commit 098ada5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ui/painting/codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 098ada5

Please sign in to comment.