Chromium Code Reviews| 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 3c4cc2dc31ae1c33b46c6102351b02b868203354..0d710e15012c66a04f9dd36fe356cd3ed14fd5f3 100644 |
| --- a/Source/core/platform/image-decoders/ImageDecoder.h |
| +++ b/Source/core/platform/image-decoders/ImageDecoder.h |
| @@ -64,6 +64,17 @@ namespace WebCore { |
| DisposeOverwritePrevious // Clear frame to previous framebuffer |
| // contents |
| }; |
| + // Indicates how transparent pixels of the current frame rectangle are |
| + // blended with those of the previous frame buffer. |
| + // Notes: |
| + // * GIF always uses 'BlendAtopPreviousFrame'. |
| + // * WebP also gives 'BlendAtopBgcolor' option. This is useful for cases |
|
Peter Kasting
2013/08/22 20:04:36
Nit: So you never stated clearly in the private em
urvang (Google)
2013/08/22 23:25:14
Short answer: WebP does have a background color co
Peter Kasting
2013/08/22 23:39:31
Uggghhhh, I can't believe you guys put in somethin
urvang (Google)
2013/08/23 00:13:35
I completely understand your point. We would have
Peter Kasting
2013/08/23 00:17:55
"Behave inconsistently" is a bug, not a use case.
urvang (Google)
2013/08/23 00:21:32
Point taken.
The spec is, in fact, locked in term
|
| + // where one wants to transform a few opaque pixels of previous frame |
| + // into non-opaque pixels in the current frame. |
| + enum AlphaBlendSourceForSubframe { |
|
Peter Kasting
2013/08/22 20:04:36
Nit: Since I was mistaken about thinking this was
urvang (Google)
2013/08/22 23:25:14
Using the name 'AlphaBlendSource'.
|
| + BlendAtopPreviousFrame, // Compose the rectangle of current frame by blending it with corresponding pixels in the previous (disposed) framebuffer. |
|
Peter Kasting
2013/08/22 20:04:36
Nit: Put these comments above the enum values (and
urvang (Google)
2013/08/22 23:25:14
Done.
|
| + BlendAtopBgcolor, // Compose the rectangle of current frame by over-writing the corresponding pixels in the previous (disposed) framebuffer. |
| + }; |
| typedef uint32_t PixelData; |
| ImageFrame(); |
| @@ -114,6 +125,7 @@ namespace WebCore { |
| FrameStatus status() const { return m_status; } |
| unsigned duration() const { return m_duration; } |
| FrameDisposalMethod disposalMethod() const { return m_disposalMethod; } |
| + AlphaBlendSourceForSubframe alphaBlendSource() const { return m_alphaBlendSource; } |
| bool premultiplyAlpha() const { return m_premultiplyAlpha; } |
| SkBitmap::Allocator* allocator() const { return m_allocator; } |
| const SkBitmap& getSkBitmap() const { return m_bitmap->bitmap(); } |
| @@ -131,6 +143,7 @@ namespace WebCore { |
| void setStatus(FrameStatus status); |
| void setDuration(unsigned duration) { m_duration = duration; } |
| void setDisposalMethod(FrameDisposalMethod method) { m_disposalMethod = method; } |
| + void setAlphaBlendSource(AlphaBlendSourceForSubframe source) { m_alphaBlendSource = source; } |
| void setPremultiplyAlpha(bool premultiplyAlpha) { m_premultiplyAlpha = premultiplyAlpha; } |
| void setMemoryAllocator(SkBitmap::Allocator* allocator) { m_allocator = allocator; } |
| void setSkBitmap(const SkBitmap& bitmap) { m_bitmap = NativeImageSkia::create(bitmap); } |
| @@ -199,6 +212,7 @@ namespace WebCore { |
| FrameStatus m_status; |
| unsigned m_duration; |
| FrameDisposalMethod m_disposalMethod; |
| + AlphaBlendSourceForSubframe m_alphaBlendSource; |
| bool m_premultiplyAlpha; |
| // The frame that must be decoded before this frame can be decoded. |
| @@ -383,14 +397,16 @@ namespace WebCore { |
| if (m_frameBufferCache.isEmpty()) { |
| m_frameBufferCache.resize(1); |
| m_frameBufferCache[0].setRequiredPreviousFrameIndex( |
| - findRequiredPreviousFrame(0)); |
| + findRequiredPreviousFrame(0, false)); |
| } |
| m_frameBufferCache[0].setMemoryAllocator(allocator); |
| } |
| protected: |
| // Calculates the most recent frame whose image data may be needed in |
| - // order to decode frame |frameIndex|, based on frame disposal methods. |
| + // order to decode frame |frameIndex|, based on frame disposal methods |
| + // and 'frameRectIsOpaque', where 'frameRectIsOpaque' signifies whether |
|
Peter Kasting
2013/08/22 20:04:36
Nit: Use || instead of '' to denote variable names
urvang (Google)
2013/08/22 23:25:14
Done.
|
| + // the rectangle of frame at 'frameIndex' is known to be opaque. |
| // If no previous frame's data is required, returns WTF::notFound. |
| // |
| // This function requires that the previous frame's |
| @@ -404,7 +420,7 @@ namespace WebCore { |
| // Image formats which do not use more than one frame do not need to |
| // worry about this; see comments on |
| // ImageFrame::m_requiredPreviousFrameIndex. |
| - size_t findRequiredPreviousFrame(size_t frameIndex); |
| + size_t findRequiredPreviousFrame(size_t frameIndex, bool frameRectIsOpaque); |
| virtual void clearFrameBuffer(size_t frameIndex); |