globalCompositeOperation not applied when draw made with degenerate non-invertible transform

NEW
Unassigned

Status

()

8 years ago
4 years ago

People

(Reporter: jamesr, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [good first bug], URL)

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.36 (KHTML, like Gecko) Chrome/13.0.767.1 Safari/534.36
Build Identifier: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:6.0a1) Gecko/20110523 Firefox/6.0a1

Code snippet:

  c.globalCompositeOperation = "source-over";
  c.fillStyle="blue";
  c.fillRect(0, 0, 100, 100);
  c.globalCompositeOperation = "destination-in";
  c.scale(0, 0);
  c.fillStyle = "red";
  c.fillRect(10, 30, 20, 20);

See URL for demo.

The second fillRect() call is made with a scale to 0, 0 and should result in the shape being transformed to a 0-width, 0-height rectangle.  The composite step should then draw a 0, 0 sized rectangle into an infinite large black bitmap (which is a no-op) and then apply the composite operation for destination-in to the whole canvas, clearing it.  I suspect that the draw is being ignored completely since the CTM is not invertible, but that's not a safe optimization when the globalCompositeOperation is destination-in.

Opera 10.62 on my box does clear the entire canvas and I just reviewed a patch to WebKit to do the same (assuming that it doesn't have bugs).

Reproducible: Always
Status: UNCONFIRMED → NEW
Ever confirmed: true
Nice bug :-)
Whiteboard: [good first bug]

Comment 2

5 years ago
In Firefox, I see a blank canvas, while in Chrome, I see a blue square (from the link). Which is the expected behavior? From the description, I believe FF may have already fixed this.

Updated

5 years ago
Whiteboard: [good first bug] → [good first bug][exterminationweek]

Updated

4 years ago
Whiteboard: [good first bug][exterminationweek] → [good first bug]
You need to log in before you can comment on or make changes to this bug.