[cairo] Re: cairo gradients

David Reveman davidr at novell.com
Wed Apr 19 04:22:23 PDT 2006


On Tue, 2006-04-18 at 09:33 -0700, Carl Worth wrote:
> On Tue, 18 Apr 2006 11:00:21 +0100, Jonathan Watt wrote:
> > David Reveman wrote:
> > > For the pixman backend, X server backend and glitz backend the results
> > > are undefined when some part of the inner circle is outside the outer
> > > circle. In general cairo tries to expose as few cases as possible that
> > > can result in undefined results
> 
> Yes, cairo definitely does want to avoid undefined behavior.
> 
> I didn't realize that that was what we got when the smaller circle
> intersects or is outside the larger circle.
> 
> There shouldn't be any requirement for undefined behavior here. For
> example, PDF provides a two-circle specification of a radial gradient
> and carefully defines the result when one circle does not entirely
> containt the other, (giving the appearance of inward-pointing cone if
> the first circle is smaller and an outward-pointing code if the first
> circle is larger).
> 
> The PDF semantics seem quite reasonable to me. So if someone wants to
> fix things, I don't see why we wouldn't follow that. We can put the
> new implementation into libpixman and avoid X server gradients when
> they are not compatible, (currently cairo is always avoiding X server
> gradients).

I'm OK with making it not undefined behavior. However, I'll probably not
have time to help fix it anytime soon.

> 
> One thing we really need here is some test cases for the test
> suite. We also need to carefully characterize which versions of which
> X servers can be relied upon to do server-side gradients, (David
> provided a patch for server-side gradients in the past, but it hasn't
> been applied yet---he originally said it shouldn't be applied as X
> servers at the time were crashing when server-side gradients were
> used).

I'm attaching my current patch for server-side gradients, it checks if
Xorg version is greater than 7.0 for server-side gradients to be used.
Except for the undefined behavior, gradients works fine in Xgl. However,
I'm not sure they work correctly in the non-xgl branch of Xorg.
Server-side gradients are a big performance improvement so it would be
nice if they can be enabled when they work correctly.

-David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-xlib-gradients-3.patch
Type: text/x-patch
Size: 10087 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060419/d16446c2/cairo-xlib-gradients-3.bin


More information about the cairo mailing list