[cairo] [PATCH] Make XCB backend match Xlib

Jamey Sharp jamey at minilop.net
Fri Jun 16 23:16:43 PDT 2006


On Fri, Jun 16, 2006 at 08:23:26AM -0700, Ian Osgood wrote:
> BTW, why does surface_create need to infer its own screen,
> yet create_for_bitmap and create_with_xrender_format
> take screen parameters?

I've just privately forwarded you Keith's original mail explaining this
rationale, from last June. Unfortunately the web archive did poorly with
that message.

Any time you have a DRAWABLE, you can (AFAICT) use a GetGeometry request
plus a little local computation to find its SCREEN pointer. That covers
all three surface creation functions and would get correct results...
but it incurs a round-trip delay on surface creation. If you have a
VISUALTYPE pointer, that's inside the SCREEN you want, so you can get
back to the screen easily. Format and depth can't use that trick though.

> What's the incantation for vim?

I think ':set shiftwidth=4 noexpandtabs' or ':se sw=4 noet' suffices.

> Attached is the revised patch, using git-format-patch.

Thanks! It looked great to me except that I inserted a couple more tabs
because somehow things still weren't indented perfectly. I suspect the
mailing list mangled the patch since your GPG signature didn't verify.
I've pulled out the lines I fixed below.

Anyway, I've pushed your patch plus the formatting fixes.

> @@ -1112,6 +1126,7 @@ query_render_version (XCBConnection *c, 
>  static cairo_surface_t *
>  _cairo_xcb_surface_create_internal (XCBConnection	     *dpy,
>  				    XCBDRAWABLE		      drawable,
> +				    XCBSCREEN	     *screen,
>  				    XCBVISUALTYPE	     *visual,
>  				    XCBRenderPICTFORMINFO    *format,
>  				    int			      width,
> @@ -1286,11 +1330,12 @@ cairo_xcb_surface_create_for_bitmap (XCB
>  cairo_surface_t *
>  cairo_xcb_surface_create_with_xrender_format (XCBConnection	    *c,
>  					      XCBDRAWABLE	     drawable,
> +					      XCBSCREEN	     *screen,
>  					      XCBRenderPICTFORMINFO *format,
>  					      int		     width,
>  					      int		     height)
>  {
> -    return _cairo_xcb_surface_create_internal (c, drawable,
> +    return _cairo_xcb_surface_create_internal (c, drawable, screen,
>  					       NULL, format,
>  					       width, height, 0);
>  }
> diff --git a/src/cairo-xcb-xrender.h b/src/cairo-xcb-xrender.h
> index bb2a79a..ac394d2 100644
> --- a/src/cairo-xcb-xrender.h
> +++ b/src/cairo-xcb-xrender.h
> @@ -49,6 +49,7 @@ CAIRO_BEGIN_DECLS
>  cairo_public cairo_surface_t *
>  cairo_xcb_surface_create_with_xrender_format (XCBConnection	    *c,
>  					      XCBDRAWABLE	     drawable,
> +					      XCBSCREEN	     *screen,
>  					      XCBRenderPICTFORMINFO *format,
>  					      int		     width,
>  					      int		     height);

--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060616/2bfbed0f/attachment.pgp


More information about the cairo mailing list