summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-22 11:03:54 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-22 11:24:14 +0000
commit6ab1deb5c6377828877253a7ec0ca43d97ca4a99 (patch)
tree1b48045c335a548140fb87be31a9a1ea2ed50cd9 /boilerplate
parent08de30d8b5700040d3ff953bae8d801a4a05aff0 (diff)
downloadcairo-6ab1deb5c6377828877253a7ec0ca43d97ca4a99.tar.gz
boilerplate/xlib: Exercise the mask based compositor for xrender version 0.0
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-xlib.c73
1 files changed, 72 insertions, 1 deletions
diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c
index 3a6beefd6..aed075f67 100644
--- a/boilerplate/cairo-boilerplate-xlib.c
+++ b/boilerplate/cairo-boilerplate-xlib.c
@@ -274,7 +274,7 @@ _cairo_boilerplate_xlib_create_similar (cairo_surface_t *other,
static cairo_surface_t *
_cairo_boilerplate_xlib_create_surface (const char *name,
- cairo_content_t content,
+ cairo_content_t content,
double width,
double height,
double max_width,
@@ -315,6 +315,63 @@ _cairo_boilerplate_xlib_create_surface (const char *name,
}
static cairo_surface_t *
+_cairo_boilerplate_xlib_render_0_0_create_surface (const char *name,
+ cairo_content_t content,
+ double width,
+ double height,
+ double max_width,
+ double max_height,
+ cairo_boilerplate_mode_t mode,
+ void **closure)
+{
+ xlib_target_closure_t *xtc;
+ Display *dpy;
+ int screen;
+ Pixmap pixmap;
+ cairo_surface_t *surface, *dummy;
+
+ *closure = xtc = xcalloc (1, sizeof (xlib_target_closure_t));
+
+ width = ceil (width);
+ if (width < 1)
+ width = 1;
+
+ height = ceil (height);
+ if (height < 1)
+ height = 1;
+
+ xtc->dpy = dpy = XOpenDisplay (NULL);
+ if (xtc->dpy == NULL) {
+ free (xtc);
+ CAIRO_BOILERPLATE_DEBUG (("Failed to open display: %s\n", XDisplayName(0)));
+ return NULL;
+ }
+
+
+ screen = DefaultScreen (dpy);
+ pixmap = XCreatePixmap (dpy, DefaultRootWindow (dpy), 1, 1,
+ DefaultDepth (dpy, screen));
+ dummy = cairo_xlib_surface_create (dpy, pixmap,
+ DefaultVisual (dpy, screen),
+ 1, 1);
+ cairo_xlib_device_debug_cap_xrender_version (cairo_surface_get_device (dummy),
+ 0, 0);
+
+ if (mode == CAIRO_BOILERPLATE_MODE_TEST)
+ surface = _cairo_boilerplate_xlib_test_create_surface (dpy, content, width, height, xtc);
+ else /* mode == CAIRO_BOILERPLATE_MODE_PERF */
+ surface = _cairo_boilerplate_xlib_perf_create_surface (dpy, content, width, height, xtc);
+
+ cairo_surface_destroy (dummy);
+ XFreePixmap (dpy, pixmap);
+
+ if (surface == NULL || cairo_surface_status (surface))
+ _cairo_boilerplate_xlib_cleanup (xtc);
+
+ return surface;
+}
+
+static cairo_surface_t *
_cairo_boilerplate_xlib_window_create_surface (const char *name,
cairo_content_t content,
double width,
@@ -538,6 +595,20 @@ static const cairo_boilerplate_target_t targets[] = {
NULL,
FALSE, FALSE, FALSE
},
+ {
+ "xlib-render-0_0", "mask", NULL, NULL,
+ CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 1,
+ "cairo_xlib_surface_create",
+ _cairo_boilerplate_xlib_render_0_0_create_surface,
+ cairo_surface_create_similar,
+ NULL, NULL,
+ _cairo_boilerplate_get_image_surface,
+ cairo_surface_write_to_png,
+ _cairo_boilerplate_xlib_cleanup,
+ _cairo_boilerplate_xlib_synchronize,
+ NULL,
+ FALSE, FALSE, FALSE
+ },
#endif
#if CAIRO_HAS_XLIB_SURFACE
/* This is a fallback surface which uses xlib fallbacks instead of