Index: Source/core/platform/graphics/BitmapImage.cpp |
diff --git a/Source/core/platform/graphics/BitmapImage.cpp b/Source/core/platform/graphics/BitmapImage.cpp |
index 1f34b02046832703e60588312b9cf1b652080329..1f98323fb1aa961ac8b13f4e74ce6000d94a3999 100644 |
--- a/Source/core/platform/graphics/BitmapImage.cpp |
+++ b/Source/core/platform/graphics/BitmapImage.cpp |
@@ -84,12 +84,10 @@ bool BitmapImage::hasSingleSecurityOrigin() const |
void BitmapImage::destroyDecodedData(bool destroyAll) |
{ |
unsigned frameBytesCleared = 0; |
- const size_t clearBeforeFrame = destroyAll ? m_frames.size() : m_currentFrame; |
+ for (size_t i = 0; i < m_frames.size(); ++i) { |
+ if (!destroyAll && i == m_currentFrame) |
+ continue; |
- // Because we can advance frames without always needing to decode the actual |
- // bitmap data, |m_currentFrame| may be larger than m_frames.size(); |
- // make sure not to walk off the end of the container in this case. |
- for (size_t i = 0; i < std::min(clearBeforeFrame, m_frames.size()); ++i) { |
// The underlying frame isn't actually changing (we're just trying to |
// save the memory for the framebuffer data), so we don't need to clear |
// the metadata. |
@@ -100,7 +98,7 @@ void BitmapImage::destroyDecodedData(bool destroyAll) |
destroyMetadataAndNotify(frameBytesCleared); |
- m_source.clear(destroyAll, clearBeforeFrame, data(), m_allDataReceived); |
+ m_source.clear(destroyAll, m_currentFrame, data(), m_allDataReceived); |
return; |
} |
@@ -532,7 +530,6 @@ bool BitmapImage::internalAdvanceAnimation(bool skippingFrames) |
++m_currentFrame; |
bool advancedAnimation = true; |
- bool destroyAll = false; |
if (m_currentFrame >= frameCount()) { |
++m_repetitionsComplete; |
@@ -546,12 +543,10 @@ bool BitmapImage::internalAdvanceAnimation(bool skippingFrames) |
m_desiredFrameStartTime = 0; |
--m_currentFrame; |
advancedAnimation = false; |
- } else { |
+ } else |
m_currentFrame = 0; |
- destroyAll = true; |
- } |
} |
- destroyDecodedDataIfNecessary(destroyAll); |
+ destroyDecodedDataIfNecessary(false); |
// We need to draw this frame if we advanced to it while not skipping, or if |
// while trying to skip frames we hit the last frame and thus had to stop. |