[cairo] New guards for cairo_xlib_surface_create_with_xrender_format()

Carl Worth cworth at cworth.org
Wed Apr 2 07:54:40 PDT 2008


On Wed, 02 Apr 2008 11:34:07 +0100, Chris Wilson wrote:
> In cairo-xlib-surface.c::_get_image_surface(), if the XImage is not in a
> supported pixman format, then we require information stored in the
> surface's Visual to convert the pixel data into an appropriate pixman
> format. If the user creates a surface via
> cairo_xlib_surface_create_with_xrender_format(), then no Visual is
> associated with the surface and hence fallback can not be performed
> should the format be unsupported.
>
> Is it preferable to prevent such surfaces being created in the first
> place?

No, I don't think that's what we want to do at all.

If there's a XRender format then we've got masks. And in that case all
we're missing is visual->class to test it for TrueColor. But I think
we get to assume that all XRender formats are TrueColor anyway, (is
that true Keith?), in which case we just need to make the TrueColor
test work for either an XRender format or a visual and then make sure
we fetch the masks from the same place.

Or another approach would be to just ensure we never have a NULL
visual in the surface. For example, if it is NULL, then we could map
from the XRenderPictFormat to a visual in create_internal. Perhaps
that would be looping over appropriate visuals and calling
XRenderFindVisualFormat until we get back the format we started
with. An approach like that would be guaranteed to work, wouldn't it
Keith?

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080402/b5e15936/attachment.pgp 


More information about the cairo mailing list