[cairo-commit] cairo/src cairo_pattern.c, 1.14, 1.15 cairoint.h, 1.89, 1.90

Kristian Hogsberg commit at pdx.freedesktop.org
Thu Jan 27 21:14:08 PST 2005


Committed by: krh

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

Modified Files:
	cairo_pattern.c cairoint.h 
Log Message:
2005-01-27  Kristian Høgsberg  <krh at redhat.com>

        * src/cairo_pattern.c (_cairo_pattern_get_surface): Make sure we
        always return a surface similar to dst in the gradient case.



Index: cairo_pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_pattern.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cairo_pattern.c	28 Jan 2005 03:57:32 -0000	1.14
+++ cairo_pattern.c	28 Jan 2005 05:14:06 -0000	1.15
@@ -705,14 +705,31 @@
 	*x_offset = x;
 	*y_offset = y;
 
-	surface = cairo_image_surface_create_for_data (data,
-						       CAIRO_FORMAT_ARGB32,
-						       width, height,
-						       width * 4);
+	image = (cairo_image_surface_t *)
+	    cairo_image_surface_create_for_data (data,
+						 CAIRO_FORMAT_ARGB32,
+						 width, height,
+						 width * 4);
 	
-	if (surface)
-	    _cairo_image_surface_assume_ownership_of_data (
-		(cairo_image_surface_t *) surface);
+	if (image == NULL) {
+	    free (data);
+	    return NULL;
+	}
+
+	_cairo_image_surface_assume_ownership_of_data (image);
+	if (image->base.backend == dst->backend)
+	    return &image->base;
+
+	surface = cairo_surface_create_similar (dst,
+						CAIRO_FORMAT_ARGB32,
+						width, height);
+	if (surface == NULL) {
+	    cairo_surface_destroy (&image->base);
+	    return NULL;
+	}
+
+	_cairo_surface_set_image (surface, image);
+	cairo_surface_destroy (&image->base);
 
 	return surface;
 

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- cairoint.h	28 Jan 2005 01:21:13 -0000	1.89
+++ cairoint.h	28 Jan 2005 05:14:06 -0000	1.90
@@ -1653,15 +1653,6 @@
 				    cairo_fixed_t factor,
 				    int *pixel);
 
-cairo_private cairo_image_surface_t *
-_cairo_pattern_get_image (cairo_pattern_t	*pattern,
-			  int			x,
-			  int			y,
-			  unsigned int		width,
-			  unsigned int		height,
-			  int			*x_offset,
-			  int			*y_offset);
-
 cairo_private cairo_surface_t *
 _cairo_pattern_get_surface (cairo_pattern_t	*pattern,
 			    cairo_surface_t	*dst,




More information about the cairo-commit mailing list