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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 bool frameIsCompleteAtIndex(size_t); | 159 bool frameIsCompleteAtIndex(size_t); |
160 float frameDurationAtIndex(size_t); | 160 float frameDurationAtIndex(size_t); |
161 bool frameHasAlphaAtIndex(size_t); | 161 bool frameHasAlphaAtIndex(size_t); |
162 ImageOrientation frameOrientationAtIndex(size_t); | 162 ImageOrientation frameOrientationAtIndex(size_t); |
163 | 163 |
164 // Decodes and caches a frame. Never accessed except internally. | 164 // Decodes and caches a frame. Never accessed except internally. |
165 void cacheFrame(size_t index); | 165 void cacheFrame(size_t index); |
166 // Called before accessing m_frames[index]. Returns false on index out of bo unds. | 166 // Called before accessing m_frames[index]. Returns false on index out of bo unds. |
167 bool ensureFrameIsCached(size_t index); | 167 bool ensureFrameIsCached(size_t index); |
168 | 168 |
169 // Called to invalidate cached data. When |destroyAll| is true, we wipe out | 169 // Called to invalidate cached data. This is used while animating large |
170 // the entire frame buffer cache and tell the image source to destroy | 170 // images to keep memory footprint low. The decoder may preserve some frames |
171 // everything; this is used when e.g. we want to free some room in the image | 171 // to avoid redecoding the whole image on every frame. |
172 // cache. If |destroyAll| is false, we only delete frames up to the current | 172 virtual void destroyDecodedData() OVERRIDE; |
Peter Kasting
2013/05/29 02:02:18
Nit: I'm a big fan of OVERRIDE, but if we're addin
Xianzhu
2013/05/29 18:37:01
Done.
| |
173 // one; this is used while animating large images to keep memory footprint | |
174 // low without redecoding the whole image on every frame. | |
175 virtual void destroyDecodedData(bool destroyAll = true); | |
176 | 173 |
177 // If the image is large enough, calls destroyDecodedData() and passes | 174 // If the image is large enough, calls destroyDecodedData(). |
178 // |destroyAll| along. | 175 void destroyDecodedDataIfNecessary(); |
179 void destroyDecodedDataIfNecessary(bool destroyAll); | |
180 | 176 |
181 // Generally called by destroyDecodedData(), destroys whole-image metadata | 177 // Generally called by destroyDecodedData(), destroys whole-image metadata |
182 // and notifies observers that the memory footprint has (hopefully) | 178 // and notifies observers that the memory footprint has (hopefully) |
183 // decreased by |frameBytesCleared|. | 179 // decreased by |frameBytesCleared|. |
184 void destroyMetadataAndNotify(unsigned frameBytesCleared); | 180 void destroyMetadataAndNotify(size_t frameBytesCleared); |
185 | 181 |
186 // Whether or not size is available yet. | 182 // Whether or not size is available yet. |
187 bool isSizeAvailable(); | 183 bool isSizeAvailable(); |
188 | 184 |
189 // Called after asking the source for any information that may require | 185 // Called after asking the source for any information that may require |
190 // decoding part of the image (e.g., the image size). We need to report | 186 // decoding part of the image (e.g., the image size). We need to report |
191 // the partially decoded data to our observer so it has an accurate | 187 // the partially decoded data to our observer so it has an accurate |
192 // account of the BitmapImage's memory usage. | 188 // account of the BitmapImage's memory usage. |
193 void didDecodeProperties() const; | 189 void didDecodeProperties() const; |
194 | 190 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 bool m_allDataReceived : 1; // Whether or not we've received all our data. | 236 bool m_allDataReceived : 1; // Whether or not we've received all our data. |
241 mutable bool m_haveSize : 1; // Whether or not our |m_size| member variable has the final overall image size yet. | 237 mutable bool m_haveSize : 1; // Whether or not our |m_size| member variable has the final overall image size yet. |
242 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi rst image frame yet from ImageIO. | 238 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi rst image frame yet from ImageIO. |
243 mutable bool m_hasUniformFrameSize : 1; | 239 mutable bool m_hasUniformFrameSize : 1; |
244 mutable bool m_haveFrameCount : 1; | 240 mutable bool m_haveFrameCount : 1; |
245 }; | 241 }; |
246 | 242 |
247 } | 243 } |
248 | 244 |
249 #endif | 245 #endif |
OLD | NEW |