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

Unified Diff: Source/core/platform/graphics/ImageSource.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: const Created 7 years, 8 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/graphics/ImageSource.cpp
diff --git a/Source/core/platform/graphics/ImageSource.cpp b/Source/core/platform/graphics/ImageSource.cpp
index b02499d65d57411f430bf3be5c9fe8b3c7e386a8..7054f24aadf9d4bb4104fcdc0c4b3f443c66510b 100644
--- a/Source/core/platform/graphics/ImageSource.cpp
+++ b/Source/core/platform/graphics/ImageSource.cpp
@@ -156,20 +156,16 @@ PassNativeImagePtr ImageSource::createFrameAtIndex(size_t index)
return buffer->asNewNativeImage();
}
-float ImageSource::frameDurationAtIndex(size_t index)
+float ImageSource::frameDurationAtIndex(size_t index) const
{
if (!m_decoder)
return 0;
- ImageFrame* buffer = m_decoder->frameBufferAtIndex(index);
- if (!buffer || buffer->status() == ImageFrame::FrameEmpty)
- return 0;
-
// Many annoying ads specify a 0 duration to make an image flash as quickly as possible.
// We follow Firefox's behavior and use a duration of 100 ms for any frames that specify
// a duration of <= 10 ms. See <rdar://problem/7689300> and <http://webkit.org/b/36082>
// for more information.
- const float duration = buffer->duration() / 1000.0f;
+ const float duration = m_decoder->frameDurationAtIndex(index) / 1000.0f;
if (duration < 0.011f)
return 0.100f;
return duration;
@@ -180,20 +176,18 @@ ImageOrientation ImageSource::orientationAtIndex(size_t) const
return m_decoder ? m_decoder->orientation() : DefaultImageOrientation;
}
-bool ImageSource::frameHasAlphaAtIndex(size_t index)
+bool ImageSource::frameHasAlphaAtIndex(size_t index) const
{
if (!m_decoder)
Peter Kasting 2013/04/23 21:43:20 Nit: Shorter: return !m_decoder || m_decoder-
Alpha Left Google 2013/04/25 23:02:44 Done.
return true;
return m_decoder->frameHasAlphaAtIndex(index);
}
-bool ImageSource::frameIsCompleteAtIndex(size_t index)
+bool ImageSource::frameIsCompleteAtIndex(size_t index) const
{
if (!m_decoder)
Peter Kasting 2013/04/23 21:43:20 Nit: Shorter: return m_decoder && m_decoder->
Alpha Left Google 2013/04/25 23:02:44 Done.
return false;
-
- ImageFrame* buffer = m_decoder->frameBufferAtIndex(index);
- return buffer && buffer->status() == ImageFrame::FrameComplete;
+ return m_decoder->frameIsCompleteAtIndex(index);
}
unsigned ImageSource::frameBytesAtIndex(size_t index) const

Powered by Google App Engine
This is Rietveld 408576698