diff options
author | Andrea Canciani <ranma42@gmail.com> | 2011-07-04 12:36:23 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-07-21 19:16:42 +0200 |
commit | 1aa077e129485789803ad050f461067b4fe374d7 (patch) | |
tree | 455c9b9d86429eb427d3db98e60dd6696b2c4dae /src/cairo-xlib-screen.c | |
parent | 5eb8eacde0ec3267e55e9b63a33ed2d4642867a7 (diff) |
xcb,xlib: Cleanup GC cache handling
Device mutexes guarantee the consistency between multiple threads,
hence GC cache does not rely anymore on atomic operations.
This makes it possible to avoid bit twiddling and to use a simple
array.
Diffstat (limited to 'src/cairo-xlib-screen.c')
-rw-r--r-- | src/cairo-xlib-screen.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c index 8ac99351f..dc060c2ea 100644 --- a/src/cairo-xlib-screen.c +++ b/src/cairo-xlib-screen.c @@ -278,10 +278,11 @@ _cairo_xlib_screen_close_display (cairo_xlib_display_t *display, dpy = display->display; for (i = 0; i < ARRAY_LENGTH (info->gc); i++) { - if ((info->gc_depths >> (8*i)) & 0xff) + if (info->gc_depths[i] != 0) { XFreeGC (dpy, info->gc[i]); + info->gc_depths[i] = 0; + } } - info->gc_depths = 0; } void @@ -332,7 +333,7 @@ _cairo_xlib_screen_get (Display *dpy, info->device = device; info->screen = screen; info->has_font_options = FALSE; - info->gc_depths = 0; + memset (info->gc_depths, 0, sizeof (info->gc_depths)); memset (info->gc, 0, sizeof (info->gc)); cairo_list_init (&info->visuals); @@ -358,8 +359,8 @@ _cairo_xlib_screen_get_gc (cairo_xlib_display_t *display, int i; for (i = 0; i < ARRAY_LENGTH (info->gc); i++) { - if (((info->gc_depths >> (8*i)) & 0xff) == depth) { - info->gc_depths &= ~(0xff << (8*i)); + if (info->gc_depths[i] == depth) { + info->gc_depths[i] = 0; gc = info->gc[i]; break; } @@ -387,7 +388,7 @@ _cairo_xlib_screen_put_gc (cairo_xlib_display_t *display, int i; for (i = 0; i < ARRAY_LENGTH (info->gc); i++) { - if (((info->gc_depths >> (8*i)) & 0xff) == 0) + if (info->gc_depths[i] == 0) break; } @@ -408,8 +409,7 @@ _cairo_xlib_screen_put_gc (cairo_xlib_display_t *display, } info->gc[i] = gc; - info->gc_depths &= ~(0xff << (8*i)); - info->gc_depths |= depth << (8*i); + info->gc_depths[i] = depth; } cairo_status_t |