Closed Bug 433235 Opened 13 years ago Closed 13 years ago

drawImage of canvas onto self is incorrect


(Core :: Canvas: 2D, defect, P2)

Windows Vista





(Reporter: philip, Assigned: vlad)




(Keywords: regression, verified1.9.0.2, Whiteboard: [RC2-])


(1 file, 2 obsolete files)

When drawing a canvas onto an overlapping region of itself, changes in an output row are read back in as input when drawing later rows, resulting in incorrect output.

HTML5 says "Note: When a canvas is drawn onto itself, the drawing model requires the source to be copied before the image is drawn back onto the canvas, so it is possible to copy parts of a canvas onto overlapping parts of itself."

Fails in current nightly on Windows (2008051011) and Linux (2008051104). Passes in (at least) FF2.0.0.14 on Linux, and FF3 beta 5 on Windows. (I guess this is a regression from bug 430873.)
Flags: blocking1.9?
Keywords: regression
Confirmed to fail on today's Windows but pass on today's mac nightly.  Vlad can you take a look to figure out if this is urgent?
Assignee: nobody → vladimir
Attached patch patch (obsolete) — Splinter Review
Here's a patch, but pretty sure this isn't urgent -- it's not all that common of an operation.  I'm updating my build to make sure this fixes it, but the patch builds and should.
(This is actually quite possibly a bug inside cairo, since it's supposed to handle this case; but either way the workaround is easy.)
Priority: -- → P2
Whiteboard: [RC2?
Given comment 2 taking off the blocking list.  If we have to do an RC2 for other reasons we can take this.  Note [RC2?] is what we'll use on whiteboard for bugs like this.
Flags: blocking1.9? → blocking1.9-
Whiteboard: [RC2? → [RC2?]
Attachment #320445 - Flags: review?(pavlov) → review+
Attached patch same patch with mochitest (obsolete) — Splinter Review
roc, how's this mochitest look?
Attachment #320478 - Flags: review?(roc)
Comment on attachment 320478 [details] [diff] [review]
same patch with mochitest

Looks OK if you make the canvas element 300x150
Attachment #320478 - Flags: review?(roc) → review+
Comment on attachment 320478 [details] [diff] [review]
same patch with mochitest

Putting on the approval queue so that it can get picked up for an RC2 if one comes about.
Attachment #320478 - Flags: approval1.9?
Same patch, just with the tweak to the test in case someone other than me needs to check it in.
Attachment #320445 - Attachment is obsolete: true
Attachment #320478 - Attachment is obsolete: true
Attachment #320592 - Flags: review+
Attachment #320592 - Flags: approval1.9?
Attachment #320478 - Flags: approval1.9?
Whiteboard: [RC2?] → [RC2-]
Attachment #320592 - Flags: approval1.9? → approval1.9.0.1?
Attachment #320592 - Flags: approval1.9.0.1? → approval1.9.0.2?
Closed: 13 years ago
Resolution: --- → FIXED
Comment on attachment 320592 [details] [diff] [review]
patch with test tweak

Approved for Please land in CVS. a=ss
Attachment #320592 - Flags: approval1.9.0.2? → approval1.9.0.2+
Checking in content/canvas/src/nsCanvasRenderingContext2D.cpp;
/cvsroot/mozilla/content/canvas/src/nsCanvasRenderingContext2D.cpp,v  <--  nsCanvasRenderingContext2D.cpp
new revision: 1.128; previous revision: 1.127
Checking in content/canvas/test/;
/cvsroot/mozilla/content/canvas/test/,v  <--
new revision: 1.12; previous revision: 1.11
RCS file: /cvsroot/mozilla/content/canvas/test/test_2d.drawImage.self.html,v
Checking in content/canvas/test/test_2d.drawImage.self.html;
/cvsroot/mozilla/content/canvas/test/test_2d.drawImage.self.html,v  <--  test_2d.drawImage.self.html
initial revision: 1.1
Keywords: fixed1.9.0.2
verified fixed on the 1.9.0 branch using Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/2008082005 GranParadiso/3.0.2pre. I verified using the test case in the URL.
You need to log in before you can comment on or make changes to this bug.