Comment 6 for bug 263661

Revision history for this message
In , Zweinberg (zweinberg) wrote :

Created an attachment (id=351955)
test case

The attached test case takes an 1x2 pixel image and stretches it horizontally to several hundred pixels wide, several times (with different stretch distances). On Linux, some of the green lines will show black dots at the far right. If you change the zoom level, the dots change size jump from one line to another, and at some zoom levels there are also black lines at the bottom of each image. I have anecdotal reports that similar image artifacts are highly visible with Ubuntu 8.10's build of Firefox 3.0.x (not sure which point revision) when playing the browser-hosted game at www.kingdomofloathing.com, so this is not merely a problem for contrived test cases.

The artifacts arise because, on Linux, we are trying to avoid the use of the CAIRO_EXTEND_PAD source filter because it takes a slow fallback path. Instead, we use nearest-neighbor image scaling, on the theory that that will never sample pixels outside the image. As this test case demonstrates, that theory is incorrect.

I will shortly attach a patch which uses EXTEND_PAD universally and modifies the Cairo library to turn on accelerated handling of this mode when the X server supports it. (Render protocol 0.10 - available in X.org server 1.5 - includes support for EXTEND_PAD and it appears to work when I make the library aware of it.) I'd be happy to see a fix that don't involve a major performance hit on older X servers but I have been unable to think of one.

(I suspect this test case, or a slight modification, will also show artifacts at some zoom levels on Mac, because we are also not using EXTEND_PAD there - in that case not for performance but because someone had the erroneous impression that EXTEND_PAD is the default on Mac. Code inspection suggests that Cairo does implement EXTEND_PAD correctly and speedily on Mac.)