[cairo] [PATCH] xcb: Query the display's subpixel order via RENDER

Bryce Harrington bryce at osg.samsung.com
Wed Jan 14 19:22:15 PST 2015


On Sat, Dec 06, 2014 at 05:10:33PM +0100, Uli Schlachter wrote:
> Am 06.12.2014 um 16:13 schrieb Uli Schlachter:
> [...]
> > +static int _get_screen_index(cairo_xcb_connection_t *xcb_connection,
> > +			     xcb_screen_t *xcb_screen)
> > +{
> > +    int idx = 0;
> > +    xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_connection->root);
> > +    for (; iter.rem; xcb_screen_next(&iter), idx++)
> > +	if (iter.data == xcb_screen)
> > +	    return idx;
> > +
> > +    ASSERT_NOT_REACHED;
> > +}
> [...]
> 
> If only things were so easy...
> 
> I changed the "if" in this function to:
> 
>   if (iter.data->root == xcb_screen->root)
> 
> The reason for this is left as an exercise for the reader.
> Oh and I also have another, completely unrelated patch.

Hi Uli,

Both of these patches look fine to me.  Would you like me to test and
land them, or are you hoping for further feedback first?

Bryce
 
> Cheers,
> Uli
> 
> 
> From c068f67ecaa5d756fcad249fea3745daae65d210 Mon Sep 17 00:00:00 2001
> From: Uli Schlachter <psychon at znc.in>
> Date: Sat, 6 Dec 2014 17:04:07 +0100
> Subject: [PATCH] xlib-xcb: Don't be lazy and use the real xcb_screen_t
> 
> Signed-off-by: Uli Schlachter <psychon at znc.in>
> ---
>  src/cairo-xlib-xcb-surface.c | 33 ++++++++++++++++++---------------
>  1 file changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/src/cairo-xlib-xcb-surface.c b/src/cairo-xlib-xcb-surface.c
> index 9c0d4b4..af3e155 100644
> --- a/src/cairo-xlib-xcb-surface.c
> +++ b/src/cairo-xlib-xcb-surface.c
> @@ -519,21 +519,6 @@ cairo_xlib_surface_create (Display     *dpy,
>  								     width, height));
>  }
>  
> -cairo_surface_t *
> -cairo_xlib_surface_create_for_bitmap (Display  *dpy,
> -				      Pixmap	bitmap,
> -				      Screen   *scr,
> -				      int	width,
> -				      int	height)
> -{
> -    return _cairo_xlib_xcb_surface_create (dpy, scr, NULL, NULL,
> -					   cairo_xcb_surface_create_for_bitmap (XGetXCBConnection (dpy),
> -										(xcb_screen_t *) scr,
> -										bitmap,
> -										width, height));
> -}
> -
> -#if CAIRO_HAS_XLIB_XRENDER_SURFACE
>  static xcb_screen_t *
>  _cairo_xcb_screen_from_root (xcb_connection_t *connection,
>  			     xcb_window_t id)
> @@ -548,6 +533,24 @@ _cairo_xcb_screen_from_root (xcb_connection_t *connection,
>  
>      return NULL;
>  }
> +
> +cairo_surface_t *
> +cairo_xlib_surface_create_for_bitmap (Display  *dpy,
> +				      Pixmap	bitmap,
> +				      Screen   *scr,
> +				      int	width,
> +				      int	height)
> +{
> +    xcb_connection_t *connection = XGetXCBConnection (dpy);
> +    xcb_screen_t *screen = _cairo_xcb_screen_from_root (connection, (xcb_window_t) scr->root);
> +    return _cairo_xlib_xcb_surface_create (dpy, scr, NULL, NULL,
> +					   cairo_xcb_surface_create_for_bitmap (connection,
> +										screen,
> +										bitmap,
> +										width, height));
> +}
> +
> +#if CAIRO_HAS_XLIB_XRENDER_SURFACE
>  cairo_surface_t *
>  cairo_xlib_surface_create_with_xrender_format (Display		    *dpy,
>  					       Drawable		    drawable,
> -- 
> 2.1.3
> 
> -- 
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list