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

Unified Diff: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp

Issue 1962563002: Fix ImageDecoder::frameIsCompleteAtIndex - fully received instead of decoded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
index 2f3b925fa0913a5cab7cee801239036ab77c9431..14b7d370cd2c6a40507486c89b13585d73d05dec 100644
--- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
@@ -146,7 +146,7 @@ PassRefPtr<SkImage> BitmapImage::decodeAndCacheFrame(size_t index)
m_frames[index].m_orientation = m_source.orientationAtIndex(index);
m_frames[index].m_haveMetadata = true;
- m_frames[index].m_isComplete = m_source.frameIsCompleteAtIndex(index);
+ m_frames[index].m_isFullyReceived = m_source.frameIsFullyReceivedAtIndex(index);
if (repetitionCount(false) != cAnimationNone)
m_frames[index].m_duration = m_source.frameDurationAtIndex(index);
m_frames[index].m_hasAlpha = m_source.frameHasAlphaAtIndex(index);
@@ -205,10 +205,7 @@ bool BitmapImage::dataChanged(bool allDataReceived)
// frame affected by appending new data here. Thus we have to clear all the
// incomplete frames to be safe.
for (size_t i = 0; i < m_frames.size(); ++i) {
- // NOTE: Don't call frameIsCompleteAtIndex() here, that will try to
- // decode any uncached (i.e. never-decoded or
- // cleared-on-a-previous-pass) frames!
- if (m_frames[i].m_haveMetadata && !m_frames[i].m_isComplete) {
+ if (m_frames[i].m_haveMetadata && !m_frames[i].m_isFullyReceived) {
m_frames[i].clear(true);
if (i == m_cachedFrameIndex)
m_cachedFrame.clear();
@@ -326,12 +323,12 @@ PassRefPtr<SkImage> BitmapImage::frameAtIndex(size_t index)
return decodeAndCacheFrame(index);
}
-bool BitmapImage::frameIsCompleteAtIndex(size_t index)
+bool BitmapImage::frameIsFullyReceivedAtIndex(size_t index)
{
- if (index < m_frames.size() && m_frames[index].m_haveMetadata && m_frames[index].m_isComplete)
+ if (index < m_frames.size() && m_frames[index].m_haveMetadata && m_frames[index].m_isFullyReceived)
return true;
- return m_source.frameIsCompleteAtIndex(index);
+ return m_source.frameIsFullyReceivedAtIndex(index);
}
float BitmapImage::frameDurationAtIndex(size_t index)
@@ -379,9 +376,9 @@ bool BitmapImage::currentFrameKnownToBeOpaque(MetadataMode metadataMode)
return !frameHasAlphaAtIndex(currentFrame());
}
-bool BitmapImage::currentFrameIsComplete()
+bool BitmapImage::currentFrameIsFullyReceived()
{
- return frameIsCompleteAtIndex(currentFrame());
+ return frameIsFullyReceivedAtIndex(currentFrame());
}
bool BitmapImage::currentFrameIsLazyDecoded()
@@ -439,7 +436,7 @@ void BitmapImage::startAnimation(CatchUpAnimation catchUpIfNecessary)
// Don't advance the animation to an incomplete frame.
size_t nextFrame = (m_currentFrame + 1) % frameCount();
- if (!m_allDataReceived && !frameIsCompleteAtIndex(nextFrame))
+ if (!m_allDataReceived && !frameIsFullyReceivedAtIndex(nextFrame))
return;
// Don't advance past the last frame if we haven't decoded the whole image
@@ -486,7 +483,7 @@ void BitmapImage::startAnimation(CatchUpAnimation catchUpIfNecessary)
// See if we've also passed the time for frames after that to start, in
// case we need to skip some frames entirely. Remember not to advance
// to an incomplete frame.
- for (size_t frameAfterNext = (nextFrame + 1) % frameCount(); frameIsCompleteAtIndex(frameAfterNext); frameAfterNext = (nextFrame + 1) % frameCount()) {
+ for (size_t frameAfterNext = (nextFrame + 1) % frameCount(); frameIsFullyReceivedAtIndex(frameAfterNext); frameAfterNext = (nextFrame + 1) % frameCount()) {
// Should we skip the next frame?
double frameAfterNextStartTime = m_desiredFrameStartTime + frameDurationAtIndex(nextFrame);
if (time < frameAfterNextStartTime)

Powered by Google App Engine
This is Rietveld 408576698