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

Unified Diff: src/codec/SkGifCodec.cpp

Issue 2452673002: Always use a color table with 256 colors (Closed)
Patch Set: rebase Created 4 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkGifCodec.cpp
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index 1ede918657503a0e9d41321574b15eecd2bb4642..f507100810a8fbbd69b8b415e3bb856b5c3b188b 100644
--- a/src/codec/SkGifCodec.cpp
+++ b/src/codec/SkGifCodec.cpp
@@ -37,6 +37,7 @@
#include "SkGifCodec.h"
#include "SkStream.h"
#include "SkSwizzler.h"
+#include "SkUtils.h"
#include <algorithm>
@@ -143,9 +144,10 @@ void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, size_t frameIn
fCurrColorTable = fReader->getColorTable(dstInfo.colorType(), frameIndex);
fCurrColorTableIsReal = fCurrColorTable;
if (!fCurrColorTable) {
- // This is possible for an empty frame. Create a dummy with one value (transparent).
- SkPMColor color = SK_ColorTRANSPARENT;
- fCurrColorTable.reset(new SkColorTable(&color, 1));
+ // This is possible for an empty frame. Create a dummy with all transparent.
+ SkPMColor colors[MAX_COLORS];
+ sk_memset32(colors, SK_ColorTRANSPARENT, MAX_COLORS);
+ fCurrColorTable.reset(new SkColorTable(colors, 256));
}
if (inputColorCount) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698