summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-10-28 16:54:10 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-10-30 17:52:14 +0000
commitcd45258c5bf6a06f7bd3f2bfaf928e423a9b70e1 (patch)
treeaef32bbf14200c8c1861bb58a35c964f43b8ae1d
parentd384f864992fbf7513446a70158135a08e704678 (diff)
[xlib] Only clear the GC clip mask as necessary.
Avoid redundant calls to XSetClipMask() for clean GCs.
-rw-r--r--src/cairo-xlib-private.h10
-rw-r--r--src/cairo-xlib-screen.c8
-rw-r--r--src/cairo-xlib-surface.c7
3 files changed, 18 insertions, 7 deletions
diff --git a/src/cairo-xlib-private.h b/src/cairo-xlib-private.h
index 58edbeb5..b9c84b84 100644
--- a/src/cairo-xlib-private.h
+++ b/src/cairo-xlib-private.h
@@ -152,9 +152,15 @@ cairo_private void
_cairo_xlib_screen_info_close_display (cairo_xlib_screen_info_t *info);
cairo_private GC
-_cairo_xlib_screen_get_gc (cairo_xlib_screen_info_t *info, int depth);
+_cairo_xlib_screen_get_gc (cairo_xlib_screen_info_t *info,
+ int depth,
+ unsigned int *need_reset);
+
cairo_private cairo_status_t
-_cairo_xlib_screen_put_gc (cairo_xlib_screen_info_t *info, int depth, GC gc, cairo_bool_t reset_clip);
+_cairo_xlib_screen_put_gc (cairo_xlib_screen_info_t *info,
+ int depth,
+ GC gc,
+ cairo_bool_t reset_clip);
cairo_private cairo_font_options_t *
_cairo_xlib_screen_get_font_options (cairo_xlib_screen_info_t *info);
diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c
index 65d131c0..9dd411ed 100644
--- a/src/cairo-xlib-screen.c
+++ b/src/cairo-xlib-screen.c
@@ -57,6 +57,8 @@
#include "cairo-xlib-private.h"
#include "cairo-xlib-xrender-private.h"
+#include "cairo-xlib-surface-private.h"
+
#include <fontconfig/fontconfig.h>
static int
@@ -404,7 +406,9 @@ depth_to_index (int depth)
}
GC
-_cairo_xlib_screen_get_gc (cairo_xlib_screen_info_t *info, int depth)
+_cairo_xlib_screen_get_gc (cairo_xlib_screen_info_t *info,
+ int depth,
+ unsigned int *dirty)
{
GC gc;
cairo_bool_t needs_reset;
@@ -419,7 +423,7 @@ _cairo_xlib_screen_get_gc (cairo_xlib_screen_info_t *info, int depth)
CAIRO_MUTEX_UNLOCK (info->mutex);
if (needs_reset)
- XSetClipMask(info->display->display, gc, None);
+ *dirty |= CAIRO_XLIB_SURFACE_CLIP_DIRTY_GC;
return gc;
}
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index d078dcdc..34c86fde 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -900,7 +900,8 @@ _cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface)
if (surface->gc == NULL) {
surface->gc = _cairo_xlib_screen_get_gc (surface->screen_info,
- surface->depth);
+ surface->depth,
+ &surface->clip_dirty);
if (surface->gc == NULL) {
gcv.graphics_exposures = False;
surface->gc = XCreateGC (surface->dpy, surface->drawable,
@@ -908,9 +909,9 @@ _cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface)
if (!surface->gc)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
+ }
- _cairo_xlib_surface_set_gc_clip_rects (surface);
- } else if (surface->clip_dirty & CAIRO_XLIB_SURFACE_CLIP_DIRTY_GC)
+ if (surface->clip_dirty & CAIRO_XLIB_SURFACE_CLIP_DIRTY_GC)
_cairo_xlib_surface_set_gc_clip_rects (surface);
return CAIRO_STATUS_SUCCESS;