Bug 18821

Summary: Canvas putImageData incorrect when data has alpha
Product: WebKit Reporter: Philip Taylor <excors>
Component: DOMAssignee: Dave Hyatt <hyatt>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows Vista   
URL: http://philip.html5.org/tests/canvas/misc/alpha-putimagedata.html
Attachments:
Description Flags
Fix bugs in the loops of both get and putImageData
hyatt: review-
Fix bugs in the loops of both get and putImageData
eric: review+
Patch to fix the bug eric: review+

Description Philip Taylor 2008-04-30 18:31:11 PDT
See test case in URL. It draws a very-transparent red column on the left, then fills the rest of the canvas with slightly-transparent green, then calls putImageData(getImageData(...), ...) which should have no effect.

Expected output: alert box saying "0,255,0,254" (or maybe 253), alert box saying "0,255,0,254" (or maybe 253), green canvas.

Actual output: alert box saying "0,255,0,253", alert box saying "255,0,0,253", red canvas.

Tested on Windows r32574.
Comment 1 Dave Hyatt 2008-05-01 11:50:41 PDT
Created attachment 20914 [details]
Fix bugs in the loops of both get and putImageData
Comment 2 Dave Hyatt 2008-05-01 11:51:57 PDT
Created attachment 20915 [details]
Fix bugs in the loops of both get and putImageData
Comment 3 Eric Seidel (no email) 2008-05-01 19:41:15 PDT
Comment on attachment 20915 [details]
Fix bugs in the loops of both get and putImageData

Needs a test case and changelog when you land.  Otherwise fine.
Comment 4 Dave Hyatt 2008-05-05 11:19:38 PDT
Created attachment 20971 [details]
Patch to fix the bug
Comment 5 Eric Seidel (no email) 2008-05-05 11:27:45 PDT
Comment on attachment 20971 [details]
Patch to fix the bug

Looks saner.  Still needs a ChangeLog when landing.
Comment 6 Dave Hyatt 2008-05-05 11:29:58 PDT
Fixed in r32878.