[cairo-commit] cairo/src cairo-image-surface.c, 1.29, 1.30 cairo-surface.c, 1.49, 1.50 cairo.c, 1.66, 1.67 cairo.h, 1.86, 1.87 cairoint.h, 1.113, 1.114

Carl Worth commit at pdx.freedesktop.org
Fri Apr 1 18:00:03 PST 2005


Committed by: cworth

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

Modified Files:
	cairo-image-surface.c cairo-surface.c cairo.c cairo.h 
	cairoint.h 
Log Message:

        * TODO: Update API shakeup chart.

        * src/cairo.h:
        * src/cairo.c: (cairo_set_target_image_no_data): Add a standin for
        the function that should be cairo_set_target_image which should
        then have some other name. We can straighten that mess out when we
        eliminate the set_target functions. Add deprecation alias for
        cairo_current_pattern.

        * src/cairoint.h:
        * src/cairo-image-surface.c:
        * src/cairo-surface.c: Deprecate cairo_surface_create_for_image in
        favor of cairo_image_surface_create_for_data.


Index: cairo-image-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-image-surface.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- cairo-image-surface.c	16 Mar 2005 20:08:41 -0000	1.29
+++ cairo-image-surface.c	2 Apr 2005 02:00:00 -0000	1.30
@@ -223,6 +223,7 @@
 
     return &surface->base;
 }
+DEPRECATE(cairo_surface_create_for_image, cairo_image_surface_create_for_data);
 
 static cairo_surface_t *
 _cairo_image_surface_create_similar (void		*abstract_src,

Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- cairo-surface.c	17 Mar 2005 20:57:43 -0000	1.49
+++ cairo-surface.c	2 Apr 2005 02:00:00 -0000	1.50
@@ -65,17 +65,6 @@
 }
 
 cairo_surface_t *
-cairo_surface_create_for_image (char		*data,
-				cairo_format_t	format,
-				int		width,
-				int		height,
-				int		stride)
-{
-    return cairo_image_surface_create_for_data (data, format, width, height, stride);
-}
-slim_hidden_def(cairo_surface_create_for_image);
-
-cairo_surface_t *
 _cairo_surface_create_similar_scratch (cairo_surface_t	*other,
 				       cairo_format_t	format,
 				       int		drawable,

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- cairo.c	31 Mar 2005 21:25:44 -0000	1.66
+++ cairo.c	2 Apr 2005 02:00:00 -0000	1.67
@@ -324,7 +324,7 @@
  * Directs output for a #cairo_t to an in-memory image. The output
  * buffer must be kept around until the #cairo_t is destroyed or set
  * to to have a different target.  The initial contents of @buffer
- * will be used as the inital image contents; you must explicitely
+ * will be used as the inital image contents; you must explicitly
  * clear the buffer, using, for example, cairo_rectangle() and
  * cairo_fill() if you want it cleared.
  **/
@@ -342,9 +342,50 @@
     if (cr->status)
 	return;
 
-    surface = cairo_surface_create_for_image (data,
-					      format,
-					      width, height, stride);
+    surface = cairo_image_surface_create_for_data (data,
+						   format,
+						   width, height, stride);
+    if (surface == NULL) {
+	cr->status = CAIRO_STATUS_NO_MEMORY;
+	CAIRO_CHECK_SANITY (cr);
+	return;
+    }
+
+    cairo_set_target_surface (cr, surface);
+
+    cairo_surface_destroy (surface);
+    CAIRO_CHECK_SANITY (cr);
+}
+
+/**
+ * cairo_set_target_image_no_data:
+ * @cr: a #cairo_t
+ * @format: the format of pixels in the buffer
+ * @width: the width of the image to be stored in the buffer
+ * @height: the eight of the image to be stored in the buffer
+ * 
+ * Directs output for a #cairo_t to an implicit image surface of the
+ * given format that will be created and owned by the cairo
+ * context. The initial contents of the target surface will be
+ * cleared to 0 in all channels, (ie. transparent black).
+ *
+ * NOTE: This function has an unconventional name, but that will be
+ * straightened out in a future change in which all set_target
+ * functions will be renamed.
+ **/
+void
+cairo_set_target_image_no_data (cairo_t		*cr,
+				cairo_format_t	format,
+				int		width,
+				int		height)
+{
+    cairo_surface_t *surface;
+
+    CAIRO_CHECK_SANITY (cr);
+    if (cr->status)
+	return;
+
+    surface = cairo_image_surface_create (format, width, height);
     if (surface == NULL) {
 	cr->status = CAIRO_STATUS_NO_MEMORY;
 	CAIRO_CHECK_SANITY (cr);
@@ -687,6 +728,7 @@
     CAIRO_CHECK_SANITY (cr);
     return _cairo_gstate_get_pattern (cr->gstate);
 }
+DEPRECATE(cairo_current_pattern, cairo_get_pattern);
 
 /**
  * cairo_set_tolerance:

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- cairo.h	23 Mar 2005 21:31:01 -0000	1.86
+++ cairo.h	2 Apr 2005 02:00:00 -0000	1.87
@@ -173,7 +173,10 @@
     CAIRO_FORMAT_A1
 } cairo_format_t;
 
-/* XXX: Need to add cairo_set_target_image_data */
+/* XXX: The naming of these two functions is reversed from their
+ *      cairo_image_surface_create counterparts. We'll fix this when
+ *      we eliminate all the cairo_set_target functions.
+ */
 void
 cairo_set_target_image (cairo_t	*cr,
 			char		*data,
@@ -182,6 +185,12 @@
 			int		height,
 			int		stride);
 
+void
+cairo_set_target_image_no_data (cairo_t	*cr,
+				cairo_format_t	format,
+				int	width,
+				int	height);
+
 typedef enum cairo_operator { 
     CAIRO_OPERATOR_CLEAR,
     CAIRO_OPERATOR_SRC,
@@ -825,14 +834,6 @@
 typedef void (*cairo_destroy_func_t) (void *data);
 
 /* Surface manipulation */
-/* XXX: We may want to rename this function in light of the new
-   virtualized surface backends... */
-cairo_surface_t *
-cairo_surface_create_for_image (char           *data,
-				cairo_format_t  format,
-				int             width,
-				int             height,
-				int             stride);
 
 /* XXX: I want to remove this function, (replace with
    cairo_set_target_scratch or similar). */
@@ -1070,6 +1071,7 @@
 #define cairo_inverse_transform_point	 cairo_inverse_transform_point_DEPRECATED_BY_cairo_device_to_user
 #define cairo_inverse_transform_distance cairo_inverse_transform_distance_DEPRECATED_BY_cairo_device_to_user_distance
 #define cairo_init_clip			 cairo_init_clip_DEPRECATED_BY_cairo_reset_clip
+#define cairo_surface_create_for_image	 cairo_surface_create_for_image_DEPRECATED_BY_cairo_image_surface_create_for_data
 
 #else /* CAIRO_API_SHAKEUP_FLAG_DAY */
 
@@ -1097,6 +1099,7 @@
 #define cairo_inverse_transform_point	 cairo_device_to_user
 #define cairo_inverse_transform_distance cairo_device_to_user_distance
 #define cairo_init_clip			 cairo_reset_clip
+#define cairo_surface_create_for_image	 cairo_image_surface_create_for_data
 
 #endif /* CAIRO_API_SHAKEUP_FLAG_DAY */
 

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- cairoint.h	29 Mar 2005 19:48:58 -0000	1.113
+++ cairoint.h	2 Apr 2005 02:00:00 -0000	1.114
@@ -1777,7 +1777,6 @@
 slim_hidden_proto(cairo_restore)
 slim_hidden_proto(cairo_save)
 slim_hidden_proto(cairo_set_target_surface)
-slim_hidden_proto(cairo_surface_create_for_image)
 slim_hidden_proto(cairo_surface_destroy)
 slim_hidden_proto(cairo_surface_get_matrix)
 slim_hidden_proto(cairo_surface_set_matrix)




More information about the cairo-commit mailing list