| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "platform/image-decoders/gif/GIFImageDecoder.h" | 26 #include "platform/image-decoders/gif/GIFImageDecoder.h" |
| 27 | 27 |
| 28 #include <limits> |
| 28 #include "platform/image-decoders/gif/GIFImageReader.h" | 29 #include "platform/image-decoders/gif/GIFImageReader.h" |
| 29 #include "wtf/NotFound.h" | 30 #include "wtf/NotFound.h" |
| 30 #include "wtf/PtrUtil.h" | 31 #include "wtf/PassOwnPtr.h" |
| 31 #include <limits> | |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 GIFImageDecoder::GIFImageDecoder(AlphaOption alphaOption, GammaAndColorProfileOp
tion colorOptions, size_t maxDecodedBytes) | 35 GIFImageDecoder::GIFImageDecoder(AlphaOption alphaOption, GammaAndColorProfileOp
tion colorOptions, size_t maxDecodedBytes) |
| 36 : ImageDecoder(alphaOption, colorOptions, maxDecodedBytes) | 36 : ImageDecoder(alphaOption, colorOptions, maxDecodedBytes) |
| 37 , m_repetitionCount(cAnimationLoopOnce) | 37 , m_repetitionCount(cAnimationLoopOnce) |
| 38 { | 38 { |
| 39 } | 39 } |
| 40 | 40 |
| 41 GIFImageDecoder::~GIFImageDecoder() | 41 GIFImageDecoder::~GIFImageDecoder() |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 if (index >= m_frameBufferCache.size() - 1 && isAllDataReceived() && m_reade
r && !m_reader->parseCompleted()) | 324 if (index >= m_frameBufferCache.size() - 1 && isAllDataReceived() && m_reade
r && !m_reader->parseCompleted()) |
| 325 setFailed(); | 325 setFailed(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void GIFImageDecoder::parse(GIFParseQuery query) | 328 void GIFImageDecoder::parse(GIFParseQuery query) |
| 329 { | 329 { |
| 330 if (failed()) | 330 if (failed()) |
| 331 return; | 331 return; |
| 332 | 332 |
| 333 if (!m_reader) { | 333 if (!m_reader) { |
| 334 m_reader = wrapUnique(new GIFImageReader(this)); | 334 m_reader = adoptPtr(new GIFImageReader(this)); |
| 335 m_reader->setData(m_data); | 335 m_reader->setData(m_data); |
| 336 } | 336 } |
| 337 | 337 |
| 338 if (!m_reader->parse(query)) | 338 if (!m_reader->parse(query)) |
| 339 setFailed(); | 339 setFailed(); |
| 340 } | 340 } |
| 341 | 341 |
| 342 bool GIFImageDecoder::initFrameBuffer(size_t frameIndex) | 342 bool GIFImageDecoder::initFrameBuffer(size_t frameIndex) |
| 343 { | 343 { |
| 344 // Initialize the frame rect in our buffer. | 344 // Initialize the frame rect in our buffer. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 368 | 368 |
| 369 // Update our status to be partially complete. | 369 // Update our status to be partially complete. |
| 370 buffer->setStatus(ImageFrame::FramePartial); | 370 buffer->setStatus(ImageFrame::FramePartial); |
| 371 | 371 |
| 372 // Reset the alpha pixel tracker for this frame. | 372 // Reset the alpha pixel tracker for this frame. |
| 373 m_currentBufferSawAlpha = false; | 373 m_currentBufferSawAlpha = false; |
| 374 return true; | 374 return true; |
| 375 } | 375 } |
| 376 | 376 |
| 377 } // namespace blink | 377 } // namespace blink |
| OLD | NEW |