[cairo-commit] cairo/test .cvsignore, 1.27, 1.28 Makefile.am, 1.48, 1.49 cairo-test.c, 1.33, 1.34 cairo-test.h, 1.9, 1.10

Carl Worth commit at pdx.freedesktop.org
Sat May 14 14:01:48 PDT 2005


Committed by: cworth

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

Modified Files:
	.cvsignore Makefile.am cairo-test.c cairo-test.h 
Log Message:

        * src/cairo-xcb.h:
        * src/cairo-xcb-surface.c: (_cairo_xcb_surface_create_similar),
        (_cairo_xcb_surface_finish), (_cairo_xcb_surface_get_size),
        (_bits_per_pixel), (_bytes_per_line), (_get_image_surface),
        (_draw_image_surface), (_cairo_xcb_surface_get_extents),
        (_cairo_surface_is_xcb), (_cairo_xcb_surface_create_internal),
        (cairo_xcb_surface_create_for_pixmap),
        (cairo_xcb_surface_create_for_pixmap_with_visual),
        (cairo_xcb_surface_create_for_window_with_visual),
        (cairo_xcb_surface_set_size):
        Brush the dust off the XCB backend and get it compiling and
        working again. This patch makes the XCB surface API match that of
        the Xlib surface API as of yesterday. But, it's already stale as
        the Xlib API changed again. So we'll need one more revision of the
        XCB backend before the next snapshot.

        * test/.cvsignore:
        * test/Makefile.am:
        * test/cairo-test.c: (create_xcb_surface), (cleanup_xcb):
        * test/cairo-test.h: Add support for testing of the xcb backend as
        well.


Index: .cvsignore
===================================================================
RCS file: /cvs/cairo/cairo/test/.cvsignore,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- .cvsignore	14 May 2005 17:15:11 -0000	1.27
+++ .cvsignore	14 May 2005 21:01:46 -0000	1.28
@@ -23,6 +23,7 @@
 pdf-surface
 pdf-surface.pdf
 pixman-rotate
+quarter-over
 rel-path
 scale-source-surface-paint
 select-font-no-show-text
@@ -40,6 +41,7 @@
 user-data
 xlib-surface
 *-image-out.png
+*-xcb-out.png
 *-xlib-out.png
 *-diff.png
 *.la

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo/test/Makefile.am,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- Makefile.am	14 May 2005 00:54:43 -0000	1.48
+++ Makefile.am	14 May 2005 21:01:46 -0000	1.49
@@ -17,6 +17,7 @@
 paint-with-alpha		\
 path-data			\
 pixman-rotate			\
+quarter-over			\
 scale-source-surface-paint	\
 select-font-no-show-text	\
 self-copy			\
@@ -61,6 +62,7 @@
 paint-with-alpha-ref.png		\
 path-data-ref.png			\
 pixman-rotate-ref.png			\
+quarter-over-ref.png			\
 romedalen.png				\
 self-copy-ref.png			\
 scale-source-surface-paint-ref.png	\
@@ -138,6 +140,7 @@
 path_data_LDADD = $(LDADDS)
 pdf_surface_LDADD = $(LDADDS)
 pixman_rotate_LDADD = $(LDADDS)
+quarter_over_LDADD = $(LDADDS)
 scale_source_surface_paint_LDADD = $(LDADDS)
 select_font_no_show_text_LDADD = $(LDADDS)
 self_copy_LDADD = $(LDADDS)

Index: cairo-test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- cairo-test.c	14 May 2005 20:51:59 -0000	1.33
+++ cairo-test.c	14 May 2005 21:01:46 -0000	1.34
@@ -193,20 +193,63 @@
 #endif
 
 #if CAIRO_HAS_XCB_SURFACE
+#include "cairo-xcb.h"
+typedef struct _xcb_target_closure
+{
+    XCBConnection *c;
+    XCBPIXMAP pixmap;
+} xcb_target_closure_t;
+
 static cairo_surface_t *
 create_xcb_surface (int width, int height, void **closure)
 {
-#error Not yet implemented
+    XCBSCREEN *root;
+    xcb_target_closure_t *xtc;
+    cairo_surface_t *surface;
+    XCBConnection *c;
+
+    *closure = xtc = xmalloc (sizeof (xcb_target_closure_t));
+
+    if (width == 0)
+	width = 1;
+    if (height == 0)
+	height = 1;
+
+    xtc->c = c = XCBConnectBasic();
+    root = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(c)).data;
+
+    if (c == NULL) {
+	cairo_test_log ("Failed to connect to X server through XCB\n");
+	return NULL;
+    }
+
+    xtc->pixmap = XCBPIXMAPNew (c);
+    /* XXX: What in the world is the drawable argument to XCBCreatePixmap ? */
+    {
+	XCBDRAWABLE root_drawable;
+	root_drawable.window = root->root;
+	XCBCreatePixmap (c, 32, xtc->pixmap, root_drawable, width, height);
+    }
+
+    surface = cairo_xcb_surface_create_for_pixmap (c, xtc->pixmap,
+						   CAIRO_FORMAT_ARGB32);
+    cairo_xcb_surface_set_size (surface, width, height);
+
+    return surface;
 }
 
 static void
 cleanup_xcb (void *closure)
 {
-#error Not yet implemented
+    xcb_target_closure_t *xtc = closure;
+
+    XCBFreePixmap (xtc->c, xtc->pixmap);
+    XCBDisconnect (xtc->c);
 }
 #endif
 
 #if CAIRO_HAS_XLIB_SURFACE
+#include "cairo-xlib.h"
 typedef struct _xlib_target_closure
 {
     Display *dpy;

Index: cairo-test.h
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cairo-test.h	11 May 2005 03:25:38 -0000	1.9
+++ cairo-test.h	14 May 2005 21:01:46 -0000	1.10
@@ -28,8 +28,6 @@
 
 #include <math.h>
 #include <cairo.h>
-#include <cairo-pdf.h>
-#include <cairo-xlib.h>
 
 typedef enum cairo_test_status {
     CAIRO_TEST_SUCCESS = 0,




More information about the cairo-commit mailing list