Bug 90445 - Add a comment in order to clarify why BitmapImage::frameHasAlphaAtIndex returns true as default.
Summary: Add a comment in order to clarify why BitmapImage::frameHasAlphaAtIndex retur...
Status: RESOLVED FIXED
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:
Blocks:
 
Reported: 2012-07-03 04:14 PDT by Dongseong Hwang
Modified: 2012-07-03 22:19 PDT (History)
3 users (show)

See Also:


Attachments
patch (1.42 KB, patch)
2012-07-03 04:16 PDT, Dongseong Hwang
no flags Details | Formatted Diff | Diff
patch v.2 (1.84 KB, patch)
2012-07-03 04:26 PDT, Dongseong Hwang
no flags Details | Formatted Diff | Diff
patch v.3 (2.07 KB, patch)
2012-07-03 18:29 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-07-03 04:14:29 PDT
Add an assertion and a comment in order to clarify the states of BitmapImage.
Comment 1 Dongseong Hwang 2012-07-03 04:16:20 PDT
Created attachment 150577 [details]
patch
Comment 2 Dongseong Hwang 2012-07-03 04:18:14 PDT
Comment on attachment 150577 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=150577&action=review

> Source/WebCore/platform/graphics/BitmapImage.cpp:312
> +    ASSERT(m_frames[index].m_isComplete);

All case that call this method is guarded by if(isComplete).

> Source/WebCore/platform/graphics/BitmapImage.cpp:326
> +    // black.

The comment was copied from ImageSource::frameHasAlphaAtIndex(size_t index)
Comment 3 Dongseong Hwang 2012-07-03 04:26:50 PDT
Created attachment 150579 [details]
patch v.2
Comment 4 Dongseong Hwang 2012-07-03 04:27:09 PDT
Comment on attachment 150579 [details]
patch v.2

View in context: https://bugs.webkit.org/attachment.cgi?id=150579&action=review

> Source/WebCore/platform/graphics/BitmapImage.cpp:322
> +    // When a frame has not finished decoding, always mark it as having alpha.

The comment was copied from ImageSource::frameHasAlphaAtIndex(size_t index)
Comment 5 Dongseong Hwang 2012-07-03 05:00:56 PDT
(In reply to comment #0)
> Add an assertion and a comment in order to clarify the states of BitmapImage.

I removed the assertion in patch v.2 because I misunderstood at the time to patch v.1.
Comment 6 Dongseong Hwang 2012-07-03 15:54:55 PDT
(In reply to comment #4)
> (From update of attachment 150579 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=150579&action=review
> 
> > Source/WebCore/platform/graphics/BitmapImage.cpp:322
> > +    // When a frame has not finished decoding, always mark it as having alpha.
> 
> The comment was copied from ImageSource::frameHasAlphaAtIndex(size_t index)

The comment of ImageSource::frameHasAlphaAtIndex is long, so I pasted just summary of the comment to BitmapImage::frameHasAlphaAtIndex.

bool ImageSource::frameHasAlphaAtIndex(ImageFrame* buffer)
{
    // When a frame has not finished decoding, always mark it as having alpha.
    // Ports that check the result of this function to determine their
    // compositing op need this in order to not draw the undecoded portion as
    // black.
    // TODO: Perhaps we should ensure that each individual decoder returns true
    // in this case.
    return !frameIsCompleteAtIndex(buffer) || buffer->hasAlpha();
}
Comment 7 Eric Seidel (no email) 2012-07-03 16:57:37 PDT
Comment on attachment 150579 [details]
patch v.2

View in context: https://bugs.webkit.org/attachment.cgi?id=150579&action=review

>>> Source/WebCore/platform/graphics/BitmapImage.cpp:322
>>> +    // When a frame has not finished decoding, always mark it as having alpha.
>> 
>> The comment was copied from ImageSource::frameHasAlphaAtIndex(size_t index)
> 
> The comment of ImageSource::frameHasAlphaAtIndex is long, so I pasted just summary of the comment to BitmapImage::frameHasAlphaAtIndex.
> 
> bool ImageSource::frameHasAlphaAtIndex(ImageFrame* buffer)
> {
>     // When a frame has not finished decoding, always mark it as having alpha.
>     // Ports that check the result of this function to determine their
>     // compositing op need this in order to not draw the undecoded portion as
>     // black.
>     // TODO: Perhaps we should ensure that each individual decoder returns true
>     // in this case.
>     return !frameIsCompleteAtIndex(buffer) || buffer->hasAlpha();
> }

You should add a line that said:
// See ImageSource::framehasAlphaAtIndex for explanation of why incomplete images claim to have alpha.
Comment 8 Dongseong Hwang 2012-07-03 18:29:04 PDT
Created attachment 150704 [details]
patch v.3

Absolutely!
Comment 9 WebKit Review Bot 2012-07-03 22:19:44 PDT
Comment on attachment 150704 [details]
patch v.3

Clearing flags on attachment: 150704

Committed r121827: <http://trac.webkit.org/changeset/121827>
Comment 10 WebKit Review Bot 2012-07-03 22:19:49 PDT
All reviewed patches have been landed.  Closing bug.