[cairo-commit] cairo/test .cvsignore, 1.64, 1.65 cairo-test.c, 1.70, 1.71

Carl Worth commit at pdx.freedesktop.org
Mon Dec 19 22:01:41 PST 2005


Committed by: cworth

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

Modified Files:
	.cvsignore cairo-test.c 
Log Message:

2005-12-19  Carl Worth  <cworth at cworth.org>

        * src/cairo-surface.c: (_cairo_surface_create_similar_solid):
        Use _cairo_surface_paint rather than _cairo_surface_fill_rectangle
        as only the former is guaranteed to work with all backends.

        * src/test-fallback-surface.c: Refine the comment describing this
        test surface.

        * src/Makefile.am:
        * src/test-meta-surface.c: (_test_meta_surface_create),
        (_test_meta_surface_create_for_data),
        (_test_meta_surface_create_similar), (_test_meta_surface_finish),
        (_test_meta_surface_acquire_source_image),
        (_test_meta_surface_release_source_image),
        (_test_meta_surface_show_page),
        (_test_meta_surface_intersect_clip_path),
        (_test_meta_surface_get_extents), (_test_meta_surface_paint),
        (_test_meta_surface_mask), (_test_meta_surface_stroke),
        (_test_meta_surface_fill), (_test_meta_surface_show_glyphs),
        (_test_meta_surface_snapshot): Add new test surface for exercising
        cairo_meta_surface.

        * test/.cvsignore:
        * test/cairo-test.c: (create_image_surface),
        (create_test_fallback_surface), (create_test_meta_surface),
        (cairo_test_for_target), (cairo_test_expecting): Simplify the
        image and test_fallback targets by not using
        create_for_data. Allow for NULL cleanup target functions. Add
        support for the test_meta_surface.


Index: .cvsignore
===================================================================
RCS file: /cvs/cairo/cairo/test/.cvsignore,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- .cvsignore	19 Dec 2005 22:18:06 -0000	1.64
+++ .cvsignore	20 Dec 2005 06:01:39 -0000	1.65
@@ -89,6 +89,7 @@
 *-svg-rgb24-out.png
 *-svg-rgb24-out.svg
 *-test-fallback-argb32-out.png
+*-test-meta-argb32-out.png
 *-xcb-out.png
 *-xcb-argb32-out.png
 *-xcb-rgb24-out.png

Index: cairo-test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- cairo-test.c	19 Dec 2005 21:59:35 -0000	1.70
+++ cairo-test.c	20 Dec 2005 06:01:39 -0000	1.71
@@ -182,48 +182,29 @@
 create_image_surface (cairo_test_t *test, cairo_format_t format,
 		      void **closure)
 {
-    int stride = 4 * test->width;
-    unsigned char *buf;
-
-    *closure = buf = xcalloc (stride * test->height, 1);
-
-    return cairo_image_surface_create_for_data (buf, format,
-						test->width, test->height, stride);
-}
-
-static void
-cleanup_image (void *closure)
-{
-    unsigned char *buf = closure;
-
-    free (buf);
+    *closure = NULL;
+    return cairo_image_surface_create (format, test->width, test->height);
 }
 
 #ifdef CAIRO_HAS_TEST_SURFACES
 
 #include "test-fallback-surface.h"
+#include "test-meta-surface.h"
 
 static cairo_surface_t *
 create_test_fallback_surface (cairo_test_t *test, cairo_format_t format,
 			      void **closure)
 {
-    int stride = 4 * test->width;
-    unsigned char *data;
-
-    *closure = data = xcalloc (stride * test->height, 1);
-
-    return _test_fallback_surface_create_for_data (data, format,
-						   test->width,
-						   test->height,
-						   stride);
+    *closure = NULL;
+    return _test_fallback_surface_create (format, test->width, test->height);
 }
 
-static void
-cleanup_test_fallback (void *closure)
+static cairo_surface_t *
+create_test_meta_surface (cairo_test_t *test, cairo_format_t format,
+			  void **closure)
 {
-    unsigned char *data = closure;
-
-    free (data);
+    *closure = NULL;
+    return _test_meta_surface_create (format, test->width, test->height);
 }
 
 #endif
@@ -1288,7 +1269,8 @@
 
     cairo_debug_reset_static_data ();
 
-    target->cleanup_target (target->closure);
+    if (target->cleanup_target)
+	target->cleanup_target (target->closure);
 
 UNWIND_STRINGS:
     free (png_name);
@@ -1309,15 +1291,14 @@
     cairo_test_target_t targets[] = 
 	{
 	    { "image", CAIRO_FORMAT_ARGB32,
-		create_image_surface, cairo_surface_write_to_png, 
-		cleanup_image }, 
+	      create_image_surface, cairo_surface_write_to_png, NULL},
 	    { "image", CAIRO_FORMAT_RGB24, 
-		create_image_surface, cairo_surface_write_to_png,
-		cleanup_image }, 
+	      create_image_surface, cairo_surface_write_to_png, NULL},
 #ifdef CAIRO_HAS_TEST_SURFACES
 	    { "test-fallback", CAIRO_FORMAT_ARGB32,
-	        create_test_fallback_surface, cairo_surface_write_to_png,
-	        cleanup_test_fallback },
+	      create_test_fallback_surface, cairo_surface_write_to_png, NULL },
+	    { "test-meta", CAIRO_FORMAT_ARGB32,
+	      create_test_meta_surface, cairo_surface_write_to_png, NULL },
 #endif
 #ifdef CAIRO_HAS_GLITZ_SURFACE
 #if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE



More information about the cairo-commit mailing list