diff options
author | Carl Worth <cworth@cworth.org> | 2005-05-14 14:01:46 +0000 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2005-05-14 14:01:46 +0000 |
commit | 60b0a05df73cef4a67d111a282b20ce1fd5081e6 (patch) | |
tree | bf0fccf0602328ceae9fc3cdb659df534a64f6ba /test | |
parent | 6a1af1999dfb79f05341ea6c4bf0e23795db01bc (diff) |
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.
Add support for testing of the xcb backend as well.
Diffstat (limited to 'test')
-rw-r--r-- | test/.cvsignore | 2 | ||||
-rw-r--r-- | test/Makefile.am | 3 | ||||
-rw-r--r-- | test/cairo-test.c | 47 | ||||
-rw-r--r-- | test/cairo-test.h | 2 |
4 files changed, 50 insertions, 4 deletions
diff --git a/test/.cvsignore b/test/.cvsignore index 48ef71e2..b60f6e79 100644 --- a/test/.cvsignore +++ b/test/.cvsignore @@ -23,6 +23,7 @@ path-data pdf-surface pdf-surface.pdf pixman-rotate +quarter-over rel-path scale-source-surface-paint select-font-no-show-text @@ -40,6 +41,7 @@ trap-clip user-data xlib-surface *-image-out.png +*-xcb-out.png *-xlib-out.png *-diff.png *.la diff --git a/test/Makefile.am b/test/Makefile.am index d4ec0ca8..b71ff1d3 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -17,6 +17,7 @@ paint \ 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-ref.png \ 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 @@ paint_with_alpha_LDADD = $(LDADDS) 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) diff --git a/test/cairo-test.c b/test/cairo-test.c index cd54b96b..ac102ce0 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -193,20 +193,63 @@ cleanup_win32 (void *closure) #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; diff --git a/test/cairo-test.h b/test/cairo-test.h index fe70171c..6260daed 100644 --- a/test/cairo-test.h +++ b/test/cairo-test.h @@ -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, |