[cairo-commit]
cairo/test .cvsignore, 1.53, 1.54 cairo-test.c, 1.59, 1.60
Carl Worth
commit at pdx.freedesktop.org
Thu Oct 6 11:32:56 PDT 2005
Committed by: cworth
Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv26924/test
Modified Files:
.cvsignore cairo-test.c
Log Message:
2005-10-06 Carl Worth <cworth at cworth.org>
* src/cairo-xlib-surface.c: (_draw_image_surface): Add missing
initialization for ximage.xoffset.
Index: .cvsignore
===================================================================
RCS file: /cvs/cairo/cairo/test/.cvsignore,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- .cvsignore 27 Sep 2005 18:35:18 -0000 1.53
+++ .cvsignore 6 Oct 2005 18:32:54 -0000 1.54
@@ -71,8 +71,14 @@
user-data
xlib-surface
*-image-out.png
+*-image-argb32-out.png
+*-image-rgb24-out.png
*-xcb-out.png
+*-xcb-argb32-out.png
+*-xcb-rgb24-out.png
*-xlib-out.png
+*-xlib-argb32-out.png
+*-xlib-rgb24-out.png
*-diff.png
*.la
*.lo
Index: cairo-test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- cairo-test.c 29 Sep 2005 21:31:08 -0000 1.59
+++ cairo-test.c 6 Oct 2005 18:32:54 -0000 1.60
@@ -144,7 +144,8 @@
}
typedef cairo_surface_t *
-(*cairo_test_create_target_surface_t) (cairo_test_t *test, void **closure);
+(*cairo_test_create_target_surface_t) (cairo_test_t *test, cairo_format_t format,
+ void **closure);
typedef cairo_status_t
(*cairo_test_write_to_png_t) (cairo_surface_t *surface, const char *filename);
@@ -175,28 +176,15 @@
}
static cairo_surface_t *
-create_argb_image_surface (cairo_test_t *test, 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,
- CAIRO_FORMAT_ARGB32,
- test->width, test->height, stride);
-}
-
-static cairo_surface_t *
-create_rgb_image_surface (cairo_test_t *test, void **closure)
+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,
- CAIRO_FORMAT_RGB24,
+ return cairo_image_surface_create_for_data (buf, format,
test->width, test->height, stride);
}
@@ -414,7 +402,8 @@
} xlib_target_closure_t;
static cairo_surface_t *
-create_xlib_surface (cairo_test_t *test, void **closure)
+create_xlib_surface (cairo_test_t *test, cairo_format_t format,
+ void **closure)
{
int width = test->width;
int height = test->height;
@@ -446,7 +435,17 @@
* extension. That would probably be through another
* cairo_test_target which would use an extended version of
* cairo_test_xlib_disable_render. */
- xrender_format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
+ switch (format) {
+ case CAIRO_FORMAT_ARGB32:
+ xrender_format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
+ break;
+ case CAIRO_FORMAT_RGB24:
+ xrender_format = XRenderFindStandardFormat (dpy, PictStandardRGB24);
+ break;
+ default:
+ cairo_test_log ("Invalid format for xlib test: %d\n", format);
+ return NULL;
+ }
if (xrender_format == NULL) {
cairo_test_log ("X server does not have the Render extension.\n");
return NULL;
@@ -569,7 +568,7 @@
target->name, format, CAIRO_TEST_DIFF_SUFFIX);
/* Run the actual drawing code. */
- surface = (target->create_target_surface) (test, &target->closure);
+ surface = (target->create_target_surface) (test, target->reference_format, &target->closure);
if (surface == NULL) {
cairo_test_log ("Error: Failed to set %s target\n", target->name);
ret = CAIRO_TEST_UNTESTED;
@@ -646,10 +645,10 @@
cairo_test_target_t targets[] =
{
{ "image", CAIRO_FORMAT_ARGB32,
- create_argb_image_surface, cairo_surface_write_to_png,
+ create_image_surface, cairo_surface_write_to_png,
cleanup_image },
{ "image", CAIRO_FORMAT_RGB24,
- create_rgb_image_surface, cairo_surface_write_to_png,
+ create_image_surface, cairo_surface_write_to_png,
cleanup_image },
#if 0 /* #ifdef CAIRO_HAS_GLITZ_SURFACE */
{ "glitz", CAIRO_FORMAT_ARGB32,
@@ -673,6 +672,8 @@
#if CAIRO_HAS_XLIB_SURFACE
{ "xlib", CAIRO_FORMAT_ARGB32,
create_xlib_surface, cairo_surface_write_to_png, cleanup_xlib},
+ { "xlib", CAIRO_FORMAT_RGB24,
+ create_xlib_surface, cairo_surface_write_to_png, cleanup_xlib},
#endif
#if CAIRO_HAS_PS_SURFACE
{ "ps", CAIRO_FORMAT_RGB24,
More information about the cairo-commit
mailing list