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

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

Issue 15350006: Decode GIF image frames on demand. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Don't preserve the last frame and frames at intervals 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.h
diff --git a/Source/core/platform/image-decoders/ImageDecoder.h b/Source/core/platform/image-decoders/ImageDecoder.h
index 83dbdc070a653ec942c629b7e635ae8c4f37560e..1ad13f7820441d17a52618b7775f0b0225f48a09 100644
--- a/Source/core/platform/image-decoders/ImageDecoder.h
+++ b/Source/core/platform/image-decoders/ImageDecoder.h
@@ -117,6 +117,7 @@ namespace WebCore {
FrameDisposalMethod disposalMethod() const { return m_disposalMethod; }
bool premultiplyAlpha() const { return m_premultiplyAlpha; }
void reportMemoryUsage(MemoryObjectInfo*) const;
+ size_t requiredPreviousFrameIndex() const { return m_requiredPreviousFrameIndex; }
void setHasAlpha(bool alpha);
void setOriginalFrameRect(const IntRect& r) { m_originalFrameRect = r; }
@@ -124,6 +125,7 @@ namespace WebCore {
void setDuration(unsigned duration) { m_duration = duration; }
void setDisposalMethod(FrameDisposalMethod method) { m_disposalMethod = method; }
void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = premultiplyAlpha; }
+ void setRequiredPreviousFrameIndex(size_t previousFrameIndex) { m_requiredPreviousFrameIndex = previousFrameIndex; }
inline void setRGBA(int x, int y, unsigned r, unsigned g, unsigned b, unsigned a)
{
@@ -202,6 +204,10 @@ namespace WebCore {
unsigned m_duration;
FrameDisposalMethod m_disposalMethod;
bool m_premultiplyAlpha;
+
+ // The frame that must be decoded before this frame can be decoded.
+ // |notFound| if this frame doesn't require any previous frame.
+ size_t m_requiredPreviousFrameIndex;
};
// ImageDecoder is a base for all format-specific decoders
@@ -371,10 +377,10 @@ namespace WebCore {
bool failed() const { return m_failed; }
- // Clears decoded pixel data from before the provided frame unless that
+ // Clears decoded pixel data except the provided frame unless that
// data may be needed to decode future frames (e.g. due to GIF frame
// compositing).
- virtual void clearFrameBufferCache(size_t) { }
+ void clearFrameBufferCache(size_t clearExceptFrame);
#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
void setMaxNumPixels(int m) { m_maxNumPixels = m; }
@@ -395,6 +401,12 @@ namespace WebCore {
}
protected:
+ // Finds the previous required frame for decoding the given frame.
+ // Returns notFound if this frame doesn't require any previous frame.
+ // Subclasses should call this function and cache the result by calling
+ // ImageFrame::setRequiredPreviousFrame() when a new frame is created.
+ size_t findRequiredPreviousFrame(size_t frameIndex);
+
void prepareScaleDataIfNecessary();
int upperBoundScaledX(int origX, int searchStart = 0);
int lowerBoundScaledX(int origX, int searchStart = 0);

Powered by Google App Engine
This is Rietveld 408576698