Last Comment Bug 347458 - drawImage and clip() cause more bad clipping
: drawImage and clip() cause more bad clipping
: testcase
Product: Core
Classification: Components
Component: Canvas: 2D (show other bugs)
: Trunk
: x86 Windows 2000
-- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Lee Salzman [:lsalzman]
Depends on:
  Show dependency treegraph
Reported: 2006-08-04 16:56 PDT by Philip Taylor
Modified: 2008-03-04 15:44 PST (History)
4 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

test case (1.25 KB, text/html)
2006-08-04 16:57 PDT, Philip Taylor
no flags Details

Description User image Philip Taylor 2006-08-04 16:56:54 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1b1) Gecko/20060804 BonEcho/2.0b1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1b1) Gecko/20060804 BonEcho/2.0b1

In 1.8.1: When drawing an image, and then creating a path which is not an integer-aligned rectangle and then setting it as the clipping path, it actually ends up with the clipping path being (as far as I can tell) the intersection of that path and the image's destination rectangle. (The image shouldn't affect the clipping path.)

This has regressed somewhere between "Gecko/20060728 Firefox/" and "Gecko/20060710 Firefox/2.0b1". It still fails in the latest 1.8 branch (with the checkin from bug 346421). It does work in "Gecko/20060804 Minefield/3.0a1" (from just before that checkin).

(This is affecting the canvas-using program I'm working on, and I can't think of any particularly nice workaround. I'm actually clipping to a non-rectangular polygon, so I can't just round it to integer coordinates. I suppose I could draw a zero-sized rectangle before the clip path and after the image, which does seem to fix it but doesn't seem like an entirely elegant solution...)

Reproducible: Always

Steps to Reproduce:
1. See test case.

Actual Results:  
There is a black canvas, with a gradient image in the top left corner, and a green rectangle in the bottom right corner of that image (not extending into the black region).

Expected Results:  
The green rectangle should be extending outside the image, and should appear centred on the canvas.
Comment 1 User image Philip Taylor 2006-08-04 16:57:43 PDT
Created attachment 232227 [details]
test case
Comment 2 User image Vladimir Vukicevic [:vlad] [:vladv] (needinfo me, slow to respond) 2006-08-05 16:35:55 PDT
Ugh.  I'll try to fix, but the underlying bug is a pain.. maybe i'll just turn on the workaround on the branch as well.

A non-obvious js-level workaround is to put:


after the drawImage() call.  I'll see if I can make this unnecessary.
Comment 3 User image Joe Drew (not getting mail) 2008-03-04 15:44:47 PST
This WFM on trunk, and I assume we're not going to be making any branch changes.

Note You need to log in before you can comment on or make changes to this bug.