Bug 53757

Summary: [Chromium] Issue 58536: Fix Layout Test canvas/philip/tests/2d.imageData.put.alpha.html with --accelerated-2d-canvas.
Product: WebKit Reporter: Naoki Takano <honten>
Component: New BugsAssignee: Naoki Takano <honten>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, commit-queue, darin, eric, honten, hyatt, jamesr, kbr, krit, oliver, senorblanco, simon.fraser, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Naoki Takano 2011-02-03 21:59:48 PST
[Chromium] Issue 58536: Fix Layout Test canvas/philip/tests/2d.imageData.put.alpha.html with --accelerated-2d-canvas.
Comment 1 Naoki Takano 2011-02-03 22:12:25 PST
Created attachment 81189 [details]
Patch
Comment 2 Naoki Takano 2011-02-03 22:16:11 PST
Could you review my patch?
Comment 3 Adam Barth 2011-02-03 22:31:24 PST
This is a bit outside my area of expertise.
Comment 4 Naoki Takano 2011-02-03 23:13:36 PST
Do you know who is the right person?

(In reply to comment #3)
> This is a bit outside my area of expertise.
Comment 5 Adam Barth 2011-02-03 23:27:39 PST
You can try running "webkit-patch suggest-reviewers" on your patch to see which reviewers it suggests.
Comment 6 Adam Barth 2011-02-03 23:29:59 PST
abarth@quadzen:~/svn/webkit3$ ./Tools/Scripts/webkit-patch suggest-reviewers
Dan Bernstein
David Hyatt
Dirk Schulze
Nikolas Zimmermann
Oliver Hunt
Simon Fraser
James Robinson
Comment 7 Naoki Takano 2011-02-04 00:09:19 PST
Added a couple of people whom Adam recommended.

Could you review my patch?
Comment 8 Naoki Takano 2011-02-05 10:08:05 PST
Is there anybody who can review my patch?
Comment 9 Kenneth Russell 2011-02-07 13:31:52 PST
Comment on attachment 81189 [details]
Patch

I think this fix should go in ImageBufferSkia.cpp rather than in the common code. Conceptually, ImageBuffer::putUnmultipliedImageData is supposed to be unaffected by the CompositeOperator.
Comment 10 Naoki Takano 2011-02-07 14:40:11 PST
Thanks, Kenneth!!

I also uploaded,
https://bugs.webkit.org/show_bug.cgi?id=53857

If you have time, could you review it too?

(In reply to comment #9)
> (From update of attachment 81189 [details])
> I think this fix should go in ImageBufferSkia.cpp rather than in the common code. Conceptually, ImageBuffer::putUnmultipliedImageData is supposed to be unaffected by the CompositeOperator.
Comment 11 Kenneth Russell 2011-02-07 19:03:19 PST
(In reply to comment #10)
> Thanks, Kenneth!!
> 
> I also uploaded,
> https://bugs.webkit.org/show_bug.cgi?id=53857
> 
> If you have time, could you review it too?

Reviewed. Looking forward to revised versions of these two patches to be able to r+ them. Please be sure to set the cq bit to cq? if you want these landed via the commit queue.
Comment 12 Naoki Takano 2011-02-07 21:14:18 PST
Created attachment 81578 [details]
Patch
Comment 13 Naoki Takano 2011-02-07 21:14:57 PST
Comment on attachment 81578 [details]
Patch

Ok, I move the logic to ImageBufferSkia.cpp. Please review.
Comment 14 James Robinson 2011-02-07 21:17:26 PST
Comment on attachment 81578 [details]
Patch

Why should changing the composite operator have any effect on how putImageData works?  If putImageData() is wrong, fix that don't patch putUnmultipliedImageData.
Comment 15 Naoki Takano 2011-02-07 23:20:51 PST
As I wrote in the change log and the comment, syncing between software and hardware doesn't work well if the composite operator is wrong.
As you know, if there is no hardware usage, it looks working fine. But logically putImageData() is wrong because of wrong operator inside. That is my intention for the first patch.

What do you think, Kenneth?

If my intention is right, as James suggested, should we use the first patch?

(In reply to comment #14)
> (From update of attachment 81578 [details])
> Why should changing the composite operator have any effect on how putImageData works?  If putImageData() is wrong, fix that don't patch putUnmultipliedImageData.
Comment 16 Naoki Takano 2011-02-08 09:54:52 PST
After thinking again last night, I flip to the second patch.

Because putUnmultipliedImageData() shouldn't change the result according to the operation as Kenneth says. As you see, putImageData<Unmultiplied>() always overwrite the whole pixels, so the function purpose is "overwriting the destination", it means setCompositeOperation(CompositeDestinationIn) in putUnmultipliedImageData().


What do you think, James?

My and Kenneth's thoughts are wrong?

Thanks,

(In reply to comment #15)
> As I wrote in the change log and the comment, syncing between software and hardware doesn't work well if the composite operator is wrong.
> As you know, if there is no hardware usage, it looks working fine. But logically putImageData() is wrong because of wrong operator inside. That is my intention for the first patch.
> 
> What do you think, Kenneth?
> 
> If my intention is right, as James suggested, should we use the first patch?
> 
> (In reply to comment #14)
> > (From update of attachment 81578 [details] [details])
> > Why should changing the composite operator have any effect on how putImageData works?  If putImageData() is wrong, fix that don't patch putUnmultipliedImageData.
Comment 17 Kenneth Russell 2011-02-08 10:57:04 PST
Looking at this more, I think the bug is that ImageBuffer::putUnmultipliedImageData() (ImageBufferSkia.cpp) is calling PlatformContextSkia::prepareForSoftwareDraw() where it should be calling syncSoftwareCanvas(). (See copyImage() higher in the file.) putPremultipliedImageData() looks like it has a similar bug.
Comment 18 Naoki Takano 2011-02-08 11:23:42 PST
Kenneth,

You are right, I didn't notice the function, syncSoftwareCanvas();-(

Ok, I will replace prepareForSoftwareDraw() to syncSoftwareCanvas() in both putPremultipliedImageda() and putUnmultipliedImageData().

(In reply to comment #17)
> Looking at this more, I think the bug is that ImageBuffer::putUnmultipliedImageData() (ImageBufferSkia.cpp) is calling PlatformContextSkia::prepareForSoftwareDraw() where it should be calling syncSoftwareCanvas(). (See copyImage() higher in the file.) putPremultipliedImageData() looks like it has a similar bug.
Comment 19 Naoki Takano 2011-02-08 19:32:21 PST
Created attachment 81732 [details]
Patch
Comment 20 Naoki Takano 2011-02-08 19:32:39 PST
Comment on attachment 81732 [details]
Patch

Please review again.
Comment 21 Kenneth Russell 2011-02-09 10:40:22 PST
Comment on attachment 81732 [details]
Patch

Looks good to me.
Comment 22 WebKit Commit Bot 2011-02-09 12:06:47 PST
Comment on attachment 81732 [details]
Patch

Clearing flags on attachment: 81732

Committed r78103: <http://trac.webkit.org/changeset/78103>
Comment 23 WebKit Commit Bot 2011-02-09 12:06:53 PST
All reviewed patches have been landed.  Closing bug.
Comment 24 Stephen White 2011-02-10 07:43:00 PST
(In reply to comment #23)
> All reviewed patches have been landed.  Closing bug.

Thanks very much for fixing this!