Bug 93244

Summary: [Cairo] canvas/philip/tests/2d.drawImage.self.2.html test failing on ports using Cairo
Product: WebKit Reporter: Sudarsana Nagineni (babu) <naginenis>
Component: CanvasAssignee: Dominik Röttsches (drott) <d-r>
Status: RESOLVED FIXED    
Severity: Normal CC: d-r, gustavo, gyuyoung.kim, kenneth, mrobinson, rakuco, s.choi, webkit.review.bot, zan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Copying buffer when src and dst are identical.
none
Copying buffer when src and dst are identical, v2. none

Description Sudarsana Nagineni (babu) 2012-08-06 02:39:16 PDT
canvas/philip/tests/2d.drawImage.self.2.html test failing on ports using Cairo. The failure looks like this:

--- WebKit/WebKitBuild/Release/layout-test-results/canvas/philip/tests/2d.drawImage.self.2-expected.txt
+++ WebKit/WebKitBuild/Release/layout-test-results/canvas/philip/tests/2d.drawImage.self.2-actual.txt
@@ -1 +1,2 @@
-Passed
+Failed assertion: got pixel [255,0,0,255] at (0,49), expected [0,255,0,255] +/- 2
+Failed assertion: got pixel [255,0,0,255] at (99,49), expected [0,255,0,255] +/- 2
Comment 1 Dominik Röttsches (drott) 2012-08-13 06:09:48 PDT
https://bugs.webkit.org/show_bug.cgi?id=54458#c7 has some insight:
# When drawing canvas into itself, WebCore draws canvas's buffer into the same buffer. This
# results in recursive drawing into cairo surface. We should either use groups when drawing
# with cairo or copy the buffer every time the HTMLCanvasElement gets repainted.
canvas/philip/tests/2d.drawImage.self.2.html
Comment 2 Dominik Röttsches (drott) 2012-08-13 10:49:51 PDT
Created attachment 158040 [details]
Copying buffer when src and dst are identical.
Comment 3 Kenneth Rohde Christiansen 2012-08-13 10:55:21 PDT
Comment on attachment 158040 [details]
Copying buffer when src and dst are identical.

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

> Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp:99
> +void ImageBuffer::draw(GraphicsContext* destContext, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect,

why not write it out destinationContext or just destination.
Comment 4 Dominik Röttsches (drott) 2012-08-13 11:11:14 PDT
Created attachment 158048 [details]
Copying buffer when src and dst are identical, v2.
Comment 5 Dominik Röttsches (drott) 2012-08-13 11:12:19 PDT
Thanks Kenneth, updated patch with review comment addressed.
Comment 6 WebKit Review Bot 2012-08-13 12:09:56 PDT
Comment on attachment 158048 [details]
Copying buffer when src and dst are identical, v2.

Clearing flags on attachment: 158048

Committed r125432: <http://trac.webkit.org/changeset/125432>
Comment 7 WebKit Review Bot 2012-08-13 12:10:02 PDT
All reviewed patches have been landed.  Closing bug.