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

Unified Diff: src/core/SkImageGenerator.cpp

Issue 1495693003: Index8 GPU and CPU raster support. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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
Index: src/core/SkImageGenerator.cpp
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index 5e401920cd97a68cf5cb5e88e73a3fa9d6092c99..3712c4c46b99c1ca880afe8b5554f5ff365f16d6 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -177,6 +177,14 @@ bool SkImageGenerator::tryGenerateBitmap(SkBitmap* bitmap, const SkImageInfo* in
int ctCount = 0;
if (!this->getPixels(bitmap->info(), bitmap->getPixels(), bitmap->rowBytes(),
ctStorage, &ctCount)) {
+ // Generator failing to decode to declared colorType, could decode to N32.
+ // This is important for Chromium Index8 decoding - GIF multiframe animation frames are
+ // decoded to Index8 format by default but in rare cases some of the frames are N32.
+ if (bitmap->colorType() != kN32_SkColorType) {
+ bitmap->reset();
+ info = SkImageInfo::MakeN32(info.width(), info.height(), info.alphaType());
+ return tryGenerateBitmap(bitmap, &info, allocator);
+ }
return reset_and_return_false(bitmap);
}
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/gpu/SkGr.cpp » ('j') | src/gpu/SkGr.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698