summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-screen.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-09-02 10:28:17 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-09-02 10:49:12 +0100
commita5d33bcbb43cd1738e45b803c1aa968aff55e7ab (patch)
tree51db966141e4613d1e7edeb341abb19cf6d2a7e9 /src/cairo-xlib-screen.c
parent939b836bfa95df759aca96936bb9a6d89d3130b8 (diff)
[xlib] Keep a pointer to the cairo_xlib_display_t on the surface.
Cleanup the code somewhat by passing cairo_xlib_display_t around internally as opposed to a Display and then having to lookup the corresponding cairo_xlib_display_t each time. [To get a cairo_xlib_display_t from a Display is a list traversal under mutex (though the element we're looking for is most likely at the start), but to get the Display is just a lockless pointer dereference.]
Diffstat (limited to 'src/cairo-xlib-screen.c')
-rw-r--r--src/cairo-xlib-screen.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c
index 83015a2e..4a26eee5 100644
--- a/src/cairo-xlib-screen.c
+++ b/src/cairo-xlib-screen.c
@@ -346,19 +346,14 @@ _cairo_xlib_screen_info_destroy (cairo_xlib_screen_info_t *info)
}
cairo_xlib_screen_info_t *
-_cairo_xlib_screen_info_get (Display *dpy, Screen *screen)
+_cairo_xlib_screen_info_get (cairo_xlib_display_t *display, Screen *screen)
{
- cairo_xlib_display_t *display;
cairo_xlib_screen_info_t *info = NULL, **prev;
- display = _cairo_xlib_display_get (dpy);
- if (display == NULL)
- return NULL;
-
CAIRO_MUTEX_LOCK (display->mutex);
if (display->closed) {
CAIRO_MUTEX_UNLOCK (display->mutex);
- goto DONE;
+ return NULL;
}
for (prev = &display->screens; (info = *prev); prev = &(*prev)->next) {
@@ -394,7 +389,9 @@ _cairo_xlib_screen_info_get (Display *dpy, Screen *screen)
sizeof (cairo_xlib_visual_info_t*));
if (screen) {
+ Display *dpy = display->display;
int event_base, error_base;
+
info->has_render = (XRenderQueryExtension (dpy, &event_base, &error_base) &&
(XRenderFindVisualFormat (dpy, DefaultVisual (dpy, DefaultScreen (dpy))) != 0));
_cairo_xlib_init_screen_font_options (dpy, info);
@@ -407,9 +404,6 @@ _cairo_xlib_screen_info_get (Display *dpy, Screen *screen)
}
}
-DONE:
- _cairo_xlib_display_destroy (display);
-
return info;
}