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

Unified Diff: src/images/SkImageDecoder_libwebp.cpp

Issue 223893002: Properly set alpha type in webp decode. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase. Created 6 years, 9 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 49d5bd1cca079653a3d7f014d300bb2638671b3c..02990258ebe84dbce0f46c5436a95b24b8bfe8b2 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