[cairo-commit] cairo/test .cvsignore, 1.11, 1.12 Makefile.am, 1.25,
1.26 buffer-diff.c, 1.2, 1.3 buffer-diff.h, 1.1,
1.2 cairo-test.c, 1.15, 1.16 cairo-test.h, 1.4,
1.5 create-for-png-ref.png, NONE, 1.1 create-for-png.c, NONE,
1.1 write-png.c, 1.5, 1.6 write-png.h, 1.2, 1.3
Carl Worth
commit at pdx.freedesktop.org
Mon Apr 4 09:47:14 PDT 2005
- Previous message: [cairo-commit] cairo/src cairo-ft-font.c, 1.50,
1.51 cairo-image-surface.c, 1.32, 1.33 cairo-pattern.c, 1.27,
1.28 cairo-png.c, 1.2, 1.3 cairo-xlib-surface.c, 1.54,
1.55 cairo.c, 1.69, 1.70 cairo.h, 1.89, 1.90
- Next message: [cairo-commit] pycairo ChangeLog,1.66,1.67
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: cworth
Update of /cvs/cairo/cairo/test
In directory gabe:/tmp/cvs-serv24319/test
Modified Files:
.cvsignore Makefile.am buffer-diff.c buffer-diff.h
cairo-test.c cairo-test.h write-png.c write-png.h
Added Files:
create-for-png-ref.png create-for-png.c
Log Message:
* src/cairo.h (cairo_set_target_image,
cairo_image_surface_create_for_data):
* src/cairo.c: (cairo_set_target_image): Change type of data
parameter from char* to unsigned char*.
* src/cairo-ft-font.c: (_cairo_ft_font_create_glyph):
* src/cairo-image-surface.c: (cairo_image_surface_create_for_data):
* src/cairo-pattern.c:
(_cairo_pattern_acquire_surface_for_gradient):
* test/buffer-diff.c: (buffer_diff):
* test/buffer-diff.h:
* test/write-png.c: (write_png_argb32):
* test/write-png.h: Propagate the unsigned char* change down the
stack.
* src/cairo-xlib-surface.c: (_get_image_surface): Add cast since
XImage uses char* rather than unsigned char*.
* src/cairo-png.c: (cairo_image_surface_create_for_png): Fix
memory leak of image data.
* test/cairo-test.c: (cairo_test), (cairo_test_create_png_pattern):
* test/cairo-test.h: Switch to use cairo_surface_write_png rather
than a custom write_png_argb32.
* test/.cvsignore:
* test/Makefile.am:
* test/create-for-png-ref.png:
* test/create-for-png.c: (draw), (main): Add test to exercise the
cairo_image_surface_create_for_png function.
Index: .cvsignore
===================================================================
RCS file: /cvs/cairo/cairo/test/.cvsignore,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- .cvsignore 29 Mar 2005 08:02:19 -0000 1.11
+++ .cvsignore 4 Apr 2005 16:47:12 -0000 1.12
@@ -4,6 +4,7 @@
Makefile.in
clip-twice
coverage
+create-for-png
fill-rule
get-and-set
imagediff
Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo/test/Makefile.am,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- Makefile.am 2 Apr 2005 14:00:32 -0000 1.25
+++ Makefile.am 4 Apr 2005 16:47:12 -0000 1.26
@@ -2,6 +2,7 @@
TESTS = \
clip-twice \
coverage \
+create-for-png \
fill-rule \
get-and-set \
leaky-polygon \
@@ -18,6 +19,7 @@
# this list. Anyone know a good way to avoid it? Can I use a wildcard
# here?
EXTRA_DIST = \
+create-for-png-ref.png \
fill-rule-ref.png \
leaky-polygon-ref.png \
line-width-ref.png \
@@ -73,6 +75,7 @@
# from autogen.sh. My, but this is painful...
clip_twice_LDADD = $(LDADDS)
coverage_LDADD = $(LDADDS)
+create_for_png_LDADD = $(LDADDS)
fill_rule_LDADD = $(LDADDS)
get_and_set_LDADD = $(LDADDS)
leaky_polygon_LDADD = $(LDADDS)
Index: buffer-diff.c
===================================================================
RCS file: /cvs/cairo/cairo/test/buffer-diff.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- buffer-diff.c 29 Mar 2005 08:02:19 -0000 1.2
+++ buffer-diff.c 4 Apr 2005 16:47:12 -0000 1.3
@@ -31,8 +31,10 @@
* images differ.
*/
int
-buffer_diff (char *buf_a, char *buf_b, char *buf_diff,
- int width, int height, int stride)
+buffer_diff (unsigned char *buf_a,
+ unsigned char *buf_b,
+ unsigned char *buf_diff,
+ int width, int height, int stride)
{
int x, y;
int total_pixels_changed = 0;
Index: buffer-diff.h
===================================================================
RCS file: /cvs/cairo/cairo/test/buffer-diff.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- buffer-diff.h 25 Jan 2005 22:45:31 -0000 1.1
+++ buffer-diff.h 4 Apr 2005 16:47:12 -0000 1.2
@@ -32,7 +32,9 @@
* images differ.
*/
int
-buffer_diff (char *buf_a, char *buf_b, char *buf_diff,
+buffer_diff (unsigned char *buf_a,
+ unsigned char *buf_b,
+ unsigned char *buf_diff,
int width, int height, int stride);
#endif
Index: cairo-test.c
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cairo-test.c 29 Mar 2005 08:02:19 -0000 1.15
+++ cairo-test.c 4 Apr 2005 16:47:12 -0000 1.16
@@ -32,6 +32,8 @@
#include "cairo-test.h"
+#include <cairo-png.h>
+
#include "buffer-diff.h"
#include "read-png.h"
#include "write-png.h"
@@ -42,7 +44,7 @@
#define CAIRO_TEST_REF_SUFFIX "-ref.png"
#define CAIRO_TEST_DIFF_SUFFIX "-diff.png"
-static void
+void
xasprintf (char **strp, const char *fmt, ...)
{
#ifdef HAVE_VASPRINTF
@@ -105,7 +107,7 @@
char *log_name, *png_name, *ref_name, *diff_name;
char *srcdir;
int pixels_changed;
- int ref_width, ref_height, ref_stride;
+ unsigned int ref_width, ref_height, ref_stride;
read_png_status_t png_status;
cairo_test_status_t ret;
FILE *png_file;
@@ -150,8 +152,6 @@
return CAIRO_TEST_FAILURE;
}
- cairo_destroy (cr);
-
/* Skip image check for tests with no image (width,height == 0,0) */
if (test->width == 0 || test->height == 0) {
free (png_buf);
@@ -160,9 +160,11 @@
}
png_file = fopen (png_name, "wb");
- write_png_argb32 (png_buf, png_file, test->width, test->height, stride);
+ cairo_surface_write_png (cairo_get_target_surface (cr), png_file);
fclose (png_file);
+ cairo_destroy (cr);
+
ref_buf = NULL;
png_status = (read_png_argb32 (ref_name, &ref_buf, &ref_width, &ref_height, &ref_stride));
if (png_status) {
@@ -236,7 +238,7 @@
cairo_surface_t *image;
cairo_pattern_t *pattern;
unsigned char *buffer;
- int w, h, stride;
+ unsigned int w, h, stride;
read_png_status_t status;
char *srcdir = getenv ("srcdir");
Index: cairo-test.h
===================================================================
RCS file: /cvs/cairo/cairo/test/cairo-test.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo-test.h 9 Mar 2005 21:58:20 -0000 1.4
+++ cairo-test.h 4 Apr 2005 16:47:12 -0000 1.5
@@ -50,6 +50,8 @@
cairo_pattern_t *
cairo_test_create_png_pattern (cairo_t *cr, const char *filename);
+void
+xasprintf (char **strp, const char *fmt, ...);
#endif
--- NEW FILE: create-for-png-ref.png ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: create-for-png.c ---
(This appears to be a binary file; contents omitted.)
Index: write-png.c
===================================================================
RCS file: /cvs/cairo/cairo/test/write-png.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- write-png.c 29 Mar 2005 08:02:19 -0000 1.5
+++ write-png.c 4 Apr 2005 16:47:12 -0000 1.6
@@ -55,7 +55,7 @@
}
void
-write_png_argb32 (char *buffer, FILE *file,
+write_png_argb32 (unsigned char *buffer, FILE *file,
int width, int height, int stride)
{
int i;
Index: write-png.h
===================================================================
RCS file: /cvs/cairo/cairo/test/write-png.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- write-png.h 25 Jan 2005 22:45:31 -0000 1.2
+++ write-png.h 4 Apr 2005 16:47:12 -0000 1.3
@@ -29,7 +29,7 @@
#define WRITE_PNG_H
void
-write_png_argb32 (char *buffer, FILE * file,
+write_png_argb32 (unsigned char *buffer, FILE * file,
int width, int height, int stride);
#endif
- Previous message: [cairo-commit] cairo/src cairo-ft-font.c, 1.50,
1.51 cairo-image-surface.c, 1.32, 1.33 cairo-pattern.c, 1.27,
1.28 cairo-png.c, 1.2, 1.3 cairo-xlib-surface.c, 1.54,
1.55 cairo.c, 1.69, 1.70 cairo.h, 1.89, 1.90
- Next message: [cairo-commit] pycairo ChangeLog,1.66,1.67
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list