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 15 matching lines...) Expand all Loading... |
26 #include "platform/image-decoders/gif/GIFImageDecoder.h" | 26 #include "platform/image-decoders/gif/GIFImageDecoder.h" |
27 | 27 |
28 #include "platform/image-decoders/gif/GIFImageReader.h" | 28 #include "platform/image-decoders/gif/GIFImageReader.h" |
29 #include "wtf/NotFound.h" | 29 #include "wtf/NotFound.h" |
30 #include "wtf/PtrUtil.h" | 30 #include "wtf/PtrUtil.h" |
31 #include <limits> | 31 #include <limits> |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 GIFImageDecoder::GIFImageDecoder(AlphaOption alphaOption, | 35 GIFImageDecoder::GIFImageDecoder(AlphaOption alphaOption, |
36 GammaAndColorProfileOption colorOptions, | 36 ColorSpaceOption colorOptions, |
37 size_t maxDecodedBytes) | 37 size_t maxDecodedBytes) |
38 : ImageDecoder(alphaOption, colorOptions, maxDecodedBytes), | 38 : ImageDecoder(alphaOption, colorOptions, maxDecodedBytes), |
39 m_repetitionCount(cAnimationLoopOnce) {} | 39 m_repetitionCount(cAnimationLoopOnce) {} |
40 | 40 |
41 GIFImageDecoder::~GIFImageDecoder() {} | 41 GIFImageDecoder::~GIFImageDecoder() {} |
42 | 42 |
43 void GIFImageDecoder::onSetData(SegmentReader* data) { | 43 void GIFImageDecoder::onSetData(SegmentReader* data) { |
44 if (m_reader) | 44 if (m_reader) |
45 m_reader->setData(data); | 45 m_reader->setData(data); |
46 } | 46 } |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 setFailed(); | 362 setFailed(); |
363 } | 363 } |
364 | 364 |
365 bool GIFImageDecoder::initFrameBuffer(size_t frameIndex) { | 365 bool GIFImageDecoder::initFrameBuffer(size_t frameIndex) { |
366 // Initialize the frame rect in our buffer. | 366 // Initialize the frame rect in our buffer. |
367 ImageFrame* const buffer = &m_frameBufferCache[frameIndex]; | 367 ImageFrame* const buffer = &m_frameBufferCache[frameIndex]; |
368 | 368 |
369 size_t requiredPreviousFrameIndex = buffer->requiredPreviousFrameIndex(); | 369 size_t requiredPreviousFrameIndex = buffer->requiredPreviousFrameIndex(); |
370 if (requiredPreviousFrameIndex == kNotFound) { | 370 if (requiredPreviousFrameIndex == kNotFound) { |
371 // This frame doesn't rely on any previous data. | 371 // This frame doesn't rely on any previous data. |
372 if (!buffer->setSizeAndColorProfile(size().width(), size().height(), | 372 if (!buffer->setSizeAndColorSpace(size().width(), size().height(), nullptr)) |
373 ImageFrame::ICCProfile())) | |
374 return setFailed(); | 373 return setFailed(); |
375 } else { | 374 } else { |
376 ImageFrame* prevBuffer = &m_frameBufferCache[requiredPreviousFrameIndex]; | 375 ImageFrame* prevBuffer = &m_frameBufferCache[requiredPreviousFrameIndex]; |
377 ASSERT(prevBuffer->getStatus() == ImageFrame::FrameComplete); | 376 ASSERT(prevBuffer->getStatus() == ImageFrame::FrameComplete); |
378 | 377 |
379 // We try to reuse |prevBuffer| as starting state to avoid copying. | 378 // We try to reuse |prevBuffer| as starting state to avoid copying. |
380 // For DisposeOverwritePrevious, the next frame will also use | 379 // For DisposeOverwritePrevious, the next frame will also use |
381 // |prevBuffer| as its starting state, so we can't take over its image | 380 // |prevBuffer| as its starting state, so we can't take over its image |
382 // data using takeBitmapDataIfWritable. Copy the data instead. | 381 // data using takeBitmapDataIfWritable. Copy the data instead. |
383 if ((buffer->getDisposalMethod() == ImageFrame::DisposeOverwritePrevious || | 382 if ((buffer->getDisposalMethod() == ImageFrame::DisposeOverwritePrevious || |
(...skipping 12 matching lines...) Expand all Loading... |
396 } | 395 } |
397 | 396 |
398 // Update our status to be partially complete. | 397 // Update our status to be partially complete. |
399 buffer->setStatus(ImageFrame::FramePartial); | 398 buffer->setStatus(ImageFrame::FramePartial); |
400 | 399 |
401 // Reset the alpha pixel tracker for this frame. | 400 // Reset the alpha pixel tracker for this frame. |
402 m_currentBufferSawAlpha = false; | 401 m_currentBufferSawAlpha = false; |
403 return true; | 402 return true; |
404 } | 403 } |
405 } // namespace blink | 404 } // namespace blink |
OLD | NEW |