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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "platform/geometry/IntSize.h" | 31 #include "platform/geometry/IntSize.h" |
32 #include "platform/graphics/Color.h" | 32 #include "platform/graphics/Color.h" |
33 #include "platform/graphics/FrameData.h" | 33 #include "platform/graphics/FrameData.h" |
34 #include "platform/graphics/Image.h" | 34 #include "platform/graphics/Image.h" |
35 #include "platform/graphics/ImageAnimationPolicy.h" | 35 #include "platform/graphics/ImageAnimationPolicy.h" |
36 #include "platform/graphics/ImageOrientation.h" | 36 #include "platform/graphics/ImageOrientation.h" |
37 #include "platform/graphics/ImageSource.h" | 37 #include "platform/graphics/ImageSource.h" |
38 #include "platform/image-decoders/ImageAnimation.h" | 38 #include "platform/image-decoders/ImageAnimation.h" |
39 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
40 #include <memory> | 40 #include "wtf/OwnPtr.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 template <typename T> class Timer; | 44 template <typename T> class Timer; |
45 | 45 |
46 class PLATFORM_EXPORT BitmapImage final : public Image { | 46 class PLATFORM_EXPORT BitmapImage final : public Image { |
47 friend class BitmapImageTest; | 47 friend class BitmapImageTest; |
48 friend class CrossfadeGeneratedImage; | 48 friend class CrossfadeGeneratedImage; |
49 friend class GeneratedImage; | 49 friend class GeneratedImage; |
50 friend class GradientGeneratedImage; | 50 friend class GradientGeneratedImage; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 ImageSource m_source; | 157 ImageSource m_source; |
158 mutable IntSize m_size; // The size to use for the overall image (will just
be the size of the first image). | 158 mutable IntSize m_size; // The size to use for the overall image (will just
be the size of the first image). |
159 mutable IntSize m_sizeRespectingOrientation; | 159 mutable IntSize m_sizeRespectingOrientation; |
160 | 160 |
161 size_t m_currentFrame; // The index of the current frame of animation. | 161 size_t m_currentFrame; // The index of the current frame of animation. |
162 Vector<FrameData, 1> m_frames; // An array of the cached frames of the anima
tion. We have to ref frames to pin them in the cache. | 162 Vector<FrameData, 1> m_frames; // An array of the cached frames of the anima
tion. We have to ref frames to pin them in the cache. |
163 | 163 |
164 RefPtr<SkImage> m_cachedFrame; // A cached copy of the most recently-accesse
d frame. | 164 RefPtr<SkImage> m_cachedFrame; // A cached copy of the most recently-accesse
d frame. |
165 size_t m_cachedFrameIndex; // Index of the frame that is cached. | 165 size_t m_cachedFrameIndex; // Index of the frame that is cached. |
166 | 166 |
167 std::unique_ptr<Timer<BitmapImage>> m_frameTimer; | 167 OwnPtr<Timer<BitmapImage>> m_frameTimer; |
168 int m_repetitionCount; // How many total animation loops we should do. This
will be cAnimationNone if this image type is incapable of animation. | 168 int m_repetitionCount; // How many total animation loops we should do. This
will be cAnimationNone if this image type is incapable of animation. |
169 RepetitionCountStatus m_repetitionCountStatus; | 169 RepetitionCountStatus m_repetitionCountStatus; |
170 int m_repetitionsComplete; // How many repetitions we've finished. | 170 int m_repetitionsComplete; // How many repetitions we've finished. |
171 double m_desiredFrameStartTime; // The system time at which we hope to see
the next call to startAnimation(). | 171 double m_desiredFrameStartTime; // The system time at which we hope to see
the next call to startAnimation(). |
172 | 172 |
173 size_t m_frameCount; | 173 size_t m_frameCount; |
174 | 174 |
175 ImageAnimationPolicy m_animationPolicy; // Whether or not we can play animat
ion. | 175 ImageAnimationPolicy m_animationPolicy; // Whether or not we can play animat
ion. |
176 | 176 |
177 bool m_animationFinished : 1; // Whether or not we've completed the entire a
nimation. | 177 bool m_animationFinished : 1; // Whether or not we've completed the entire a
nimation. |
178 | 178 |
179 bool m_allDataReceived : 1; // Whether or not we've received all our data. | 179 bool m_allDataReceived : 1; // Whether or not we've received all our data. |
180 mutable bool m_haveSize : 1; // Whether or not our |m_size| member variable
has the final overall image size yet. | 180 mutable bool m_haveSize : 1; // Whether or not our |m_size| member variable
has the final overall image size yet. |
181 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi
rst image frame yet from ImageIO. | 181 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi
rst image frame yet from ImageIO. |
182 mutable bool m_haveFrameCount : 1; | 182 mutable bool m_haveFrameCount : 1; |
183 }; | 183 }; |
184 | 184 |
185 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); | 185 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); |
186 | 186 |
187 } // namespace blink | 187 } // namespace blink |
188 | 188 |
189 #endif | 189 #endif |
OLD | NEW |