Closed Bug 503283 Opened 15 years ago Closed 14 years ago

"unbounded" globalCompositeOperations are terribly broken

Categories

(Core :: Graphics: Canvas2D, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.1 --- ?

People

(Reporter: emk, Assigned: emk)

References

()

Details

(Keywords: regression)

Attachments

(2 files, 1 obsolete file)

Build ID:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090708 Minefield/3.6a1pre
Steps to reproduce:
See the above URL.
Actual result:
source-in, source-out, destination-in, and destination-atop are not rendered at all.
Expected result:
Some sort of composition result should be rendered.

Fx 3.5 (Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.1) Gecko/20090624 Firefox/3.5) also fails. Fx 3.0.11 (Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11) seems to work.
Flags: wanted1.9.1.x?
drawImage() or shadows cause this problem.
# fill() or stroke() look OK.

I attached modified version (using fill()) of "URL" testcase.
That doesn't cause the problem.
Oops, I attached shadow testcase!
This one uses fill().
Comment on attachment 387637 [details]
testcase using drawImage() and shadow (broken)

This uses shadow not fill()
Attachment #387637 - Attachment description: testcase using fill() (not broken) → testcase using shadow (broken)
Comment #1 seems to be a different problem.
2007072505 not rendered at all (me.mozDrawText is not a function)
2007072517 cvs trunk: works
2008022002 mozilla-central: not rendered at all (ctx.fillText is not a function)
2008022005 cvs trunk: works
2008052006 cvs trunk: works
2008052103 mozilla-central: not rendered at all
2008061012 mozilla-central: not rendered at all
2008061107 mozilla-central: broken
I was unable to spot a regression range due to mercurial transition...
Sorry, I confused a bit...

drawImage() causes the problem.
shadows does not cause the problem.

(In reply to comment #1)
> Another failing example:
> http://uupaa-js-spinoff.googlecode.com/svn/trunk/uuCanvas.js/demo1/5_1_canvas_savestate+shadow.html

This is not failed.

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-globalcompositeoperation
> source-out
>     A out B. Display the source image wherever the source image is opaque and the destination image is transparent. Display transparency elsewhere.

Both "green shadow" and "red shadow" are rendered twice, but first one of them are cleared when rendering "blue shadow".
Attachment #387637 - Attachment description: testcase using shadow (broken) → testcase using drawImage() and shadow (broken)
Attachment #387637 - Attachment is obsolete: true
(In reply to comment #8)
> Both "green shadow" and "red shadow" are rendered twice, but first one of them
> are cleared when rendering "blue shadow".
All other browsers (Opera 9, Safari 4, Chrome 2, and even Fx3) doesn't clear the first "green shadow" and "red shadow". Is it an incorrect behaviour per spec?
(In reply to comment #9)
> (In reply to comment #8)
> > Both "green shadow" and "red shadow" are rendered twice, but first one of them
> > are cleared when rendering "blue shadow".
> All other browsers (Opera 9, Safari 4, Chrome 2, and even Fx3) doesn't clear
> the first "green shadow" and "red shadow". Is it an incorrect behaviour per
> spec?

In these browsers source-in, source-out,... operators are "bounded".
# ... Display transparency elsewhere covered by the source image.
But after bug 462938 (cairo 1.8.x?) these are "unbounded".
# ... Display transparency elsewhere.

http://cairographics.org/operators/
I found SVG Compositing calls them as clip-to-self property.
http://www.w3.org/TR/SVGCompositing/#clip-to-self
However, even if the operators are "unbounded", the "URL" testcase doesn't look correct to me.
If the operaters are "unbounded", It should get the similar result as Opera.
http://d.hatena.ne.jp/chaperatta/20080614/1213454680
(In reply to comment #11)
> However, even if the operators are "unbounded", the "URL" testcase doesn't look
> correct to me.
> If the operaters are "unbounded", It should get the similar result as Opera.
> http://d.hatena.ne.jp/chaperatta/20080614/1213454680

Yes. The "URL" testcase doesn't work well for Firefox 3.5 and later.
It uses drawImage() (source is an image) and drawImage() seems cause this problem.
# 
# The testcase I attached uses fill() (source is a path) and its result seems OK.
# -> It seems like the cause of this bug is the handling of images.
nsCanvasRenderingContext2D::DrawImage() calls UpdateSurfaceClip()
http://hg.mozilla.org/releases/mozilla-1.9.1/annotate/f223409207c0/content/canvas/src/nsCanvasRenderingContext2D.cpp#l2983
which trys to fill the empty rect.
http://hg.mozilla.org/releases/mozilla-1.9.1/annotate/f223409207c0/gfx/thebes/src/gfxContext.cpp#l627
Then the entire canvas will be cleared out because the operator is "unbounded".
-    // XXX cairo bug workaround; force a clip update on mThebes.
This workaround is now useless or even harmful. Bug 346421 and bug 347379 didn't regress.

-        // XXX certain operators cause 2d.composite.uncovered.* tests to fail
I don't know the exact reason why OperatorAffectsUncoveredAreas was temporarily disabled, but 2d.composite.uncovered.* tests failed without enabling it (as the comment indicates).
Assignee: nobody → VYV03354
Status: NEW → ASSIGNED
Attachment #388920 - Flags: review?(vladimir)
Summary: Some globalCompositeOperation are terribly broken → "unbounded" globalCompositeOperations are terribly broken
status1.9.1: --- → ?
Flags: wanted1.9.1.x?
Fixed by bug 599698 and bug 600120.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment on attachment 388920 [details] [diff] [review]
remove old workarounds

Canceling review request of an obsolete patch.
Attachment #388920 - Flags: review?(vladimir)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: