GIF: Internal cleanup - remove color map parameter
authorLeon Scroggins III <scroggo@google.com>
Mon, 5 Dec 2016 19:56:30 +0000 (14:56 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 5 Dec 2016 20:28:34 +0000 (20:28 +0000)
SkGIFFrameContext::decode() and SkGIFLZWContext::prepareToDecode() do
not need (or use) the global color map, so stop passing it as a
parameter. The parameter was used prior to
https://skia-review.googlesource.com/c/4379/ (different issue!), but we
overlooked removing it then.

Change-Id: I0f477e9db11f7650938d6b868baef69e3b37d86b
Reviewed-on: https://skia-review.googlesource.com/5609
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Matt Sarett <msarett@google.com>
third_party/gif/SkGifImageReader.cpp
third_party/gif/SkGifImageReader.h

index 59e3d69..14aa1f1 100644 (file)
@@ -360,7 +360,7 @@ sk_sp<SkColorTable> SkGifImageReader::getColorTable(SkColorType colorType, size_
 // Perform decoding for this frame. frameComplete will be true if the entire frame is decoded.
 // Returns false if a decoding error occurred. This is a fatal error and causes the SkGifImageReader to set the "decode failed" flag.
 // Otherwise, either not enough data is available to decode further than before, or the new data has been decoded successfully; returns true in this case.
-bool SkGIFFrameContext::decode(SkGifCodec* client, const SkGIFColorMap& globalMap, bool* frameComplete)
+bool SkGIFFrameContext::decode(SkGifCodec* client, bool* frameComplete)
 {
     *frameComplete = false;
     if (!m_lzwContext) {
@@ -369,7 +369,7 @@ bool SkGIFFrameContext::decode(SkGifCodec* client, const SkGIFColorMap& globalMa
             return true;
 
         m_lzwContext.reset(new SkGIFLZWContext(client, this));
-        if (!m_lzwContext->prepareToDecode(globalMap)) {
+        if (!m_lzwContext->prepareToDecode()) {
             m_lzwContext.reset();
             return false;
         }
@@ -402,7 +402,7 @@ bool SkGifImageReader::decode(size_t frameIndex, bool* frameComplete)
 {
     SkGIFFrameContext* currentFrame = m_frames[frameIndex].get();
 
-    return currentFrame->decode(m_client, m_globalColorMap, frameComplete);
+    return currentFrame->decode(m_client, frameComplete);
 }
 
 // Parse incoming GIF data stream into internal data structures.
@@ -901,7 +901,7 @@ void SkGifImageReader::addFrameIfNecessary()
 }
 
 // FIXME: Move this method to close to doLZW().
-bool SkGIFLZWContext::prepareToDecode(const SkGIFColorMap& globalMap)
+bool SkGIFLZWContext::prepareToDecode()
 {
     SkASSERT(m_frameContext->isDataSizeDefined() && m_frameContext->isHeaderDefined());
 
index 67868ae..2843a35 100644 (file)
@@ -108,7 +108,7 @@ public:
         , m_frameContext(frameContext)
     { }
 
-    bool prepareToDecode(const SkGIFColorMap& globalMap);
+    bool prepareToDecode();
     bool outputRow(const unsigned char* rowBegin);
     bool doLZW(const unsigned char* block, size_t bytesInBlock);
     bool hasRemainingRows() { return SkToBool(rowsRemaining); }
@@ -206,7 +206,7 @@ public:
         m_lzwBlocks.push_back(SkData::MakeWithCopy(data, size));
     }
 
-    bool decode(SkGifCodec* client, const SkGIFColorMap& globalMap, bool* frameDecoded);
+    bool decode(SkGifCodec* client, bool* frameDecoded);
 
     int frameId() const { return m_frameId; }
     void setRect(unsigned x, unsigned y, unsigned width, unsigned height)