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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 // Animation. | 134 // Animation. |
135 // We start and stop animating lazily. Animation starts when the image is | 135 // We start and stop animating lazily. Animation starts when the image is |
136 // rendered, and automatically stops once no observer wants to render the | 136 // rendered, and automatically stops once no observer wants to render the |
137 // image. | 137 // image. |
138 int repetitionCount(bool imageKnownToBeComplete); // |imageKnownToBeComplet
e| should be set if the caller knows the entire image has been decoded. | 138 int repetitionCount(bool imageKnownToBeComplete); // |imageKnownToBeComplet
e| should be set if the caller knows the entire image has been decoded. |
139 bool shouldAnimate(); | 139 bool shouldAnimate(); |
140 void startAnimation(CatchUpAnimation = CatchUp) override; | 140 void startAnimation(CatchUpAnimation = CatchUp) override; |
141 void stopAnimation(); | 141 void stopAnimation(); |
142 void advanceAnimation(Timer<BitmapImage>*); | 142 void advanceAnimation(Timer<BitmapImage>*); |
| 143 // Advance the animation and let the next frame get scheduled without |
| 144 // catch-up logic. For large images with slow or heavily-loaded systems, |
| 145 // throwing away data as we go (see destroyDecodedData()) means we can spend |
| 146 // so much time re-decoding data that we are always behind. To prevent this, |
| 147 // we force the next animation to skip the catch up logic. |
| 148 void advanceAnimationWithoutCatchUp(Timer<BitmapImage>*); |
143 | 149 |
144 // Function that does the real work of advancing the animation. When | 150 // Function that does the real work of advancing the animation. When |
145 // skippingFrames is true, we're in the middle of a loop trying to skip over | 151 // skippingFrames is true, we're in the middle of a loop trying to skip over |
146 // a bunch of animation frames, so we should not do things like decode each | 152 // a bunch of animation frames, so we should not do things like decode each |
147 // one or notify our observers. | 153 // one or notify our observers. |
148 // Returns whether the animation was advanced. | 154 // Returns whether the animation was advanced. |
149 bool internalAdvanceAnimation(bool skippingFrames); | 155 bool internalAdvanceAnimation(bool skippingFrames); |
150 | 156 |
151 ImageSource m_source; | 157 ImageSource m_source; |
152 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). |
(...skipping 21 matching lines...) Expand all Loading... |
174 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. |
175 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. |
176 mutable bool m_haveFrameCount : 1; | 182 mutable bool m_haveFrameCount : 1; |
177 }; | 183 }; |
178 | 184 |
179 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); | 185 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); |
180 | 186 |
181 } // namespace blink | 187 } // namespace blink |
182 | 188 |
183 #endif | 189 #endif |
OLD | NEW |