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

Unified Diff: src/images/SkImageDecoder_libwebp.cpp

Issue 252423008: Reland Properly set alpha type in webp decode. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: No change Created 6 years, 8 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 | « resources/yellow_rose.webp ('k') | tests/ImageDecodingTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libwebp.cpp
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 517480665366dfa78231983e087b9a5ef8d728e6..4e23e50f5760fcf2024799265d7b4257823cf071 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -298,8 +298,20 @@ bool SkWEBPImageDecoder::setDecodeConfig(SkBitmap* decodedBitmap,
return false;
}
- return decodedBitmap->setConfig(config, width, height, 0,
- fHasAlpha ? kPremul_SkAlphaType : kOpaque_SkAlphaType);
+ SkImageInfo info;
+ info.fWidth = width;
+ info.fHeight = height;
+ info.fColorType = SkBitmapConfigToColorType(config);
+ if (SkToBool(fHasAlpha)) {
+ if (this->getRequireUnpremultipliedColors()) {
+ info.fAlphaType = kUnpremul_SkAlphaType;
+ } else {
+ info.fAlphaType = kPremul_SkAlphaType;
+ }
+ } else {
+ info.fAlphaType = kOpaque_SkAlphaType;
+ }
+ return decodedBitmap->setConfig(info);
}
bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream,
« no previous file with comments | « resources/yellow_rose.webp ('k') | tests/ImageDecodingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698