| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 return frameBytesCleared; | 147 return frameBytesCleared; |
| 148 } | 148 } |
| 149 | 149 |
| 150 void ImageDecoder::clearFrameBuffer(size_t frameIndex) | 150 void ImageDecoder::clearFrameBuffer(size_t frameIndex) |
| 151 { | 151 { |
| 152 m_frameBufferCache[frameIndex].clearPixelData(); | 152 m_frameBufferCache[frameIndex].clearPixelData(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 size_t ImageDecoder::findRequiredPreviousFrame(size_t frameIndex) | 155 size_t ImageDecoder::findRequiredPreviousFrame(size_t frameIndex, bool frameRect
IsOpaque) |
| 156 { | 156 { |
| 157 ASSERT(frameIndex <= m_frameBufferCache.size()); | 157 ASSERT(frameIndex <= m_frameBufferCache.size()); |
| 158 if (!frameIndex) { | 158 if (!frameIndex) { |
| 159 // The first frame doesn't rely on any previous data. | 159 // The first frame doesn't rely on any previous data. |
| 160 return notFound; | 160 return notFound; |
| 161 } | 161 } |
| 162 | 162 |
| 163 const ImageFrame* currBuffer = &m_frameBufferCache[frameIndex]; |
| 164 if ((frameRectIsOpaque || currBuffer->alphaBlendSource() == ImageFrame::Blen
dAtopBgcolor) |
| 165 && currBuffer->originalFrameRect().contains(IntRect(IntPoint(), size()))
) |
| 166 return notFound; |
| 167 |
| 163 // The starting state for this frame depends on the previous frame's | 168 // The starting state for this frame depends on the previous frame's |
| 164 // disposal method. | 169 // disposal method. |
| 165 size_t prevFrame = frameIndex - 1; | 170 size_t prevFrame = frameIndex - 1; |
| 166 const ImageFrame* prevBuffer = &m_frameBufferCache[prevFrame]; | 171 const ImageFrame* prevBuffer = &m_frameBufferCache[prevFrame]; |
| 167 ASSERT(prevBuffer->requiredPreviousFrameIndexValid()); | 172 ASSERT(prevBuffer->requiredPreviousFrameIndexValid()); |
| 168 | 173 |
| 169 switch (prevBuffer->disposalMethod()) { | 174 switch (prevBuffer->disposalMethod()) { |
| 170 case ImageFrame::DisposeNotSpecified: | 175 case ImageFrame::DisposeNotSpecified: |
| 171 case ImageFrame::DisposeKeep: | 176 case ImageFrame::DisposeKeep: |
| 172 // prevFrame will be used as the starting state for this frame. | 177 // prevFrame will be used as the starting state for this frame. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 186 // Otherwise, the previous frame contributes to this frame. | 191 // Otherwise, the previous frame contributes to this frame. |
| 187 return (prevBuffer->originalFrameRect().contains(IntRect(IntPoint(), siz
e())) | 192 return (prevBuffer->originalFrameRect().contains(IntRect(IntPoint(), siz
e())) |
| 188 || (prevBuffer->requiredPreviousFrameIndex() == notFound)) ? notFoun
d : prevFrame; | 193 || (prevBuffer->requiredPreviousFrameIndex() == notFound)) ? notFoun
d : prevFrame; |
| 189 default: | 194 default: |
| 190 ASSERT_NOT_REACHED(); | 195 ASSERT_NOT_REACHED(); |
| 191 return notFound; | 196 return notFound; |
| 192 } | 197 } |
| 193 } | 198 } |
| 194 | 199 |
| 195 } // namespace WebCore | 200 } // namespace WebCore |
| OLD | NEW |