| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 2001 mozilla.org | 5 * Portions are Copyright (C) 2001 mozilla.org |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Stuart Parmenter <stuart@mozilla.com> | 8 * Stuart Parmenter <stuart@mozilla.com> |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 * version of this file under the LGPL, indicate your decision by | 32 * version of this file under the LGPL, indicate your decision by |
| 33 * deletingthe provisions above and replace them with the notice and | 33 * deletingthe provisions above and replace them with the notice and |
| 34 * other provisions required by the MPL or the GPL, as the case may be. | 34 * other provisions required by the MPL or the GPL, as the case may be. |
| 35 * If you do not delete the provisions above, a recipient may use your | 35 * If you do not delete the provisions above, a recipient may use your |
| 36 * version of this file under any of the LGPL, the MPL or the GPL. | 36 * version of this file under any of the LGPL, the MPL or the GPL. |
| 37 */ | 37 */ |
| 38 | 38 |
| 39 #include "platform/image-decoders/png/PNGImageReader.h" | 39 #include "platform/image-decoders/png/PNGImageReader.h" |
| 40 | 40 |
| 41 #include <memory> | 41 #include <memory> |
| 42 #include "platform/graphics/BitmapImageMetrics.h" |
| 42 #include "platform/image-decoders/FastSharedBufferReader.h" | 43 #include "platform/image-decoders/FastSharedBufferReader.h" |
| 43 #include "platform/image-decoders/SegmentReader.h" | 44 #include "platform/image-decoders/SegmentReader.h" |
| 44 #include "platform/image-decoders/png/PNGImageDecoder.h" | 45 #include "platform/image-decoders/png/PNGImageDecoder.h" |
| 45 #include "wtf/PtrUtil.h" | 46 #include "wtf/PtrUtil.h" |
| 46 #include "zlib.h" | 47 #include "zlib.h" |
| 47 | 48 |
| 48 namespace { | 49 namespace { |
| 49 | 50 |
| 50 inline blink::PNGImageDecoder* imageDecoder(png_structp png) { | 51 inline blink::PNGImageDecoder* imageDecoder(png_structp png) { |
| 51 return static_cast<blink::PNGImageDecoder*>(png_get_progressive_ptr(png)); | 52 return static_cast<blink::PNGImageDecoder*>(png_get_progressive_ptr(png)); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 529 |
| 529 if (isChunk(chunk, "IDAT")) { | 530 if (isChunk(chunk, "IDAT")) { |
| 530 // Done with header chunks. | 531 // Done with header chunks. |
| 531 m_idatOffset = m_readOffset; | 532 m_idatOffset = m_readOffset; |
| 532 m_fctlNeedsDatChunk = false; | 533 m_fctlNeedsDatChunk = false; |
| 533 if (m_ignoreAnimation) | 534 if (m_ignoreAnimation) |
| 534 m_isAnimated = false; | 535 m_isAnimated = false; |
| 535 if (!m_isAnimated || 1 == m_reportedFrameCount) | 536 if (!m_isAnimated || 1 == m_reportedFrameCount) |
| 536 m_decoder->setRepetitionCount(cAnimationNone); | 537 m_decoder->setRepetitionCount(cAnimationNone); |
| 537 m_decoder->headerAvailable(); | 538 m_decoder->headerAvailable(); |
| 539 if (m_isAnimated) { |
| 540 BitmapImageMetrics::countAnimatedImageType( |
| 541 BitmapImageMetrics::AnimatedPNG); |
| 542 } |
| 538 return true; | 543 return true; |
| 539 } | 544 } |
| 540 | 545 |
| 541 // Wait until the entire chunk is available for parsing simplicity. | 546 // Wait until the entire chunk is available for parsing simplicity. |
| 542 if (reader.size() < m_readOffset + length + 12) | 547 if (reader.size() < m_readOffset + length + 12) |
| 543 break; | 548 break; |
| 544 | 549 |
| 545 if (isChunk(chunk, "acTL")) { | 550 if (isChunk(chunk, "acTL")) { |
| 546 if (m_ignoreAnimation) | 551 if (m_ignoreAnimation) |
| 547 continue; | 552 continue; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 break; | 678 break; |
| 674 default: | 679 default: |
| 675 return false; | 680 return false; |
| 676 } | 681 } |
| 677 | 682 |
| 678 m_fctlNeedsDatChunk = true; | 683 m_fctlNeedsDatChunk = true; |
| 679 return true; | 684 return true; |
| 680 } | 685 } |
| 681 | 686 |
| 682 } // namespace blink | 687 } // namespace blink |
| OLD | NEW |