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

Unified Diff: Source/core/platform/image-decoders/ImageDecoder.cpp

Issue 14317005: Checking if frame is complete and access duration doesn't need a decode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: done Created 7 years, 7 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
Index: Source/core/platform/image-decoders/ImageDecoder.cpp
diff --git a/Source/core/platform/image-decoders/ImageDecoder.cpp b/Source/core/platform/image-decoders/ImageDecoder.cpp
index 7bbf39fc271f210770ecfcc5e73ea16ca6ba1907..884542a1ab79fcc0afece4bbe1df2786c6afc74c 100644
--- a/Source/core/platform/image-decoders/ImageDecoder.cpp
+++ b/Source/core/platform/image-decoders/ImageDecoder.cpp
@@ -120,11 +120,13 @@ PassOwnPtr<ImageDecoder> ImageDecoder::create(const SharedBuffer& data, ImageSou
bool ImageDecoder::frameHasAlphaAtIndex(size_t index) const
{
- if (m_frameBufferCache.size() <= index)
- return true;
- if (m_frameBufferCache[index].status() == ImageFrame::FrameComplete)
- return m_frameBufferCache[index].hasAlpha();
- return true;
+ return !frameIsCompleteAtIndex(index) || m_frameBufferCache[index].hasAlpha();
+}
+
+bool ImageDecoder::frameIsCompleteAtIndex(size_t index) const
+{
+ return (index < m_frameBufferCache.size()) &&
+ (m_frameBufferCache[index].status() == ImageFrame::FrameComplete);
}
unsigned ImageDecoder::frameBytesAtIndex(size_t index) const
« no previous file with comments | « Source/core/platform/image-decoders/ImageDecoder.h ('k') | Source/core/platform/image-decoders/gif/GIFImageDecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698