Open Bug 652222 Opened 13 years ago Updated 2 years ago

Pixels are interpolated when drawing parts of a large image

Categories

(Core :: Graphics: Canvas2D, defect)

x86
Windows 7
defect

Tracking

()

People

(Reporter: mail, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1

When drawing an area of a large image (>2048px) to a canvas, without scaling it, some pixels get drawn slightly interpolated, when they should be the exact same as in the source image.

Reproducible: Always

Steps to Reproduce:
Visit: 
http://www.phoboslab.org/****/pixel-bug/fail/
Look at the pink lines on the Target Canvas

Actual Results:  
For the second yellow row, some of the pink lines, marking transparent pixels, are missing.



Expected Results:  
The pink lines under both yellow pixel rows should be exactly identical.

The source image is drawn to the Canvas two times: first in full and then just the last row of pixels of the image (second yellow row on the target canvas).

Both yellow rows (the one from the full image and from just drawing the last row) are then analyzed for transparent pixels (alpha = 0) and marked with a pink line. Some of the pixels for the second yellow row are NOT completely transparent as they should be.

Note that this only seems to happen for large images (>2048px on my machine). Here is a test case with a smaller image that works fine:
http://www.phoboslab.org/****/pixel-bug/ok/

This doesn't:
http://www.phoboslab.org/****/pixel-bug/fail/

This fails in Firefox4 and Internet Explorer 9. Both test cases work fine in Opera, Chrome and Safari.

Screenshots:
http://www.phoboslab.org/****/pixel-bug/screenshots/firefox-large.png <- FAILED
http://www.phoboslab.org/****/pixel-bug/screenshots/firefox-small.png
http://www.phoboslab.org/****/pixel-bug/screenshots/ie9-large.png <- FAILED
http://www.phoboslab.org/****/pixel-bug/screenshots/ie9-small.png
http://www.phoboslab.org/****/pixel-bug/screenshots/chrome-large.png
http://www.phoboslab.org/****/pixel-bug/screenshots/chrome-small.png
http://www.phoboslab.org/****/pixel-bug/screenshots/opera-large.png
http://www.phoboslab.org/****/pixel-bug/screenshots/opera-small.png
Worksforme on Mac.

Given that it also fails in IE9, sounds like it might be a d2d issue.  Does disabling direct2d in about:config make the problem go away?
Yes, disabling Direct2d "fixes" the problem.

I wouldn't care if it was just a visual problem, but in my case a bitmap font was "missing" some characters because the font image wasn't analyzed correctly. This prevented a game from loading at all.

Drawing the whole image - instead of just the last row of pixels - to a canvas seems to be a valid workaround for now.
> Yes, disabling Direct2d "fixes" the problem.

OK, good to know.

Bas, can you take a look?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.