[cairo] 16-bit precision issues in cairo

Robert O'Callahan rocallahan at novell.com
Tue Aug 16 20:07:57 PDT 2005

On Fri, 2005-08-12 at 09:33 -0400, Owen Taylor wrote:
> Pick a random book on Project Gutenberg, bring it up as a single HTML
> file in your web browser. This is equivalent to cutting all the pages
> in the book apart and arranging them into a single scroll... 115 feet
> isn't ridiculous for that.
> Now, scroll to the middle and try to clear the background of that 
> web-page using cairo_rectangle(), cairo_fill().
> Assuming that the web browser is double-buffering, it doesn't actually
> render it to the window, but to a reasonable size pixmap, but reasonable
> app code will try to draw a rectangle with bounds something like:
>  [0,-50000,10,100000]
> Generally, *rendering* to areas outside the 16-bit coordinate space is
> is uninteresting. But rendering *primitives* larger than 16-bits
> is quite natural and normal.
> We've seen quite a few reports of problems with GTK+ which has the
> limitations of X for rendering primitives larger than 16-bits. 
> People create gigantic windows for scrolling, then try to draw
> lines or rectangles across the entire window.

Hear hear! What Owen says is *exactly* what happens to us in Mozilla in
real life. We work around it by doing clamping in our own graphics
wrappers, but it sucks. (16-bit widget offsets hurt even more but that's
not cairo's problem.) It would actually suck a lot *more* for us to fix
this around cairo since we'd have to apply the current CTM, clamp, and
transform back.

It's straightforward to avoid rendering content that doesn't intersect
the viewport, but that doesn't help with Owen's example.


More information about the cairo mailing list