[cairo-commit] 3 commits - boilerplate/cairo-boilerplate-xlib.c perf/cairo-perf.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Aug 24 06:40:45 PDT 2007


 boilerplate/cairo-boilerplate-xlib.c |   30 ++++++++++++++++++++++++++++++
 perf/cairo-perf.c                    |    8 ++++++++
 2 files changed, 38 insertions(+)

New commits:
diff-tree 24075f1bddbda1d90dfd6f041b8d6bdaf9c786dc (from 8894894d9d34d169efa39d6d86ebefcb2ba69fe1)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 24 14:16:43 2007 +0100

    [cairo-perf] Blacklist xlib-fallback.
    
    Do not try and create non-Render xlib surfaces as they explicitly do
    not support performance testing.

diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 489ffdc..388bfa7 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -78,6 +78,14 @@ target_is_measurable (cairo_boilerplate_
 	    return TRUE;
 	}
     case CAIRO_SURFACE_TYPE_XLIB:
+	if (strcmp (target->name, "xlib-fallback") == 0)
+	{
+	    return FALSE;
+	}
+	else
+	{
+	    return TRUE;
+	}
     case CAIRO_SURFACE_TYPE_XCB:
     case CAIRO_SURFACE_TYPE_GLITZ:
     case CAIRO_SURFACE_TYPE_QUARTZ:
diff-tree 8894894d9d34d169efa39d6d86ebefcb2ba69fe1 (from a29544a0b6f150384fd652aad950d1cae9809c42)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 24 13:40:26 2007 +0100

    [cairo-boilerplate-xlib] Check that the surface will fit in the screen.
    
    Whilst testing the fallback surface, the resultant image was being
    clipped to the screen size. Be conservative and refuse to create
    windows (for CAIRO_CONTENT_COLOR surfaces) that are larger than the
     screen.

diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c
index c0553ef..781f8f9 100644
--- a/boilerplate/cairo-boilerplate-xlib.c
+++ b/boilerplate/cairo-boilerplate-xlib.c
@@ -110,6 +110,18 @@ _cairo_boilerplate_xlib_test_create_surf
 							  width, height);
 }
 
+
+static cairo_bool_t
+_cairo_boilerplate_xlib_check_screen_size (Display	*dpy,
+	                                   int		 screen,
+					   int		 width,
+					   int		 height)
+{
+    Screen *scr = XScreenOfDisplay (dpy, screen);
+    return width <= WidthOfScreen (scr) && height <= HeightOfScreen (scr);
+}
+
+
 static cairo_surface_t *
 _cairo_boilerplate_xlib_perf_create_surface (Display			*dpy,
 					     cairo_content_t		 content,
@@ -135,6 +147,13 @@ _cairo_boilerplate_xlib_perf_create_surf
 	break;
 
     case CAIRO_CONTENT_COLOR:
+	if (! _cairo_boilerplate_xlib_check_screen_size (dpy,
+		                                         DefaultScreen (dpy),
+		                                         width, height)) {
+	    CAIRO_BOILERPLATE_LOG ("Surface is larger than the Screen.\n");
+	    return NULL;
+	}
+
 	visual = DefaultVisual (dpy, DefaultScreen (dpy));
 	xrender_format = XRenderFindVisualFormat (dpy, visual);
 	if (xrender_format == NULL) {
@@ -244,6 +263,12 @@ _cairo_boilerplate_xlib_fallback_create_
     XSynchronize (dpy, 1);
 
     screen = DefaultScreen (dpy);
+    if (! _cairo_boilerplate_xlib_check_screen_size (dpy, screen,
+		                                     width, height)) {
+	CAIRO_BOILERPLATE_LOG ("Surface is larger than the Screen.\n");
+	return NULL;
+    }
+
     attr.override_redirect = True;
     xtc->drawable = XCreateWindow (dpy, DefaultRootWindow (dpy),
 				   0, 0,
diff-tree a29544a0b6f150384fd652aad950d1cae9809c42 (from 177a3b8a32f13ce92d45899367fb7758600f7b93)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 24 12:24:20 2007 +0100

    [cairo-boilerplate-xlib] Clear Render data for the non-Render fallback.
    
    As well as marking the XRender extension unavailable in
    _cairo_boiler_player_xlib_disable_render(), we need to clear any
    XRender derived information stored during the surface creation.

diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c
index f95869f..c0553ef 100644
--- a/boilerplate/cairo-boilerplate-xlib.c
+++ b/boilerplate/cairo-boilerplate-xlib.c
@@ -286,6 +286,11 @@ cairo_boilerplate_xlib_surface_disable_r
 	return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
 
     surface->render_major = surface->render_minor = -1;
+    surface->xrender_format = NULL;
+
+    /* The content type is forced by _xrender_format_to_content() during
+     * non-Render surface creation, so repeat the procedure here. */
+    surface->base.content = CAIRO_CONTENT_COLOR;
 
     return CAIRO_STATUS_SUCCESS;
 }


More information about the cairo-commit mailing list