| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // stream. In these cases we should just loop once. | 76 // stream. In these cases we should just loop once. |
| 77 if (isAllDataReceived() && parseCompleted() && m_reader->imagesCount() == 1) | 77 if (isAllDataReceived() && parseCompleted() && m_reader->imagesCount() == 1) |
| 78 m_repetitionCount = cAnimationNone; | 78 m_repetitionCount = cAnimationNone; |
| 79 else if (failed() || (m_reader && (!m_reader->imagesCount()))) | 79 else if (failed() || (m_reader && (!m_reader->imagesCount()))) |
| 80 m_repetitionCount = cAnimationLoopOnce; | 80 m_repetitionCount = cAnimationLoopOnce; |
| 81 else if (m_reader && m_reader->loopCount() != cLoopCountNotSeen) | 81 else if (m_reader && m_reader->loopCount() != cLoopCountNotSeen) |
| 82 m_repetitionCount = m_reader->loopCount(); | 82 m_repetitionCount = m_reader->loopCount(); |
| 83 return m_repetitionCount; | 83 return m_repetitionCount; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool GIFImageDecoder::frameIsCompleteAtIndex(size_t index) const | 86 bool GIFImageDecoder::frameIsFullyReceivedAtIndex(size_t index) const |
| 87 { | 87 { |
| 88 return m_reader && (index < m_reader->imagesCount()) && m_reader->frameConte
xt(index)->isComplete(); | 88 ASSERT(haveUpdatedFrameCount()); |
| 89 return (m_reader && (index < m_reader->imagesCount()) && m_reader->frameCont
ext(index)->isComplete()) |
| 90 || ImageDecoder::frameIsFullyReceivedAtIndex(index); |
| 89 } | 91 } |
| 90 | 92 |
| 91 float GIFImageDecoder::frameDurationAtIndex(size_t index) const | 93 float GIFImageDecoder::frameDurationAtIndex(size_t index) const |
| 92 { | 94 { |
| 93 return (m_reader && (index < m_reader->imagesCount()) && | 95 return (m_reader && (index < m_reader->imagesCount()) && |
| 94 m_reader->frameContext(index)->isHeaderDefined()) ? | 96 m_reader->frameContext(index)->isHeaderDefined()) ? |
| 95 m_reader->frameContext(index)->delayTime() : 0; | 97 m_reader->frameContext(index)->delayTime() : 0; |
| 96 } | 98 } |
| 97 | 99 |
| 98 bool GIFImageDecoder::setFailed() | 100 bool GIFImageDecoder::setFailed() |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 ImageFrame* buffer = &m_frameBufferCache[index]; | 291 ImageFrame* buffer = &m_frameBufferCache[index]; |
| 290 const GIFFrameContext* frameContext = m_reader->frameContext(index); | 292 const GIFFrameContext* frameContext = m_reader->frameContext(index); |
| 291 buffer->setOriginalFrameRect(intersection(frameContext->frameRect(), IntRect
(IntPoint(), size()))); | 293 buffer->setOriginalFrameRect(intersection(frameContext->frameRect(), IntRect
(IntPoint(), size()))); |
| 292 buffer->setDuration(frameContext->delayTime()); | 294 buffer->setDuration(frameContext->delayTime()); |
| 293 buffer->setDisposalMethod(frameContext->getDisposalMethod()); | 295 buffer->setDisposalMethod(frameContext->getDisposalMethod()); |
| 294 buffer->setRequiredPreviousFrameIndex(findRequiredPreviousFrame(index, false
)); | 296 buffer->setRequiredPreviousFrameIndex(findRequiredPreviousFrame(index, false
)); |
| 295 } | 297 } |
| 296 | 298 |
| 297 void GIFImageDecoder::decode(size_t index) | 299 void GIFImageDecoder::decode(size_t index) |
| 298 { | 300 { |
| 299 parse(GIFFrameCountQuery); | 301 ASSERT(haveUpdatedFrameCount()); |
| 300 | |
| 301 if (failed()) | 302 if (failed()) |
| 302 return; | 303 return; |
| 303 | 304 |
| 304 Vector<size_t> framesToDecode; | 305 Vector<size_t> framesToDecode; |
| 305 size_t frameToDecode = index; | 306 size_t frameToDecode = index; |
| 306 do { | 307 do { |
| 307 framesToDecode.append(frameToDecode); | 308 framesToDecode.append(frameToDecode); |
| 308 frameToDecode = m_frameBufferCache[frameToDecode].requiredPreviousFrameI
ndex(); | 309 frameToDecode = m_frameBufferCache[frameToDecode].requiredPreviousFrameI
ndex(); |
| 309 } while (frameToDecode != kNotFound && m_frameBufferCache[frameToDecode].get
Status() != ImageFrame::FrameComplete); | 310 } while (frameToDecode != kNotFound && m_frameBufferCache[frameToDecode].get
Status() != ImageFrame::FrameComplete); |
| 310 | 311 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 369 |
| 369 // Update our status to be partially complete. | 370 // Update our status to be partially complete. |
| 370 buffer->setStatus(ImageFrame::FramePartial); | 371 buffer->setStatus(ImageFrame::FramePartial); |
| 371 | 372 |
| 372 // Reset the alpha pixel tracker for this frame. | 373 // Reset the alpha pixel tracker for this frame. |
| 373 m_currentBufferSawAlpha = false; | 374 m_currentBufferSawAlpha = false; |
| 374 return true; | 375 return true; |
| 375 } | 376 } |
| 376 | 377 |
| 377 } // namespace blink | 378 } // namespace blink |
| OLD | NEW |