Chromium Code Reviews| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 } | 182 } |
| 183 | 183 |
| 184 bool GIFImageDecoder::parseCompleted() const { | 184 bool GIFImageDecoder::parseCompleted() const { |
| 185 return m_reader && m_reader->parseCompleted(); | 185 return m_reader && m_reader->parseCompleted(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 bool GIFImageDecoder::frameComplete(size_t frameIndex) { | 188 bool GIFImageDecoder::frameComplete(size_t frameIndex) { |
| 189 // Initialize the frame if necessary. Some GIFs insert do-nothing frames, | 189 // Initialize the frame if necessary. Some GIFs insert do-nothing frames, |
| 190 // in which case we never reach haveDecodedRow() before getting here. | 190 // in which case we never reach haveDecodedRow() before getting here. |
| 191 if (!initFrameBuffer(frameIndex)) | 191 if (!initFrameBuffer(frameIndex)) |
| 192 return false; // initFrameBuffer() has already called setFailed(). | 192 return setFailed(); |
| 193 | |
| 194 if (!m_currentBufferSawAlpha) | |
| 195 correctAlphaWhenFrameBufferSawNoAlpha(frameIndex); | |
|
Noel Gordon
2017/03/08 16:26:14
Nod.
| |
| 193 | 196 |
| 194 m_frameBufferCache[frameIndex].setStatus(ImageFrame::FrameComplete); | 197 m_frameBufferCache[frameIndex].setStatus(ImageFrame::FrameComplete); |
| 195 if (!m_currentBufferSawAlpha) | |
| 196 correctAlphaWhenFrameBufferSawNoAlpha(frameIndex); | |
| 197 | 198 |
| 198 return true; | 199 return true; |
| 199 } | 200 } |
| 200 | 201 |
| 201 void GIFImageDecoder::clearFrameBuffer(size_t frameIndex) { | 202 void GIFImageDecoder::clearFrameBuffer(size_t frameIndex) { |
| 202 if (m_reader && | 203 if (m_reader && |
| 203 m_frameBufferCache[frameIndex].getStatus() == ImageFrame::FramePartial) { | 204 m_frameBufferCache[frameIndex].getStatus() == ImageFrame::FramePartial) { |
| 204 // Reset the state of the partial frame in the reader so that the frame | 205 // Reset the state of the partial frame in the reader so that the frame |
| 205 // can be decoded again when requested. | 206 // can be decoded again when requested. |
| 206 m_reader->clearDecodeState(frameIndex); | 207 m_reader->clearDecodeState(frameIndex); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 m_currentBufferSawAlpha = false; | 273 m_currentBufferSawAlpha = false; |
| 273 } | 274 } |
| 274 | 275 |
| 275 bool GIFImageDecoder::canReusePreviousFrameBuffer(size_t frameIndex) const { | 276 bool GIFImageDecoder::canReusePreviousFrameBuffer(size_t frameIndex) const { |
| 276 DCHECK(frameIndex < m_frameBufferCache.size()); | 277 DCHECK(frameIndex < m_frameBufferCache.size()); |
| 277 return m_frameBufferCache[frameIndex].getDisposalMethod() != | 278 return m_frameBufferCache[frameIndex].getDisposalMethod() != |
| 278 ImageFrame::DisposeOverwritePrevious; | 279 ImageFrame::DisposeOverwritePrevious; |
| 279 } | 280 } |
| 280 | 281 |
| 281 } // namespace blink | 282 } // namespace blink |
| OLD | NEW |