diff options
Diffstat (limited to 'third_party/gif/SkGifImageReader.cpp')
-rw-r--r-- | third_party/gif/SkGifImageReader.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/third_party/gif/SkGifImageReader.cpp b/third_party/gif/SkGifImageReader.cpp index ed20af017b..990da5618b 100644 --- a/third_party/gif/SkGifImageReader.cpp +++ b/third_party/gif/SkGifImageReader.cpp @@ -344,7 +344,7 @@ sk_sp<SkColorTable> SkGIFColorMap::buildTable(SkStreamBuffer* streamBuffer, SkCo } sk_sp<SkColorTable> SkGifImageReader::getColorTable(SkColorType colorType, int index) { - if (index < 0 || static_cast<size_t>(index) >= m_frames.size()) { + if (index < 0 || index >= m_frames.count()) { return nullptr; } @@ -382,8 +382,7 @@ bool SkGIFFrameContext::decode(SkStreamBuffer* streamBuffer, SkGifCodec* client, } // Some bad GIFs have extra blocks beyond the last row, which we don't want to decode. - while (static_cast<size_t>(m_currentLzwBlock) < m_lzwBlocks.size() - && m_lzwContext->hasRemainingRows()) { + while (m_currentLzwBlock < m_lzwBlocks.count() && m_lzwContext->hasRemainingRows()) { const auto& block = m_lzwBlocks[m_currentLzwBlock]; const size_t len = block.blockSize; @@ -430,7 +429,7 @@ SkCodec::Result SkGifImageReader::parse(SkGifImageReader::SkGIFParseQuery query) // SkGIFSizeQuery and SkGIFFrameCountQuery are negative, so this is only meaningful when >= 0. const int lastFrameToParse = (int) query; - if (lastFrameToParse >= 0 && (int) m_frames.size() > lastFrameToParse + if (lastFrameToParse >= 0 && m_frames.count() > lastFrameToParse && m_frames[lastFrameToParse]->isComplete()) { // We have already parsed this frame. return SkCodec::kSuccess; @@ -823,7 +822,7 @@ SkCodec::Result SkGifImageReader::parse(SkGifImageReader::SkGIFParseQuery query) // decode all rows but we treat it as frame complete. m_frames.back()->setComplete(); GETN(1, SkGIFImageStart); - if (lastFrameToParse >= 0 && (int) m_frames.size() > lastFrameToParse) { + if (lastFrameToParse >= 0 && m_frames.count() > lastFrameToParse) { m_streamBuffer.flush(); return SkCodec::kSuccess; } @@ -874,9 +873,8 @@ bool SkGifImageReader::hasTransparency(int transparentPixel, bool isLocalColorma void SkGifImageReader::addFrameIfNecessary() { if (m_frames.empty() || m_frames.back()->isComplete()) { - const size_t i = m_frames.size(); - std::unique_ptr<SkGIFFrameContext> frame(new SkGIFFrameContext(this, static_cast<int>(i))); - m_frames.push_back(std::move(frame)); + const int i = m_frames.count(); + m_frames.emplace_back(new SkGIFFrameContext(this, i)); } } |