OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 | 217 |
218 return true; | 218 return true; |
219 } | 219 } |
220 | 220 |
221 size_t GIFImageDecoder::clearCacheExceptFrame(size_t clearExceptFrame) | 221 size_t GIFImageDecoder::clearCacheExceptFrame(size_t clearExceptFrame) |
222 { | 222 { |
223 // We need to preserve frames such that: | 223 // We need to preserve frames such that: |
224 // 1. We don't clear |clearExceptFrame|; | 224 // 1. We don't clear |clearExceptFrame|; |
225 // 2. We don't clear any frame from which a future initFrameBuffer() call | 225 // 2. We don't clear any frame from which a future initFrameBuffer() call |
226 // will copy bitmap data. | 226 // will copy bitmap data. |
227 // All other frames can be cleared. | 227 // All other frames can be cleared. |
Peter Kasting
2016/01/15 21:57:57
Nit: Change this comment as follows, then follow m
aleksandar.stojiljkovic
2016/01/16 07:09:35
Done.
| |
228 size_t clearExceptFrame2 = kNotFound; | |
229 if (clearExceptFrame < m_frameBufferCache.size()) { | |
230 const ImageFrame& frame = m_frameBufferCache[clearExceptFrame]; | |
231 if ((frame.status() != ImageFrame::FrameEmpty) && (frame.disposalMethod( ) == ImageFrame::DisposeOverwritePrevious)) { | |
232 clearExceptFrame2 = clearExceptFrame; | |
233 clearExceptFrame = frame.requiredPreviousFrameIndex(); | |
234 } | |
235 } | |
228 while ((clearExceptFrame < m_frameBufferCache.size()) && (m_frameBufferCache [clearExceptFrame].status() == ImageFrame::FrameEmpty)) | 236 while ((clearExceptFrame < m_frameBufferCache.size()) && (m_frameBufferCache [clearExceptFrame].status() == ImageFrame::FrameEmpty)) |
Peter Kasting
2016/01/15 21:57:57
Nit: Now add a blank line above this and then this
aleksandar.stojiljkovic
2016/01/16 07:09:35
Done.
| |
229 clearExceptFrame = m_frameBufferCache[clearExceptFrame].requiredPrevious FrameIndex(); | 237 clearExceptFrame = m_frameBufferCache[clearExceptFrame].requiredPrevious FrameIndex(); |
238 return clearCacheExceptTwoFrames(clearExceptFrame, clearExceptFrame2); | |
239 } | |
230 | 240 |
231 return ImageDecoder::clearCacheExceptFrame(clearExceptFrame); | 241 |
242 size_t GIFImageDecoder::clearCacheExceptTwoFrames(size_t clearExceptFrame1, size _t clearExceptFrame2) | |
243 { | |
244 size_t frameBytesCleared = 0; | |
245 for (size_t i = 0; i < m_frameBufferCache.size(); ++i) { | |
246 if (m_frameBufferCache[i].status() != ImageFrame::FrameEmpty && i != cle arExceptFrame1 && i != clearExceptFrame2) { | |
247 frameBytesCleared += frameBytesAtIndex(i); | |
248 clearFrameBuffer(i); | |
249 } | |
250 } | |
251 return frameBytesCleared; | |
232 } | 252 } |
233 | 253 |
234 void GIFImageDecoder::clearFrameBuffer(size_t frameIndex) | 254 void GIFImageDecoder::clearFrameBuffer(size_t frameIndex) |
235 { | 255 { |
236 if (m_reader && m_frameBufferCache[frameIndex].status() == ImageFrame::Frame Partial) { | 256 if (m_reader && m_frameBufferCache[frameIndex].status() == ImageFrame::Frame Partial) { |
237 // Reset the state of the partial frame in the reader so that the frame | 257 // Reset the state of the partial frame in the reader so that the frame |
238 // can be decoded again when requested. | 258 // can be decoded again when requested. |
239 m_reader->clearDecodeState(frameIndex); | 259 m_reader->clearDecodeState(frameIndex); |
240 } | 260 } |
241 ImageDecoder::clearFrameBuffer(frameIndex); | 261 ImageDecoder::clearFrameBuffer(frameIndex); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 | 355 |
336 // Update our status to be partially complete. | 356 // Update our status to be partially complete. |
337 buffer->setStatus(ImageFrame::FramePartial); | 357 buffer->setStatus(ImageFrame::FramePartial); |
338 | 358 |
339 // Reset the alpha pixel tracker for this frame. | 359 // Reset the alpha pixel tracker for this frame. |
340 m_currentBufferSawAlpha = false; | 360 m_currentBufferSawAlpha = false; |
341 return true; | 361 return true; |
342 } | 362 } |
343 | 363 |
344 } // namespace blink | 364 } // namespace blink |
OLD | NEW |