[cairo] Bug in _cairo_xlib_surface_create_similar

Robert O'Callahan rocallahan at novell.com
Thu May 18 15:28:15 PDT 2006


On Thu, 2006-05-18 at 15:01 -0700, Carl Worth wrote:
> Part of what confused me here was the language "if the display doesn't
> have COMPOSITE" which looks like we're making a choice based on the
> presence of the COMPOSITE extension, which would be totally bogus.
> 
> In fact, though, the code is using a macro:
> 
> 	CAIRO_SURFACE_RENDER_HAS_COMPOSITE
> 
> which is checking whether the Composite request within the RENDER
> extension is available. That macro name is definitely not as clear as
> it could be, but in my defense, I think I wrote it before the
> COMPOSITE extension existed.
> 
> Owen's criticism still stands in a general sense---we shouldn't
> prevent the X server from choosing how it will perform rendering. But
> what we're detecting here is an X server that doesn't have the RENDER
> extension at all, so by definition it can't make smart decisions about
> how to implement RENDER operations.
> 
> Returning the image surface might still prevent some cairo
> optimizations from working well, (such as the XCopyArea stuff), but I
> think the non-RENDER X server case is uninteresting enough that I
> don't care.
> 
> Although I do think I'd prefer to not make special cases for things
> like this if haven't tested whether they actually help. That clutters
> the code and makes a misleading impression that we're doing something
> intentionally. (I checked and the original logic to return an image
> surface for a non-Render X server is mine, but I called it a "pretty
> lame heuristic" while Owen recast it as a "good first approximation
> later, (see below)).

My goal with putting that test in was simply to preserve the existing
behaviour of falling back to image surfaces if the Render extension does
not have Composite. I agree the comment isn't good. I certainly won't
object if you want to take that behaviour out.

Rob



More information about the cairo mailing list