summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-05-27 15:59:37 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-06-01 16:50:25 +0100
commit63bdae27a83381fb8c3786c2d7a6c2592e388ee9 (patch)
tree1897d8eac8bf89bfdc1fb6c99a1ee59b044e5143 /boilerplate
parente21b373c94b1edb2828d4fee7ff45060fb22dbda (diff)
xlib,xcb: Force strict adherence to the Render specification when testing
Introduce cairo_xlib_device_debug_set_precision() to override the automatic selection of rendering precision and force the Xorg/DDX to strictly adhere to the precise rendering mode of the Render specification. This allows us to test drivers without worrying, too much, about minor discrepancies in antialiasing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-xcb.c14
-rw-r--r--boilerplate/cairo-boilerplate-xlib.c23
2 files changed, 36 insertions, 1 deletions
diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c
index c5dee8ee9..d4c70be67 100644
--- a/boilerplate/cairo-boilerplate-xcb.c
+++ b/boilerplate/cairo-boilerplate-xcb.c
@@ -86,6 +86,17 @@ _cairo_boilerplate_xcb_sync_server (xcb_target_closure_t *xtc)
}
static void
+_cairo_boilerplate_xcb_setup_test_surface (cairo_surface_t *surface)
+{
+
+ /* For testing purposes, tell the X server to strictly adhere to the
+ * Render specification.
+ */
+ cairo_xcb_device_debug_set_precision(cairo_surface_get_device(surface),
+ PolyModePrecise);
+}
+
+static void
_cairo_boilerplate_xcb_cleanup (void *closure)
{
xcb_target_closure_t *xtc = closure;
@@ -241,6 +252,9 @@ _cairo_boilerplate_xcb_create_surface (const char *name,
width, height);
free (formats);
+ if (mode != CAIRO_BOILERPLATE_MODE_PERF)
+ cairo_xcb_surface_setup_test_surface(surface);
+
xtc->device = cairo_device_reference (cairo_surface_get_device (surface));
status = cairo_surface_set_user_data (surface, &xcb_closure_key, xtc, NULL);
if (status == CAIRO_STATUS_SUCCESS)
diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c
index fbc999078..f82b78b8d 100644
--- a/boilerplate/cairo-boilerplate-xlib.c
+++ b/boilerplate/cairo-boilerplate-xlib.c
@@ -78,6 +78,18 @@ _cairo_boilerplate_xlib_check_screen_size (Display *dpy,
return width <= WidthOfScreen (scr) && height <= HeightOfScreen (scr);
}
+static void
+_cairo_boilerplate_xlib_setup_test_surface (cairo_surface_t *surface)
+{
+
+ /* For testing purposes, tell the X server to strictly adhere to the
+ * Render specification.
+ */
+ cairo_xlib_device_debug_set_precision(cairo_surface_get_device(surface),
+ PolyModePrecise);
+}
+
+
#if CAIRO_HAS_XLIB_XRENDER_SURFACE
/* For the xlib backend we distinguish between TEST and PERF mode in a
* couple of ways.
@@ -98,6 +110,7 @@ _cairo_boilerplate_xlib_test_create_surface (Display *dpy,
xlib_target_closure_t *xtc)
{
XRenderPictFormat *xrender_format;
+ cairo_surface_t *surface;
/* This kills performance, but it makes debugging much
* easier. That's why we have it here when in TEST mode, but not
@@ -133,10 +146,14 @@ _cairo_boilerplate_xlib_test_create_surface (Display *dpy,
width, height, xrender_format->depth);
xtc->drawable_is_pixmap = TRUE;
- return cairo_xlib_surface_create_with_xrender_format (dpy, xtc->drawable,
+ surface = cairo_xlib_surface_create_with_xrender_format (dpy, xtc->drawable,
DefaultScreenOfDisplay (dpy),
xrender_format,
width, height);
+
+ _cairo_boilerplate_xlib_setup_test_surface(surface);
+
+ return surface;
}
static cairo_surface_t *
@@ -333,6 +350,8 @@ _cairo_boilerplate_xlib_window_create_surface (const char *name,
if (cairo_surface_status (surface))
_cairo_boilerplate_xlib_cleanup (xtc);
+ _cairo_boilerplate_xlib_setup_test_surface(surface);
+
return surface;
}
@@ -477,6 +496,8 @@ _cairo_boilerplate_xlib_fallback_create_surface (const char *name,
else
cairo_boilerplate_xlib_surface_disable_render (surface);
+ _cairo_boilerplate_xlib_setup_test_surface(surface);
+
return surface;
}
#endif