OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. |
4 * Copyright (C) 2008-2009 Torch Mobile, Inc. | 4 * Copyright (C) 2008-2009 Torch Mobile, Inc. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void draw(SkCanvas*, | 113 void draw(SkCanvas*, |
114 const SkPaint&, | 114 const SkPaint&, |
115 const FloatRect& dstRect, | 115 const FloatRect& dstRect, |
116 const FloatRect& srcRect, | 116 const FloatRect& srcRect, |
117 RespectImageOrientationEnum, | 117 RespectImageOrientationEnum, |
118 ImageClampingMode) override; | 118 ImageClampingMode) override; |
119 | 119 |
120 size_t currentFrame() const { return m_currentFrame; } | 120 size_t currentFrame() const { return m_currentFrame; } |
121 size_t frameCount(); | 121 size_t frameCount(); |
122 | 122 |
123 sk_sp<SkImage> frameAtIndex(size_t); | 123 sk_sp<SkImage> frameAtIndex(size_t, const ColorBehavior&); |
124 | 124 |
125 bool frameIsCompleteAtIndex(size_t) const; | 125 bool frameIsCompleteAtIndex(size_t) const; |
126 float frameDurationAtIndex(size_t) const; | 126 float frameDurationAtIndex(size_t) const; |
127 bool frameHasAlphaAtIndex(size_t); | 127 bool frameHasAlphaAtIndex(size_t); |
128 ImageOrientation frameOrientationAtIndex(size_t); | 128 ImageOrientation frameOrientationAtIndex(size_t); |
129 | 129 |
130 sk_sp<SkImage> decodeAndCacheFrame(size_t index); | 130 sk_sp<SkImage> decodeAndCacheFrame(size_t index, const ColorBehavior&); |
131 void updateSize() const; | 131 void updateSize() const; |
132 | 132 |
133 // Returns the total number of bytes allocated for all framebuffers, i.e. | 133 // Returns the total number of bytes allocated for all framebuffers, i.e. |
134 // the sum of m_source.frameBytesAtIndex(...) for all frames. | 134 // the sum of m_source.frameBytesAtIndex(...) for all frames. |
135 size_t totalFrameBytes(); | 135 size_t totalFrameBytes(); |
136 | 136 |
137 // Called to wipe out the entire frame buffer cache and tell the image | 137 // Called to wipe out the entire frame buffer cache and tell the image |
138 // source to destroy everything; this is used when e.g. we want to free | 138 // source to destroy everything; this is used when e.g. we want to free |
139 // some room in the image cache. | 139 // some room in the image cache. |
140 void destroyDecodedData() override; | 140 void destroyDecodedData() override; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 mutable IntSize m_sizeRespectingOrientation; | 184 mutable IntSize m_sizeRespectingOrientation; |
185 | 185 |
186 size_t m_currentFrame; // The index of the current frame of animation. | 186 size_t m_currentFrame; // The index of the current frame of animation. |
187 Vector<FrameData, 1> m_frames; // An array of the cached frames of the | 187 Vector<FrameData, 1> m_frames; // An array of the cached frames of the |
188 // animation. We have to ref frames to pin | 188 // animation. We have to ref frames to pin |
189 // them in the cache. | 189 // them in the cache. |
190 | 190 |
191 sk_sp<SkImage> | 191 sk_sp<SkImage> |
192 m_cachedFrame; // A cached copy of the most recently-accessed frame. | 192 m_cachedFrame; // A cached copy of the most recently-accessed frame. |
193 size_t m_cachedFrameIndex; // Index of the frame that is cached. | 193 size_t m_cachedFrameIndex; // Index of the frame that is cached. |
| 194 ColorBehavior m_cachedFrameColorBehavior; // Color behavior that created the |
| 195 // cached frame. |
194 | 196 |
195 std::unique_ptr<Timer<BitmapImage>> m_frameTimer; | 197 std::unique_ptr<Timer<BitmapImage>> m_frameTimer; |
196 int m_repetitionCount; // How many total animation loops we should do. This | 198 int m_repetitionCount; // How many total animation loops we should do. This |
197 // will be cAnimationNone if this image type is | 199 // will be cAnimationNone if this image type is |
198 // incapable of animation. | 200 // incapable of animation. |
199 RepetitionCountStatus m_repetitionCountStatus; | 201 RepetitionCountStatus m_repetitionCountStatus; |
200 int m_repetitionsComplete; // How many repetitions we've finished. | 202 int m_repetitionsComplete; // How many repetitions we've finished. |
201 double m_desiredFrameStartTime; // The system time at which we hope to see | 203 double m_desiredFrameStartTime; // The system time at which we hope to see |
202 // the next call to startAnimation(). | 204 // the next call to startAnimation(). |
203 | 205 |
(...skipping 11 matching lines...) Expand all Loading... |
215 bool m_sizeAvailable : 1; // Whether we can obtain the size of the first | 217 bool m_sizeAvailable : 1; // Whether we can obtain the size of the first |
216 // image frame from ImageIO yet. | 218 // image frame from ImageIO yet. |
217 mutable bool m_haveFrameCount : 1; | 219 mutable bool m_haveFrameCount : 1; |
218 }; | 220 }; |
219 | 221 |
220 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); | 222 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); |
221 | 223 |
222 } // namespace blink | 224 } // namespace blink |
223 | 225 |
224 #endif | 226 #endif |
OLD | NEW |