Bug 94190 - Make the API of ImageDecoder decode a frame explicitly.
Summary: Make the API of ImageDecoder decode a frame explicitly.
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 93467
Blocks: 90375 93590
  Show dependency treegraph
 
Reported: 2012-08-15 23:11 PDT by Dongseong Hwang
Modified: 2014-02-05 10:50 PST (History)
3 users (show)

See Also:


Attachments
Patch (30.92 KB, patch)
2012-08-15 23:21 PDT, Dongseong Hwang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dongseong Hwang 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.
Comment 1 Dongseong Hwang 2012-08-15 23:21:16 PDT
Created attachment 158717 [details]
Patch
Comment 2 Andreas Kling 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.