| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 // Called before accessing m_frames[index]. Returns false on index out of bo
unds. | 128 // Called before accessing m_frames[index]. Returns false on index out of bo
unds. |
| 129 bool ensureFrameIsCached(size_t index); | 129 bool ensureFrameIsCached(size_t index); |
| 130 | 130 |
| 131 // Returns the total number of bytes allocated for all framebuffers, i.e. | 131 // Returns the total number of bytes allocated for all framebuffers, i.e. |
| 132 // the sum of m_source.frameBytesAtIndex(...) for all frames. This is | 132 // the sum of m_source.frameBytesAtIndex(...) for all frames. This is |
| 133 // returned as an int for caller convenience, to allow safely subtracting | 133 // returned as an int for caller convenience, to allow safely subtracting |
| 134 // the values from successive calls as signed expressions. | 134 // the values from successive calls as signed expressions. |
| 135 int totalFrameBytes(); | 135 int totalFrameBytes(); |
| 136 | 136 |
| 137 // Called to invalidate cached data. When |destroyAll| is true, we wipe out | 137 // Called to wipe out the entire frame buffer cache and tell the image |
| 138 // the entire frame buffer cache and tell the image source to destroy | 138 // source to destroy everything; this is used when e.g. we want to free |
| 139 // everything; this is used when e.g. we want to free some room in the image | 139 // some room in the image cache. |
| 140 // cache. If |destroyAll| is false, we delete frames except the current | 140 void destroyDecodedData() override; |
| 141 // frame; this is used while animating large images to keep memory footprint | |
| 142 // low; the decoder should preserve the current frame and may preserve some | |
| 143 // other frames to avoid redecoding the whole image on every frame. | |
| 144 void destroyDecodedData(bool destroyAll) override; | |
| 145 | |
| 146 // If the image is large enough, calls destroyDecodedData(). | |
| 147 void destroyDecodedDataIfNecessary(); | |
| 148 | 141 |
| 149 // Notifies observers that the memory footprint has changed. | 142 // Notifies observers that the memory footprint has changed. |
| 150 void notifyMemoryChanged(int delta); | 143 void notifyMemoryChanged(int delta); |
| 151 | 144 |
| 152 // Whether or not size is available yet. | 145 // Whether or not size is available yet. |
| 153 bool isSizeAvailable(); | 146 bool isSizeAvailable(); |
| 154 | 147 |
| 155 // Animation. | 148 // Animation. |
| 156 int repetitionCount(bool imageKnownToBeComplete); // |imageKnownToBeComplet
e| should be set if the caller knows the entire image has been decoded. | 149 int repetitionCount(bool imageKnownToBeComplete); // |imageKnownToBeComplet
e| should be set if the caller knows the entire image has been decoded. |
| 157 bool shouldAnimate(); | 150 bool shouldAnimate(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi
rst image frame yet from ImageIO. | 182 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi
rst image frame yet from ImageIO. |
| 190 mutable bool m_hasUniformFrameSize : 1; | 183 mutable bool m_hasUniformFrameSize : 1; |
| 191 mutable bool m_haveFrameCount : 1; | 184 mutable bool m_haveFrameCount : 1; |
| 192 }; | 185 }; |
| 193 | 186 |
| 194 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); | 187 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); |
| 195 | 188 |
| 196 } // namespace blink | 189 } // namespace blink |
| 197 | 190 |
| 198 #endif | 191 #endif |
| OLD | NEW |