OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 return ImageSize(frameSizeAtIndex(index)).area * sizeof(ImageFrame::PixelDat a); | 173 return ImageSize(frameSizeAtIndex(index)).area * sizeof(ImageFrame::PixelDat a); |
174 } | 174 } |
175 | 175 |
176 bool ImageDecoder::deferredImageDecodingEnabled() | 176 bool ImageDecoder::deferredImageDecodingEnabled() |
177 { | 177 { |
178 return DeferredImageDecoder::enabled(); | 178 return DeferredImageDecoder::enabled(); |
179 } | 179 } |
180 | 180 |
181 size_t ImageDecoder::clearCacheExceptFrame(size_t clearExceptFrame) | 181 size_t ImageDecoder::clearCacheExceptFrame(size_t clearExceptFrame) |
182 { | 182 { |
183 // Don't clear if there are no frames or only one frame. | 183 // Don't clear if there are no frames or only one frame. |
aleksandar.stojiljkovic
2016/01/12 17:34:59
Copied this code including the comment from here.
| |
184 if (m_frameBufferCache.size() <= 1) | 184 if (m_frameBufferCache.size() <= 1) |
185 return 0; | 185 return 0; |
186 | 186 |
187 size_t frameBytesCleared = 0; | 187 size_t frameBytesCleared = 0; |
188 for (size_t i = 0; i < m_frameBufferCache.size(); ++i) { | 188 for (size_t i = 0; i < m_frameBufferCache.size(); ++i) { |
189 if (i != clearExceptFrame) { | 189 if (i != clearExceptFrame) { |
190 frameBytesCleared += frameBytesAtIndex(i); | 190 frameBytesCleared += frameBytesAtIndex(i); |
191 clearFrameBuffer(i); | 191 clearFrameBuffer(i); |
192 } | 192 } |
193 } | 193 } |
194 return frameBytesCleared; | 194 return frameBytesCleared; |
195 } | 195 } |
196 | 196 |
197 size_t ImageDecoder::clearCacheExceptFrames(const SizeTHashSet& clearExceptFrame s) | |
198 { | |
199 // Don't clear if there are no frames or only one frame. | |
tomhudson
2016/01/12 16:15:59
This comment is backwards. It's nearly obvious fro
aleksandar.stojiljkovic
2016/01/12 17:34:59
Done.
| |
200 if (m_frameBufferCache.size() <= 1) | |
201 return 0; | |
202 | |
203 size_t frameBytesCleared = 0; | |
204 for (size_t i = 0; i < m_frameBufferCache.size(); ++i) { | |
205 if (m_frameBufferCache[i].status() != ImageFrame::FrameEmpty && !clearEx ceptFrames.contains(i)) { | |
206 frameBytesCleared += frameBytesAtIndex(i); | |
207 clearFrameBuffer(i); | |
208 } | |
209 } | |
210 return frameBytesCleared; | |
211 } | |
212 | |
197 void ImageDecoder::clearFrameBuffer(size_t frameIndex) | 213 void ImageDecoder::clearFrameBuffer(size_t frameIndex) |
198 { | 214 { |
199 m_frameBufferCache[frameIndex].clearPixelData(); | 215 m_frameBufferCache[frameIndex].clearPixelData(); |
200 } | 216 } |
201 | 217 |
202 size_t ImageDecoder::findRequiredPreviousFrame(size_t frameIndex, bool frameRect IsOpaque) | 218 size_t ImageDecoder::findRequiredPreviousFrame(size_t frameIndex, bool frameRect IsOpaque) |
203 { | 219 { |
204 ASSERT(frameIndex <= m_frameBufferCache.size()); | 220 ASSERT(frameIndex <= m_frameBufferCache.size()); |
205 if (!frameIndex) { | 221 if (!frameIndex) { |
206 // The first frame doesn't rely on any previous data. | 222 // The first frame doesn't rely on any previous data. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 return m_planes[i]; | 281 return m_planes[i]; |
266 } | 282 } |
267 | 283 |
268 size_t ImagePlanes::rowBytes(int i) const | 284 size_t ImagePlanes::rowBytes(int i) const |
269 { | 285 { |
270 ASSERT((i >= 0) && i < 3); | 286 ASSERT((i >= 0) && i < 3); |
271 return m_rowBytes[i]; | 287 return m_rowBytes[i]; |
272 } | 288 } |
273 | 289 |
274 } // namespace blink | 290 } // namespace blink |
OLD | NEW |