[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

Carl Worth commit at pdx.freedesktop.org
Mon Apr 4 09:47:14 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv24319/src

Modified Files:
	cairo-ft-font.c cairo-image-surface.c cairo-pattern.c 
	cairo-png.c cairo-xlib-surface.c cairo.c cairo.h 
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: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- cairo-ft-font.c	2 Apr 2005 13:18:11 -0000	1.50
+++ cairo-ft-font.c	4 Apr 2005 16:47:12 -0000	1.51
@@ -1273,7 +1273,7 @@
 	}
 	
 	val->image = (cairo_image_surface_t *)
-	cairo_image_surface_create_for_data ((char *) bitmap.buffer,
+	cairo_image_surface_create_for_data (bitmap.buffer,
 					     CAIRO_FORMAT_A8,
 					     width, height, stride);
 	if (val->image == NULL) {

Index: cairo-image-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-image-surface.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cairo-image-surface.c	4 Apr 2005 13:49:19 -0000	1.32
+++ cairo-image-surface.c	4 Apr 2005 16:47:12 -0000	1.33
@@ -195,7 +195,7 @@
  *   be created because of lack of memory
  **/
 cairo_surface_t *
-cairo_image_surface_create_for_data (char	       *data,
+cairo_image_surface_create_for_data (unsigned char     *data,
 				     cairo_format_t	format,
 				     int		width,
 				     int		height,

Index: cairo-pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pattern.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- cairo-pattern.c	6 Mar 2005 20:05:23 -0000	1.27
+++ cairo-pattern.c	4 Apr 2005 16:47:12 -0000	1.28
@@ -889,9 +889,9 @@
 					     cairo_surface_attributes_t *attr)
 {
     cairo_image_surface_t *image;
-    cairo_status_t	  status;
-    uint32_t		  *data;
-    cairo_bool_t          repeat = FALSE;
+    cairo_status_t status;
+    uint32_t *data;
+    cairo_bool_t repeat = FALSE;
 
     if (pattern->base.type == CAIRO_PATTERN_LINEAR) {
 	cairo_bool_t is_horizontal;
@@ -935,7 +935,7 @@
     }
 
     image = (cairo_image_surface_t *)
-	cairo_image_surface_create_for_data ((char *) data,
+	cairo_image_surface_create_for_data ((unsigned char *) data,
 					     CAIRO_FORMAT_ARGB32,
 					     width, height,
 					     width * 4);

Index: cairo-png.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-png.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cairo-png.c	2 Apr 2005 13:18:11 -0000	1.2
+++ cairo-png.c	4 Apr 2005 16:47:12 -0000	1.3
@@ -228,6 +228,7 @@
 cairo_surface_t *
 cairo_image_surface_create_for_png (FILE *file, int *width, int *height)
 {
+    cairo_surface_t *surface;
     png_byte *data;
     int i;
     static const int PNG_SIG_SIZE = 8;
@@ -322,8 +323,12 @@
     if (height != NULL)
 	*height = png_height;
 
-    return cairo_image_surface_create_for_data ((char *)data, CAIRO_FORMAT_ARGB32,
-						png_width, png_height, stride);
+    surface = cairo_image_surface_create_for_data (data,
+						   CAIRO_FORMAT_ARGB32,
+						   png_width, png_height, stride);
+    _cairo_image_surface_assume_ownership_of_data ((cairo_image_surface_t*)surface);
+
+    return surface;
 
  BAIL3:
     free (data);

Index: cairo-xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- cairo-xlib-surface.c	4 Apr 2005 13:49:19 -0000	1.54
+++ cairo-xlib-surface.c	4 Apr 2005 16:47:12 -0000	1.55
@@ -282,7 +282,7 @@
 							ximage->bytes_per_line);
     } else {
 	image = (cairo_image_surface_t *)
-	    cairo_image_surface_create_for_data (ximage->data,
+	    cairo_image_surface_create_for_data ((unsigned char*) ximage->data,
 						 surface->format,
 						 ximage->width, 
 						 ximage->height,

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- cairo.c	4 Apr 2005 13:49:19 -0000	1.69
+++ cairo.c	4 Apr 2005 16:47:12 -0000	1.70
@@ -330,7 +330,7 @@
  **/
 void
 cairo_set_target_image (cairo_t		*cr,
-			char		*data,
+			unsigned char	*data,
 			cairo_format_t	 format,
 			int		 width,
 			int		 height,

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- cairo.h	4 Apr 2005 13:49:19 -0000	1.89
+++ cairo.h	4 Apr 2005 16:47:12 -0000	1.90
@@ -179,7 +179,7 @@
  */
 void
 cairo_set_target_image (cairo_t	       *cr,
-			char  	       *data,
+			unsigned char  *data,
 			cairo_format_t	format,
 			int		width,
 			int		height,
@@ -914,7 +914,7 @@
 			    int			height);
 
 cairo_surface_t *
-cairo_image_surface_create_for_data (char		       *data,
+cairo_image_surface_create_for_data (unsigned char	       *data,
 				     cairo_format_t		format,
 				     int			width,
 				     int			height,




More information about the cairo-commit mailing list