summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-09-09 20:17:08 -0700
committerCarl Worth <cworth@cworth.org>2006-09-11 10:59:38 -0700
commitcb6aed0a816cc5f09bb5660d4961ca196243eb10 (patch)
tree316cb6651ec9248133194429269f695f8b11f868 /boilerplate
parente1a8a8b65a41691521d89fba7737c093dfdf7926 (diff)
perf: Make xlib testing wait for the X server to finish rendering.
We do this by adding a new cairo_perf_timer_set_finalize function and in the case of the xlib backend passing a callback to that function that does a 1x1 XGetImage.
Diffstat (limited to 'boilerplate')
-rw-r--r--[-rwxr-xr-x]boilerplate/cairo-boilerplate.c17
-rw-r--r--boilerplate/cairo-boilerplate.h4
2 files changed, 19 insertions, 2 deletions
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index e5257663..a6acd56b 100755..100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -919,6 +919,17 @@ typedef struct _xlib_target_closure
cairo_bool_t drawable_is_pixmap;
} xlib_target_closure_t;
+static void
+boilerplate_xlib_wait_for_rendering (void *closure)
+{
+ xlib_target_closure_t *xtc = closure;
+ XImage *ximage;
+
+ ximage = XGetImage (xtc->dpy, xtc->drawable,
+ 0, 0, 1, 1, AllPlanes, ZPixmap);
+ XDestroyImage (ximage);
+}
+
/* For the xlib backend we distinguish between TEST and PERF mode in a
* couple of ways.
*
@@ -1478,9 +1489,11 @@ cairo_boilerplate_target_t targets[] =
#endif
#if CAIRO_HAS_XLIB_SURFACE
{ "xlib", CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR_ALPHA, 0,
- create_xlib_surface, cairo_surface_write_to_png, cleanup_xlib},
+ create_xlib_surface, cairo_surface_write_to_png, cleanup_xlib,
+ boilerplate_xlib_wait_for_rendering},
{ "xlib", CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 0,
- create_xlib_surface, cairo_surface_write_to_png, cleanup_xlib},
+ create_xlib_surface, cairo_surface_write_to_png, cleanup_xlib,
+ boilerplate_xlib_wait_for_rendering},
#endif
#if CAIRO_HAS_PS_SURFACE
{ "ps", CAIRO_SURFACE_TYPE_PS,
diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h
index a75bce9d..26f4becb 100644
--- a/boilerplate/cairo-boilerplate.h
+++ b/boilerplate/cairo-boilerplate.h
@@ -107,6 +107,9 @@ typedef cairo_status_t
typedef void
(*cairo_boilerplate_cleanup_t) (void *closure);
+typedef void
+(*cairo_boilerplate_wait_t) (void *closure);
+
typedef struct _cairo_boilerplate_target
{
const char *name;
@@ -116,6 +119,7 @@ typedef struct _cairo_boilerplate_target
cairo_boilerplate_create_surface_t create_surface;
cairo_boilerplate_write_to_png_t write_to_png;
cairo_boilerplate_cleanup_t cleanup;
+ cairo_boilerplate_wait_t wait_for_rendering;
void *closure;
} cairo_boilerplate_target_t;