[cairo-xlib] Move the buggy_repeat discovery to the display_t.

The VendorString parsing (to detect broken Xserver versions) was being
performed for each surface creation, but as it is a display invariant
we can save a small amount of work by storing the result on the
cairo_xlib_display_t.
This commit is contained in:
Chris Wilson 2007-10-17 20:41:57 +01:00
parent 5e09653e5d
commit 379b9b79fa
3 changed files with 11 additions and 8 deletions

View file

@ -290,6 +290,15 @@ _cairo_xlib_display_get (Display *dpy)
display->close_display_hooks = NULL;
display->closed = FALSE;
display->buggy_repeat = FALSE;
if (strstr (ServerVendor (dpy), "X.Org") != NULL) {
if (VendorRelease (dpy) <= 60802000)
display->buggy_repeat = TRUE;
} else if (strstr (ServerVendor (dpy), "XFree86") != NULL) {
if (VendorRelease (dpy) <= 40500000)
display->buggy_repeat = TRUE;
}
display->next = _cairo_xlib_display_list;
_cairo_xlib_display_list = display;

View file

@ -70,6 +70,7 @@ struct _cairo_xlib_display {
cairo_freelist_t hook_freelist;
cairo_xlib_hook_t *close_display_hooks;
unsigned int buggy_repeat :1;
unsigned int closed :1;
};

View file

@ -2012,14 +2012,7 @@ _cairo_xlib_surface_create_internal (Display *dpy,
surface->width = width;
surface->height = height;
surface->buggy_repeat = FALSE;
if (strstr (ServerVendor (dpy), "X.Org") != NULL) {
if (VendorRelease (dpy) <= 60802000)
surface->buggy_repeat = TRUE;
} else if (strstr (ServerVendor (dpy), "XFree86") != NULL) {
if (VendorRelease (dpy) <= 40500000)
surface->buggy_repeat = TRUE;
}
surface->buggy_repeat = screen_info->display->buggy_repeat;
surface->dst_picture = None;
surface->src_picture = None;