Checking if frame is complete and access duration doesn't need a decode
authorossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2013 08:44:38 +0000 (08:44 +0000)
committerossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jun 2013 08:44:38 +0000 (08:44 +0000)
commitff64257fb67dd8e8484788383ecaad2d97579d51
tree26741147b91a203976fca7ffc43b4ad1c9db6ec6
parentc5eea083a7e259f0323cfcfbab5dd6cb02b46995
Checking if frame is complete and access duration doesn't need a decode
https://bugs.webkit.org/show_bug.cgi?id=116041

Reviewed by Allan Sandfeld Jensen.

This change is to avoid image decoding for these two operations:
1. frameIsCompleteAtIndex
2. frameDurationAtIndex
These two operations are moved to ImageDecoder interface and are now const
to prevent future regression.

We are now able to check if a frame is complete by parsing the entire GIF file
without decoding. This also provides information like frame duration such that
controller the animation doesn't require any decoding.

Based on the Blink patch by Hin-Chung Lam <hclam@google.com>
https://src.chromium.org/viewvc/blink?revision=149883&view=revision

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::frameIsCompleteAtIndex):
(WebCore::BitmapImage::frameDurationAtIndex):
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::frameDurationAtIndex):
(WebCore::ImageSource::frameHasAlphaAtIndex):
(WebCore::ImageSource::frameIsCompleteAtIndex):
* platform/graphics/ImageSource.h:
* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageDecoder::frameHasAlphaAtIndex):
(WebCore::ImageDecoder::frameIsCompleteAtIndex):
* platform/image-decoders/ImageDecoder.h:
(WebCore::ImageDecoder::frameDurationAtIndex):
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::frameIsCompleteAtIndex):
(WebCore::GIFImageDecoder::frameDurationAtIndex):
(WebCore::GIFImageDecoder::haveDecodedRow):
(WebCore::GIFImageDecoder::gifComplete):
(WebCore::GIFImageDecoder::decode):
(WebCore::GIFImageDecoder::initFrameBuffer):
* platform/image-decoders/gif/GIFImageDecoder.h:
* platform/image-decoders/gif/GIFImageReader.h:
(GIFImageReader::frameContext):
(GIFImageReader::parseCompleted):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/ImageSource.cpp
Source/WebCore/platform/graphics/ImageSource.h
Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp
Source/WebCore/platform/image-decoders/ImageDecoder.cpp
Source/WebCore/platform/image-decoders/ImageDecoder.h
Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp
Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.h
Source/WebCore/platform/image-decoders/gif/GIFImageReader.h