aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/gif/SkGifImageReader.h
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@chromium.org>2016-10-26 13:48:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-10-26 13:48:03 -0700
commit1285f413950910782d5439b5072ccfa14bdf80f7 (patch)
treef206f8a5097984ba33cf20df74a13009ed31f949 /third_party/gif/SkGifImageReader.h
parentd187af90c7a3dc945eb91a7d3ade0311d1d111f0 (diff)
Write transparent pixels more often (SkGifCodec)
Writing transparent pixels is faster than the alternative, and we can skip clearing the frame to transparent. We'll still clear if the image is incomplete. I ran ./out/Release/nanobench --images <images> --samples 100 --sourceType image --simpleCodec -v over the GIFs we have on our bots, and found an average ~13% speedup. Raw data is on sheet 2 of https://docs.google.com/spreadsheets/d/19V-t9BfbFw5eiwBTKA1qOBkZbchjlTC5EIz6HFy-6RI/ (the sheet is named WriteTransparentPixels). GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2436183002 Review-Url: https://codereview.chromium.org/2436183002
Diffstat (limited to 'third_party/gif/SkGifImageReader.h')
-rw-r--r--third_party/gif/SkGifImageReader.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/third_party/gif/SkGifImageReader.h b/third_party/gif/SkGifImageReader.h
index 45a1ce6dc6..fee1a5f3c7 100644
--- a/third_party/gif/SkGifImageReader.h
+++ b/third_party/gif/SkGifImageReader.h
@@ -102,6 +102,7 @@ public:
, ipass(0)
, irow(0)
, rowsRemaining(0)
+ , alwaysWriteTransparentPixels(false)
, rowIter(0)
, m_client(client)
, m_frameContext(frameContext)
@@ -125,6 +126,10 @@ private:
int ipass; // Interlace pass; Ranges 1-4 if interlaced.
size_t irow; // Current output row, starting at zero.
size_t rowsRemaining; // Rows remaining to be output.
+ // This depends on the GIFFrameContext. If the frame is not
+ // interlaced and it is independent, it is always safe to
+ // write transparent pixels.
+ bool alwaysWriteTransparentPixels;
unsigned short prefix[SK_MAX_DICTIONARY_ENTRIES];
unsigned char suffix[SK_MAX_DICTIONARY_ENTRIES];