OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 11 matching lines...) Expand all Loading... |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef ImageFrame_h | 27 #ifndef ImageFrame_h |
28 #define ImageFrame_h | 28 #define ImageFrame_h |
29 | 29 |
30 #include "platform/PlatformExport.h" | 30 #include "platform/PlatformExport.h" |
31 #include "platform/geometry/IntRect.h" | 31 #include "platform/geometry/IntRect.h" |
| 32 #include "public/platform/WebVector.h" |
32 #include "third_party/skia/include/core/SkBitmap.h" | 33 #include "third_party/skia/include/core/SkBitmap.h" |
33 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
34 #include "wtf/Assertions.h" | 35 #include "wtf/Assertions.h" |
35 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 // ImageFrame represents the decoded image data. This buffer is what all | 40 // ImageFrame represents the decoded image data. This buffer is what all |
40 // decoders write a single frame into. | 41 // decoders write a single frame into. |
41 class PLATFORM_EXPORT ImageFrame final { | 42 class PLATFORM_EXPORT ImageFrame final { |
(...skipping 21 matching lines...) Expand all Loading... |
63 // initial buffer state (i.e. any previous frame buffer after having | 64 // initial buffer state (i.e. any previous frame buffer after having |
64 // been properly disposed). | 65 // been properly disposed). |
65 BlendAtopPreviousFrame, | 66 BlendAtopPreviousFrame, |
66 | 67 |
67 // Blend non-opaque pixels against fully transparent (i.e. simply | 68 // Blend non-opaque pixels against fully transparent (i.e. simply |
68 // overwrite the corresponding pixels). | 69 // overwrite the corresponding pixels). |
69 BlendAtopBgcolor, | 70 BlendAtopBgcolor, |
70 }; | 71 }; |
71 typedef uint32_t PixelData; | 72 typedef uint32_t PixelData; |
72 | 73 |
| 74 typedef WebVector<char> ICCProfile; |
| 75 |
73 ImageFrame(); | 76 ImageFrame(); |
74 | 77 |
75 // The assignment operator reads m_hasAlpha (inside setStatus()) before it | 78 // The assignment operator reads m_hasAlpha (inside setStatus()) before it |
76 // sets it (in setHasAlpha()). This doesn't cause any problems, since the | 79 // sets it (in setHasAlpha()). This doesn't cause any problems, since the |
77 // setHasAlpha() call ensures all state is set correctly, but it means we | 80 // setHasAlpha() call ensures all state is set correctly, but it means we |
78 // need to initialize m_hasAlpha to some value before calling the operator | 81 // need to initialize m_hasAlpha to some value before calling the operator |
79 // lest any tools complain about using an uninitialized value. | 82 // lest any tools complain about using an uninitialized value. |
80 ImageFrame(const ImageFrame& other) : m_hasAlpha(false) { operator=(other);
} | 83 ImageFrame(const ImageFrame& other) : m_hasAlpha(false) { operator=(other);
} |
81 | 84 |
82 // For backends which refcount their data, this operator doesn't need to | 85 // For backends which refcount their data, this operator doesn't need to |
(...skipping 21 matching lines...) Expand all Loading... |
104 ASSERT(endY <= height()); | 107 ASSERT(endY <= height()); |
105 const int rowBytes = (endX - startX) * sizeof(PixelData); | 108 const int rowBytes = (endX - startX) * sizeof(PixelData); |
106 const PixelData* const startAddr = getAddr(startX, startY); | 109 const PixelData* const startAddr = getAddr(startX, startY); |
107 for (int destY = startY + 1; destY < endY; ++destY) | 110 for (int destY = startY + 1; destY < endY; ++destY) |
108 memcpy(getAddr(startX, destY), startAddr, rowBytes); | 111 memcpy(getAddr(startX, destY), startAddr, rowBytes); |
109 } | 112 } |
110 | 113 |
111 // Allocates space for the pixel data. Must be called before any pixels | 114 // Allocates space for the pixel data. Must be called before any pixels |
112 // are written. Must only be called once. Returns whether allocation | 115 // are written. Must only be called once. Returns whether allocation |
113 // succeeded. | 116 // succeeded. |
114 bool setSize(int newWidth, int newHeight); | 117 bool setSizeAndColorProfile(int newWidth, int newHeight, const ICCProfile& n
ewIccProfile); |
115 | 118 |
116 bool hasAlpha() const; | 119 bool hasAlpha() const; |
117 const IntRect& originalFrameRect() const { return m_originalFrameRect; } | 120 const IntRect& originalFrameRect() const { return m_originalFrameRect; } |
118 Status getStatus() const { return m_status; } | 121 Status getStatus() const { return m_status; } |
119 unsigned duration() const { return m_duration; } | 122 unsigned duration() const { return m_duration; } |
120 DisposalMethod getDisposalMethod() const { return m_disposalMethod; } | 123 DisposalMethod getDisposalMethod() const { return m_disposalMethod; } |
121 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; } | 124 AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; } |
122 bool premultiplyAlpha() const { return m_premultiplyAlpha; } | 125 bool premultiplyAlpha() const { return m_premultiplyAlpha; } |
123 SkBitmap::Allocator* allocator() const { return m_allocator; } | 126 SkBitmap::Allocator* allocator() const { return m_allocator; } |
124 const SkBitmap& bitmap() const { return m_bitmap; } | 127 const SkBitmap& bitmap() const { return m_bitmap; } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // The frame that must be decoded before this frame can be decoded. | 216 // The frame that must be decoded before this frame can be decoded. |
214 // WTF::kNotFound if this frame doesn't require any previous frame. | 217 // WTF::kNotFound if this frame doesn't require any previous frame. |
215 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never | 218 // This is used by ImageDecoder::clearCacheExceptFrame(), and will never |
216 // be read for image formats that do not have multiple frames. | 219 // be read for image formats that do not have multiple frames. |
217 size_t m_requiredPreviousFrameIndex; | 220 size_t m_requiredPreviousFrameIndex; |
218 }; | 221 }; |
219 | 222 |
220 } // namespace blink | 223 } // namespace blink |
221 | 224 |
222 #endif | 225 #endif |
OLD | NEW |