UNCONFIRMED 94190
Make the API of ImageDecoder decode a frame explicitly.
https://bugs.webkit.org/show_bug.cgi?id=94190
Summary Make the API of ImageDecoder decode a frame explicitly.
Dongseong Hwang
Reported 2012-08-15 23:11:12 PDT
This is a preparation for asynchronous image decoding. Asynchronous image decoding needs to query a frame, alpha, duration and completion without triggering image decoding. So this patch seperates image decoding from the query functions. Introduced ImageDecoder::decodeAtIndex. We must call decodeAtIndex() to decode the given frame. ImageDecoder::frameBufferAtIndex does not decode the frame anymore and just returns the given frame buffer if it is cached. This change delegates ImageSource::frameDurationAtIndex and ImageSource::frameIsCompleteAtIndex to ImageDecoder. It is more natural for ImageDecoder to return meta data as r125154 delegated ImageSource::frameHasAlphaAtIndex to ImageSource. For example, GIFImageDecoder can return a specific duration value, but other ImageDecoders always return 0. Currently, both queries of ImageSource trigger image decoding. This change also makes both methods of ImageDecoder not decode anymore, and just return the cached meta data of the requested frame as ImageDecoder::frameHasAlphaAtIndex has done since r125154. SynchronousImage uses frameIsCompleteAtIndex(), so SynchronousImage is changed to explicitly call ImageSource::requestFrameAtIndex before calling ImageSource::frameIsCompleteAtIndex because ImageSource::frameIsCompleteAtIndex does not decode. These query methods are also used by BitmapImage::didDecodeFrameAtIndex. Currently BitmapImage::didDecodeFrameAtIndex does not correctly use both methods, because didDecodeFrameAtIndex() is a callback function for asynchronous image decoding and both methods in didDecodeFrameAtIndex() decode the frame synchronously, which will cause an unexpected behavior after implementing asynchronous image decoder. This change fixes a potential bug in BitmapImage::didDecodeFrameAtIndex.
Attachments
Patch (30.92 KB, patch)
2012-08-15 23:21 PDT, Dongseong Hwang
no flags
Dongseong Hwang
Comment 1 2012-08-15 23:21:16 PDT
Andreas Kling
Comment 2 2014-02-05 10:50:41 PST
Comment on attachment 158717 [details] Patch Clearing review flag on patches from before 2014. If this patch is still relevant, please reset the r? flag.
Note You need to log in before you can comment on or make changes to this bug.