Bug 99326 - In Skia's ImageFrame, only set the isOpaque flag when the frame is complete
Summary: In Skia's ImageFrame, only set the isOpaque flag when the frame is complete
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mike Reed
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-15 07:55 PDT by Mike Reed
Modified: 2012-10-16 07:56 PDT (History)
7 users (show)

See Also:


Attachments
Patch (3.48 KB, patch)
2012-10-15 08:01 PDT, Mike Reed
no flags Details | Formatted Diff | Diff
Patch (4.30 KB, patch)
2012-10-15 08:48 PDT, Mike Reed
no flags Details | Formatted Diff | Diff
Patch (4.44 KB, patch)
2012-10-15 09:50 PDT, Mike Reed
no flags Details | Formatted Diff | Diff
Patch (4.45 KB, patch)
2012-10-15 14:10 PDT, Mike Reed
no flags Details | Formatted Diff | Diff
Patch (4.45 KB, patch)
2012-10-15 14:12 PDT, Mike Reed
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Reed 2012-10-15 07:55:48 PDT
In Skia's ImageFrame, only set the isOpaque flag when the frame is complete
Comment 1 Mike Reed 2012-10-15 08:01:14 PDT
Created attachment 168712 [details]
Patch
Comment 2 Peter Beverloo (cr-android ews) 2012-10-15 08:34:24 PDT
Comment on attachment 168712 [details]
Patch

Attachment 168712 [details] did not pass cr-android-ews (chromium-android):
Output: http://queues.webkit.org/results/14292761
Comment 3 Stephen White 2012-10-15 08:36:37 PDT
Looks like this is missing some .h changes?

+abarth for his image decoder expertise.
Comment 4 Mike Reed 2012-10-15 08:48:29 PDT
Created attachment 168724 [details]
Patch
Comment 5 Mike Reed 2012-10-15 08:49:14 PDT
forgot to upload change to ImageDecoder.h
Comment 6 Stephen White 2012-10-15 09:23:08 PDT
Comment on attachment 168724 [details]
Patch

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

This looks reasonable to me, but I'll leave for Adam in case he has any comments.

> Source/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp:55
> +    setHasAlpha(other.hasAlpha());

Is it important that you do the new special logic here? If so, it seems that m_status must be initialized before this is called.  Perhaps you should add a comment to that effect.
Comment 7 Adam Barth 2012-10-15 09:25:41 PDT
> This looks reasonable to me, but I'll leave for Adam in case he has any comments.

Looks reasonable to me too.
Comment 8 Mike Reed 2012-10-15 09:50:34 PDT
Created attachment 168731 [details]
Patch
Comment 9 Mike Reed 2012-10-15 09:51:07 PDT
patch #3 adds comment about calling setHasAlpha after calling setStatus.
Comment 10 Stephen White 2012-10-15 10:00:17 PDT
Comment on attachment 168731 [details]
Patch

OK (bots willing).  r=me
Comment 11 WebKit Review Bot 2012-10-15 14:01:59 PDT
Comment on attachment 168731 [details]
Patch

Rejecting attachment 168731 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1

ERROR: /mnt/git/webkit-commit-queue/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://queues.webkit.org/results/14291783
Comment 12 Mike Reed 2012-10-15 14:10:23 PDT
Created attachment 168776 [details]
Patch
Comment 13 Mike Reed 2012-10-15 14:10:46 PDT
reloaded with OOPS. PTAL
Comment 14 Stephen White 2012-10-15 14:11:57 PDT
Comment on attachment 168776 [details]
Patch

Once more, with feeling.  r=me  (Sadly, I think you might need the exclamation mark too).
Comment 15 Mike Reed 2012-10-15 14:12:44 PDT
Created attachment 168777 [details]
Patch
Comment 16 Mike Reed 2012-10-15 14:13:02 PDT
OOPS!
Comment 17 Stephen White 2012-10-15 14:14:06 PDT
Comment on attachment 168777 [details]
Patch

<insert Bill Murray here>  r=me
Comment 18 WebKit Review Bot 2012-10-15 15:15:49 PDT
Comment on attachment 168777 [details]
Patch

Clearing flags on attachment: 168777

Committed r131370: <http://trac.webkit.org/changeset/131370>
Comment 19 WebKit Review Bot 2012-10-15 15:15:53 PDT
All reviewed patches have been landed.  Closing bug.
Comment 20 noel gordon 2012-10-16 07:34:19 PDT
(In reply to comment #19)
> All reviewed patches have been landed.  Closing bug.

And landed by the time this got to me.
Comment 21 noel gordon 2012-10-16 07:49:35 PDT
Comment on attachment 168777 [details]
Patch

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

> Source/WebCore/ChangeLog:12
> +

Really don't understand these comments (lines 8-11); the tests are passing last I looked.

> Source/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp:74
> +    m_hasAlpha = true;

So if we returned and had to paint the image buffer here, would the opaque setting of m_bitmap be correct given you set m_hasAlpha = true here, viz., would m_bitmap.bitmap().isOpaque() return false at this time.  It's not clear to me where the opaque value was initialized for the m_bitmap, but one of this function or the class constructor seems wrong.
Comment 22 Mike Reed 2012-10-16 07:56:29 PDT
Comment on attachment 168777 [details]
Patch

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

>> Source/WebCore/ChangeLog:12
>> +
> 
> Really don't understand these comments (lines 8-11); the tests are passing last I looked.

This is a chicken-egg problem. We have a hack in skia that works around this bug. If I remove that hack, DRT has tests that will fail, so I have to first fix the webkit code and then do the 2nd half of the fix in skia. If I did the changes in the other order, the tests would fail.. until I also landed the webkit change.

>> Source/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp:74
>> +    m_hasAlpha = true;
> 
> So if we returned and had to paint the image buffer here, would the opaque setting of m_bitmap be correct given you set m_hasAlpha = true here, viz., would m_bitmap.bitmap().isOpaque() return false at this time.  It's not clear to me where the opaque value was initialized for the m_bitmap, but one of this function or the class constructor seems wrong.

We will *never* set skia's opaque bit until the image-decode statis FrameComplete, so yes, isOpaque will be false if we stopped right after zeroing, but didn't complete the decode.

I guess we could call setHasAlpha(true) instead of setting this field directly. Might be clearer. I'm not sure that there is a real bug, but I'd be fine with making that change as a new CL.