[cairo-commit] cairo/test cairo-test.c, 1.34, 1.35 xlib-surface.c, 1.2, 1.3

Carl Worth commit at pdx.freedesktop.org
Tue May 17 06:05:15 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv21958/test

Modified Files:
	cairo-test.c xlib-surface.c 
Log Message:

        Rework of cairo_xlib_surface create functions by Keith Packard:

        * src/cairo-xlib-xrender.h:
        Add cairo_xlib_surface_create_with_render_format.

        * src/cairo-xlib.h:
        * src/cairo-xlib-surface.c:
        (cairo_xlib_surface_create),
        (cairo_xlib_surface_create_for_bitmap): Reduce Xlib constructors
        down to two simple forms. Add width, height to constructors and
        eliminate any synchronous size queries from the implementation.

        * test/cairo-test.c: (create_xlib_surface):
        * test/xlib-surface.c: (do_test): Update to match new
        cairo_xlib_surface_t create functions.


Index: cairo-test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- cairo-test.c	14 May 2005 21:01:46 -0000	1.34
+++ cairo-test.c	17 May 2005 13:05:13 -0000	1.35
@@ -249,7 +249,7 @@
 #endif
 
 #if CAIRO_HAS_XLIB_SURFACE
-#include "cairo-xlib.h"
+#include "cairo-xlib-xrender.h"
 typedef struct _xlib_target_closure
 {
     Display *dpy;
@@ -262,6 +262,7 @@
     xlib_target_closure_t *xtc;
     cairo_surface_t *surface;
     Display *dpy;
+    XRenderPictFormat *xrender_format;
 
     *closure = xtc = xmalloc (sizeof (xlib_target_closure_t));
 
@@ -276,13 +277,14 @@
 	return NULL;
     }
 
+    xrender_format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
+    
     xtc->pixmap = XCreatePixmap (dpy, DefaultRootWindow (dpy),
-				 width, height, 32);
-
-    surface = cairo_xlib_surface_create (dpy, xtc->pixmap,
-					 CAIRO_FORMAT_ARGB32);
-    cairo_xlib_surface_set_size (surface, width, height);
+				 width, height, xrender_format->depth);
 
+    surface = cairo_xlib_surface_create_with_xrender_format (dpy, xtc->pixmap,
+							     xrender_format,
+							     width, height);
     return surface;
 }
 

Index: xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/test/xlib-surface.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- xlib-surface.c	14 May 2005 20:51:59 -0000	1.2
+++ xlib-surface.c	17 May 2005 13:05:13 -0000	1.3
@@ -27,8 +27,11 @@
 #include <stdlib.h>
 
 #include "cairo.h"
+#include "cairo-xlib.h"
+#include "cairo-xlib-xrender.h"
 #include "cairo-test.h"
 #include "cairo-xlib-test.h"
+
 #include "buffer-diff.h"
 
 #define SIZE 100
@@ -116,9 +119,10 @@
 	XMapWindow (dpy, drawable);
     }
 
-    surface = cairo_xlib_surface_create_with_visual (dpy,
-						     drawable,
-						     DefaultVisual (dpy, screen));
+    surface = cairo_xlib_surface_create (dpy,
+					 drawable,
+					 DefaultVisual (dpy, screen),
+					 SIZE, SIZE);
 
     if (set_size)
 	cairo_xlib_surface_set_size (surface, SIZE, SIZE);




More information about the cairo-commit mailing list