diff options
Diffstat (limited to 'third_party/gif')
-rw-r--r-- | third_party/gif/SkGifImageReader.cpp | 32 | ||||
-rw-r--r-- | third_party/gif/SkGifImageReader.h | 5 |
2 files changed, 1 insertions, 36 deletions
diff --git a/third_party/gif/SkGifImageReader.cpp b/third_party/gif/SkGifImageReader.cpp index 0ffc7ca72a..59e3d6969c 100644 --- a/third_party/gif/SkGifImageReader.cpp +++ b/third_party/gif/SkGifImageReader.cpp @@ -146,9 +146,8 @@ bool SkGIFLZWContext::outputRow(const unsigned char* rowBegin) if ((unsigned)drowStart >= m_frameContext->height()) return true; - bool writeTransparentPixels = alwaysWriteTransparentPixels || - (m_frameContext->progressiveDisplay() && m_frameContext->interlaced() && ipass > 1); // CALLBACK: Let the client know we have decoded a row. + const bool writeTransparentPixels = (SkCodec::kNone == m_frameContext->getRequiredFrame()); if (!m_client->haveDecodedRow(m_frameContext->frameId(), rowBegin, drowStart, drowEnd - drowStart + 1, writeTransparentPixels)) return false; @@ -918,35 +917,6 @@ bool SkGIFLZWContext::prepareToDecode(const SkGIFColorMap& globalMap) datum = bits = 0; ipass = m_frameContext->interlaced() ? 1 : 0; irow = 0; - alwaysWriteTransparentPixels = false; - if (m_frameContext->getRequiredFrame() == SkCodec::kNone) { - if (!m_frameContext->interlaced()) { - alwaysWriteTransparentPixels = true; - } else { - // The frame is interlaced, so we do not want to write transparent - // pixels. But if there are no transparent pixels anyway, there is - // no harm in taking the alwaysWriteTransparentPixels path, which - // is faster, and it also supports 565. - // Since the frame is independent, it does not matter whether the - // frame is subset (nothing behind it needs to show through). So we - // only need to know whether there is a valid transparent pixel. - // This is a little counterintuitive - we want to "always write - // transparent pixels" if there ARE NO transparent pixels, so we - // check to see whether the pixel index is >= numColors. - const auto& localMap = m_frameContext->localColorMap(); - const auto trans = m_frameContext->transparentPixel(); - if (localMap.isDefined()) { - alwaysWriteTransparentPixels = trans >= localMap.numColors(); - } else { - // Note that if the map is not defined, the value of - // alwaysWriteTransparentPixels is meaningless, since without - // any color table, we will skip drawing entirely. - // FIXME: We could even skip calling prepareToDecode in that - // case, meaning we can SkASSERT(globalMap.isDefined()) - alwaysWriteTransparentPixels = trans >= globalMap.numColors(); - } - } - } // We want to know the longest sequence encodable by a dictionary with // SK_MAX_DICTIONARY_ENTRIES entries. If we ignore the need to encode the base diff --git a/third_party/gif/SkGifImageReader.h b/third_party/gif/SkGifImageReader.h index 2b1b2d9423..67868ae4d7 100644 --- a/third_party/gif/SkGifImageReader.h +++ b/third_party/gif/SkGifImageReader.h @@ -103,7 +103,6 @@ public: , ipass(0) , irow(0) , rowsRemaining(0) - , alwaysWriteTransparentPixels(false) , rowIter(0) , m_client(client) , m_frameContext(frameContext) @@ -127,10 +126,6 @@ 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]; |