diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-28 16:22:49 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-30 17:52:13 +0000 |
commit | 2555f83b11ee23829cfdeaae703420ca3e572fa1 (patch) | |
tree | 4a4a00d6acfc709c6cc7057d0e88b66ae5df0bf9 /src | |
parent | 0d0c6a199c5b631299c72dce80d66ac0f4936a64 (diff) |
[xlib] Avoid repeated calls to XRenderQueryVersion
Use the value determined during display initialisation in order to avoid
redundant XRenderQueryFormats requests.
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo-xlib-display.c | 6 | ||||
-rw-r--r-- | src/cairo-xlib-private.h | 2 | ||||
-rw-r--r-- | src/cairo-xlib-surface.c | 7 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/cairo-xlib-display.c b/src/cairo-xlib-display.c index 5e6dba11..3c835f67 100644 --- a/src/cairo-xlib-display.c +++ b/src/cairo-xlib-display.c @@ -214,7 +214,7 @@ _cairo_xlib_display_get (Display *dpy) cairo_xlib_display_t *display; cairo_xlib_display_t **prev; XExtCodes *codes; - int major_unused, minor_unused; + int render_major, render_minor; /* There is an apparent deadlock between this mutex and the * mutex for the display, but it's actually safe. For the @@ -257,7 +257,7 @@ _cairo_xlib_display_get (Display *dpy) * add our hook. For now, that means Render, so we call into its * QueryVersion function to ensure it gets initialized. */ - XRenderQueryVersion (dpy, &major_unused, &minor_unused); + XRenderQueryVersion (dpy, &render_major, &render_minor); codes = XAddExtension (dpy); if (codes == NULL) { @@ -279,6 +279,8 @@ _cairo_xlib_display_get (Display *dpy) display->close_display_hooks = NULL; display->closed = FALSE; + display->render_major = render_major; + display->render_minor = render_minor; memset (display->cached_xrender_formats, 0, sizeof (display->cached_xrender_formats)); diff --git a/src/cairo-xlib-private.h b/src/cairo-xlib-private.h index 79cd6b56..4b0a94d6 100644 --- a/src/cairo-xlib-private.h +++ b/src/cairo-xlib-private.h @@ -64,6 +64,8 @@ struct _cairo_xlib_display { Display *display; cairo_xlib_screen_info_t *screens; + int render_major; + int render_minor; XRenderPictFormat *cached_xrender_formats[CAIRO_FORMAT_A1 + 1]; cairo_xlib_job_t *workqueue; diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 154e89c7..c8988381 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -2561,11 +2561,8 @@ _cairo_xlib_surface_create_internal (Display *dpy, surface->close_display_hook.func = _cairo_xlib_surface_detach_display; _cairo_xlib_add_close_display_hook (display, &surface->close_display_hook); - if (! XRenderQueryVersion (dpy, &surface->render_major, &surface->render_minor)) { - surface->render_major = -1; - surface->render_minor = -1; - } - + surface->render_major = display->render_major; + surface->render_minor = display->render_minor; if (CAIRO_SURFACE_RENDER_HAS_CREATE_PICTURE (surface)) { if (!xrender_format) { if (visual) { |