summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-screen.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-07-04 12:36:23 +0200
committerAndrea Canciani <ranma42@gmail.com>2011-07-21 19:16:42 +0200
commit1aa077e129485789803ad050f461067b4fe374d7 (patch)
tree455c9b9d86429eb427d3db98e60dd6696b2c4dae /src/cairo-xcb-screen.c
parent5eb8eacde0ec3267e55e9b63a33ed2d4642867a7 (diff)
downloadcairo-1aa077e129485789803ad050f461067b4fe374d7.tar.gz
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-xcb-screen.c')
-rw-r--r--src/cairo-xcb-screen.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/cairo-xcb-screen.c b/src/cairo-xcb-screen.c
index a7802c2df..7b5493f19 100644
--- a/src/cairo-xcb-screen.c
+++ b/src/cairo-xcb-screen.c
@@ -81,7 +81,7 @@ _cairo_xcb_screen_finish (cairo_xcb_screen_t *screen)
cairo_surface_destroy (screen->stock_colors[i]);
for (i = 0; i < ARRAY_LENGTH (screen->gc); i++) {
- if (((screen->gc_depths >> (8*i)) & 0xff) != 0)
+ if (screen->gc_depths[i] != 0)
_cairo_xcb_connection_free_gc (screen->connection, screen->gc[i]);
}
@@ -168,7 +168,7 @@ _cairo_xcb_screen_get (xcb_connection_t *xcb_connection,
cairo_list_init (&screen->surfaces);
cairo_list_init (&screen->pictures);
- screen->gc_depths = 0;
+ memset (screen->gc_depths, 0, sizeof (screen->gc_depths));
memset (screen->gc, 0, sizeof (screen->gc));
screen->solid_cache_size = 0;
@@ -228,8 +228,8 @@ _cairo_xcb_screen_get_gc (cairo_xcb_screen_t *screen,
assert (CAIRO_MUTEX_IS_LOCKED (screen->connection->device.mutex));
for (i = 0; i < ARRAY_LENGTH (screen->gc); i++) {
- if (((screen->gc_depths >> (8*i)) & 0xff) == depth) {
- screen->gc_depths &= ~(0xff << (8*i));
+ if (screen->gc_depths[i] == depth) {
+ screen->gc_depths[i] = 0;
return screen->gc[i];
}
}
@@ -245,7 +245,7 @@ _cairo_xcb_screen_put_gc (cairo_xcb_screen_t *screen, int depth, xcb_gcontext_t
assert (CAIRO_MUTEX_IS_LOCKED (screen->connection->device.mutex));
for (i = 0; i < ARRAY_LENGTH (screen->gc); i++) {
- if (((screen->gc_depths >> (8*i)) & 0xff) == 0)
+ if (screen->gc_depths[i] == 0)
break;
}
@@ -256,8 +256,7 @@ _cairo_xcb_screen_put_gc (cairo_xcb_screen_t *screen, int depth, xcb_gcontext_t
}
screen->gc[i] = gc;
- screen->gc_depths &= ~(0xff << (8*i));
- screen->gc_depths |= depth << (8*i);
+ screen->gc_depths[i] = depth;
}
cairo_status_t