[cairo-commit] cairo/src cairo.c, 1.61, 1.62 cairo_glitz_surface.c, 1.26, 1.27 cairo_pdf_surface.c, 1.20, 1.21 cairo_png_surface.c, 1.19, 1.20 cairo_ps_surface.c, 1.27, 1.28 cairo_win32_surface.c, 1.11, 1.12 cairo_xcb_surface.c, 1.18, 1.19 cairo_xlib_surface.c, 1.51, 1.52

Carl Worth commit at pdx.freedesktop.org
Wed Mar 23 13:49:35 PST 2005


Committed by: cworth

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

Modified Files:
	cairo.c cairo_glitz_surface.c cairo_pdf_surface.c 
	cairo_png_surface.c cairo_ps_surface.c cairo_win32_surface.c 
	cairo_xcb_surface.c cairo_xlib_surface.c 
Log Message:

        * src/cairo.c: (cairo_set_target_glitz), (cairo_set_target_pdf),
        (cairo_set_target_pdf_as_file), (cairo_set_target_png),
        (cairo_set_target_ps), (cairo_set_target_win32),
        (cairo_set_target_xcb), (cairo_set_target_drawable): Move
        surface-specific cairo_t functions to cairo.c.

        * src/cairo_glitz_surface.c:
        * src/cairo_pdf_surface.c:
        * src/cairo_png_surface.c:
        * src/cairo_ps_surface.c:
        * src/cairo_win32_surface.c:
        * src/cairo_xcb_surface.c:
        * src/cairo_xlib_surface.c: Remove functions that have now moved
        to cairo.c.

        * test/.cvsignore: A few new files to ignore now with new
        compilation mode using a libtool helper library.


Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- cairo.c	21 Mar 2005 07:23:19 -0000	1.61
+++ cairo.c	23 Mar 2005 21:49:33 -0000	1.62
@@ -355,6 +355,271 @@
     CAIRO_CHECK_SANITY (cr);
 }
 
+#ifdef CAIRO_HAS_GLITZ_SURFACE
+
+#include "cairo-glitz.h"
+
+void
+cairo_set_target_glitz (cairo_t *cr, glitz_surface_t *surface)
+{
+    cairo_surface_t *crsurface;
+
+    CAIRO_CHECK_SANITY (cr);
+    if (cr->status)
+	return;
+
+    crsurface = cairo_glitz_surface_create (surface);
+    if (crsurface == NULL) {
+	cr->status = CAIRO_STATUS_NO_MEMORY;
+	return;
+    }
+
+    cairo_set_target_surface (cr, crsurface);
+
+    cairo_surface_destroy (crsurface);
+
+    CAIRO_CHECK_SANITY (cr);
+}
+#endif /* CAIRO_HAS_GLITZ_SURFACE */
+
+#ifdef CAIRO_HAS_PDF_SURFACE
+
+#include "cairo-pdf.h"
+
+void
+cairo_set_target_pdf (cairo_t			*cr,
+		      cairo_write_func_t	write,
+		      cairo_destroy_func_t	destroy_closure,
+		      void			*closure,
+		      double			width_inches,
+		      double			height_inches,
+		      double			x_pixels_per_inch,
+		      double			y_pixels_per_inch)
+{
+    cairo_surface_t *surface;
+
+    CAIRO_CHECK_SANITY (cr);
+    if (cr->status)
+	return;
+
+    surface = cairo_pdf_surface_create (write, destroy_closure, closure,
+					width_inches, height_inches,
+					x_pixels_per_inch, y_pixels_per_inch);
+    if (surface == NULL) {
+	cr->status = CAIRO_STATUS_NO_MEMORY;
+	return;
+    }
+
+    cairo_set_target_surface (cr, surface);
+
+    /* cairo_set_target_surface takes a reference, so we must destroy ours */
+    cairo_surface_destroy (surface);
+}
+
+void
+cairo_set_target_pdf_as_file (cairo_t	*cr,
+			      FILE	*fp,
+			      double	width_inches,
+			      double	height_inches,
+			      double	x_pixels_per_inch,
+			      double	y_pixels_per_inch)
+{
+    cairo_surface_t *surface;
+
+    CAIRO_CHECK_SANITY (cr);
+    if (cr->status)
+	return;
+
+    surface = cairo_pdf_surface_create_for_file (fp,
+						 width_inches, height_inches,
+						 x_pixels_per_inch,
+						 y_pixels_per_inch);
+    if (surface == NULL) {
+	cr->status = CAIRO_STATUS_NO_MEMORY;
+	return;
+    }
+
+    cairo_set_target_surface (cr, surface);
+
+    /* cairo_set_target_surface takes a reference, so we must destroy ours */
+    cairo_surface_destroy (surface);
+}
+#endif /* CAIRO_HAS_PDF_SURFACE */
+
+#ifdef CAIRO_HAS_PNG_SURFACE
+
+#include "cairo-png.h"
+
+void
+cairo_set_target_png (cairo_t	*cr,
+		      FILE	*file,
+		      cairo_format_t	format,
+		      int	       	width,
+		      int		height)
+{
+    cairo_surface_t *surface;
+
+    surface = cairo_png_surface_create (file, format, 
+					width, height);
+
+    if (surface == NULL) {
+	cr->status = CAIRO_STATUS_NO_MEMORY;
+	return;
+    }
+
+    cairo_set_target_surface (cr, surface);
+
+    /* cairo_set_target_surface takes a reference, so we must destroy ours */
+    cairo_surface_destroy (surface);
+}
+#endif /* CAIRO_HAS_PNG_SURFACE */
+
+#ifdef CAIRO_HAS_PS_SURFACE
+
+#include "cairo-ps.h"
+
+/**
+ * cairo_set_target_ps:
+ * @cr: a #cairo_t
+ * @file: an open, writeable file
+ * @width_inches: width of the output page, in inches
+ * @height_inches: height of the output page, in inches
+ * @x_pixels_per_inch: X resolution to use for image fallbacks;
+ *   not all cairo drawing can be represented in a postscript
+ *   file, so cairo will write out images for some portions
+ *   of the output.
+ * @y_pixels_per_inch: Y resolution to use for image fallbacks.
+ * 
+ * Directs output for a #cairo_t to a postscript file. The file must
+ * be kept open until the #cairo_t is destroyed or set to have a
+ * different target, and then must be closed by the application.
+ **/
+void
+cairo_set_target_ps (cairo_t	*cr,
+		     FILE	*file,
+		     double	width_inches,
+		     double	height_inches,
+		     double	x_pixels_per_inch,
+		     double	y_pixels_per_inch)
+{
+    cairo_surface_t *surface;
+
+    surface = cairo_ps_surface_create (file,
+				       width_inches, height_inches,
+				       x_pixels_per_inch, y_pixels_per_inch);
+    if (surface == NULL) {
+	cr->status = CAIRO_STATUS_NO_MEMORY;
+	return;
+    }
+
+    cairo_set_target_surface (cr, surface);
+
+    /* cairo_set_target_surface takes a reference, so we must destroy ours */
+    cairo_surface_destroy (surface);
+}
+#endif /* CAIRO_HAS_PS_SURFACE */
+
+#ifdef CAIRO_HAS_WIN32_SURFACE
+
+#include "cairo-win32.h"
+
+void
+cairo_set_target_win32 (cairo_t *cr,
+			HDC      hdc)
+{
+    cairo_surface_t *surface;
+
+    if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
+	return;
+
+    surface = cairo_win32_surface_create (hdc);
+    if (surface == NULL) {
+	cr->status = CAIRO_STATUS_NO_MEMORY;
+	return;
+    }
+
+    cairo_set_target_surface (cr, surface);
+
+    /* cairo_set_target_surface takes a reference, so we must destroy ours */
+    cairo_surface_destroy (surface);
+}
+#endif /* CAIRO_HAS_WIN32_SURFACE */
+
+#ifdef CAIRO_HAS_XCB_SURFACE
+
+#include "cairo-xcb.h"
+
+void
+cairo_set_target_xcb (cairo_t		*cr,
+		      XCBConnection	*dpy,
+		      XCBDRAWABLE		drawable,
+		      XCBVISUALTYPE	*visual,
+		      cairo_format_t	format)
+{
+    cairo_surface_t *surface;
+
+    if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
+	    return;
+
+    surface = cairo_xcb_surface_create (dpy, drawable, visual, format);
+    if (surface == NULL) {
+	cr->status = CAIRO_STATUS_NO_MEMORY;
+	return;
+    }
+
+    cairo_set_target_surface (cr, surface);
+
+    /* cairo_set_target_surface takes a reference, so we must destroy ours */
+    cairo_surface_destroy (surface);
+}
+#endif /* CAIRO_HAS_XCB_SURFACE */
+
+#ifdef CAIRO_HAS_XLIB_SURFACE
+
+#include "cairo-xlib.h"
+
+/**
+ * cairo_set_target_drawable:
+ * @cr: a #cairo_t
+ * @dpy: an X display
+ * @drawable: a window or pixmap on the default screen of @dpy
+ * 
+ * Directs output for a #cairo_t to an Xlib drawable.  @drawable must
+ * be a Window or Pixmap on the default screen of @dpy using the
+ * default colormap and visual.  Using this function is slow because
+ * the function must retrieve information about @drawable from the X
+ * server.
+ 
+ * The combination of cairo_xlib_surface_create() and
+ * cairo_set_target_surface() is somewhat more flexible, although
+ * it still is slow.
+ **/
+void
+cairo_set_target_drawable (cairo_t	*cr,
+			   Display	*dpy,
+			   Drawable	drawable)
+{
+    cairo_surface_t *surface;
+
+    if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
+	    return;
+
+    surface = cairo_xlib_surface_create (dpy, drawable,
+					 DefaultVisual (dpy, DefaultScreen (dpy)),
+					 0,
+					 DefaultColormap (dpy, DefaultScreen (dpy)));
+    if (surface == NULL) {
+	cr->status = CAIRO_STATUS_NO_MEMORY;
+	return;
+    }
+
+    cairo_set_target_surface (cr, surface);
+
+    /* cairo_set_target_surface takes a reference, so we must destroy ours */
+    cairo_surface_destroy (surface);
+}
+#endif /* CAIRO_HAS_XLIB_SURFACE */
+
 /**
  * cairo_set_operator:
  * @cr: a #cairo_t

Index: cairo_glitz_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_glitz_surface.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- cairo_glitz_surface.c	16 Mar 2005 20:08:41 -0000	1.26
+++ cairo_glitz_surface.c	23 Mar 2005 21:49:33 -0000	1.27
@@ -27,25 +27,6 @@
 #include "cairoint.h"
 #include "cairo-glitz.h"
 
-void
-cairo_set_target_glitz (cairo_t *cr, glitz_surface_t *surface)
-{
-    cairo_surface_t *crsurface;
-
-    if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
-	return;
-
-    crsurface = cairo_glitz_surface_create (surface);
-    if (crsurface == NULL) {
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-	return;
-    }
-
-    cairo_set_target_surface (cr, crsurface);
-
-    cairo_surface_destroy (crsurface);
-}
-
 typedef struct _cairo_glitz_surface {
     cairo_surface_t   base;
 

Index: cairo_pdf_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_pdf_surface.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cairo_pdf_surface.c	18 Mar 2005 20:26:03 -0000	1.20
+++ cairo_pdf_surface.c	23 Mar 2005 21:49:33 -0000	1.21
@@ -2276,78 +2276,3 @@
 
     return CAIRO_STATUS_SUCCESS;
 }
-
-static void
-_cairo_set_target_pdf_as_stream (cairo_t		*cr,
-				 cairo_output_stream_t	*stream,
-				 double			width_inches,
-				 double			height_inches,
-				 double			x_pixels_per_inch,
-				 double			y_pixels_per_inch)
-{
-    cairo_surface_t *surface;
-
-    surface = _cairo_pdf_surface_create_for_stream (stream,
-						    width_inches,
-						    height_inches,
-						    x_pixels_per_inch,
-						    y_pixels_per_inch);
-
-    if (surface == NULL) {
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-	return;
-    }
-
-    cairo_set_target_surface (cr, surface);
-
-    /* cairo_set_target_surface takes a reference, so we must destroy ours */
-    cairo_surface_destroy (surface);
-}
-
-void
-cairo_set_target_pdf (cairo_t			*cr,
-		      cairo_write_func_t	write,
-		      cairo_destroy_func_t	destroy_closure,
-		      void			*closure,
-		      double			width_inches,
-		      double			height_inches,
-		      double			x_pixels_per_inch,
-		      double			y_pixels_per_inch)
-{
-    cairo_output_stream_t *stream;
-
-    stream = _cairo_output_stream_create (write, destroy_closure, closure);
-    if (stream == NULL) {
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-	return;
-    }
-
-    _cairo_set_target_pdf_as_stream (cr, stream,
-				     width_inches,
-				     height_inches,
-				     x_pixels_per_inch,
-				     y_pixels_per_inch);
-}
-
-void
-cairo_set_target_pdf_as_file (cairo_t	*cr,
-			      FILE	*fp,
-			      double	width_inches,
-			      double	height_inches,
-			      double	x_pixels_per_inch,
-			      double	y_pixels_per_inch)
-{
-    cairo_output_stream_t *stream;
-
-    stream = _cairo_output_stream_create_for_file (fp);
-    if (stream == NULL) {
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-	return;
-    }
-
-    _cairo_set_target_pdf_as_stream (cr, stream,
-				     width_inches,
-				     height_inches,
-				     x_pixels_per_inch,
-				     y_pixels_per_inch);
-}

Index: cairo_png_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_png_surface.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cairo_png_surface.c	16 Mar 2005 20:08:41 -0000	1.19
+++ cairo_png_surface.c	23 Mar 2005 21:49:33 -0000	1.20
@@ -45,29 +45,6 @@
 static cairo_int_status_t
 _cairo_png_surface_copy_page (void *abstract_surface);
 
-void
-cairo_set_target_png (cairo_t	*cr,
-		      FILE	*file,
-		      cairo_format_t	format,
-		      int	       	width,
-		      int		height)
-{
-    cairo_surface_t *surface;
-
-    surface = cairo_png_surface_create (file, format, 
-					width, height);
-
-    if (surface == NULL) {
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-	return;
-    }
-
-    cairo_set_target_surface (cr, surface);
-
-    /* cairo_set_target_surface takes a reference, so we must destroy ours */
-    cairo_surface_destroy (surface);
-}
-
 typedef struct cairo_png_surface {
     cairo_surface_t base;
 

Index: cairo_ps_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ps_surface.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- cairo_ps_surface.c	17 Mar 2005 21:27:26 -0000	1.27
+++ cairo_ps_surface.c	23 Mar 2005 21:49:33 -0000	1.28
@@ -42,46 +42,6 @@
 
 static const cairo_surface_backend_t cairo_ps_surface_backend;
 
-/**
- * cairo_set_target_ps:
- * @cr: a #cairo_t
- * @file: an open, writeable file
- * @width_inches: width of the output page, in inches
- * @height_inches: height of the output page, in inches
- * @x_pixels_per_inch: X resolution to use for image fallbacks;
- *   not all cairo drawing can be represented in a postscript
- *   file, so cairo will write out images for some portions
- *   of the output.
- * @y_pixels_per_inch: Y resolution to use for image fallbacks.
- * 
- * Directs output for a #cairo_t to a postscript file. The file must
- * be kept open until the #cairo_t is destroyed or set to have a
- * different target, and then must be closed by the application.
- **/
-void
-cairo_set_target_ps (cairo_t	*cr,
-		     FILE	*file,
-		     double	width_inches,
-		     double	height_inches,
-		     double	x_pixels_per_inch,
-		     double	y_pixels_per_inch)
-{
-    cairo_surface_t *surface;
-
-    surface = cairo_ps_surface_create (file,
-				       width_inches, height_inches,
-				       x_pixels_per_inch, y_pixels_per_inch);
-    if (surface == NULL) {
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-	return;
-    }
-
-    cairo_set_target_surface (cr, surface);
-
-    /* cairo_set_target_surface takes a reference, so we must destroy ours */
-    cairo_surface_destroy (surface);
-}
-
 typedef struct cairo_ps_surface {
     cairo_surface_t base;
 

Index: cairo_win32_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_win32_surface.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cairo_win32_surface.c	17 Mar 2005 21:27:26 -0000	1.11
+++ cairo_win32_surface.c	23 Mar 2005 21:49:33 -0000	1.12
@@ -76,27 +76,6 @@
     return CAIRO_STATUS_NO_MEMORY;
 }
 
-void
-cairo_set_target_win32 (cairo_t *cr,
-			HDC      hdc)
-{
-    cairo_surface_t *surface;
-
-    if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
-	return;
-
-    surface = cairo_win32_surface_create (hdc);
-    if (surface == NULL) {
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-	return;
-    }
-
-    cairo_set_target_surface (cr, surface);
-
-    /* cairo_set_target_surface takes a reference, so we must destroy ours */
-    cairo_surface_destroy (surface);
-}
-
 static cairo_status_t
 _create_dc_and_bitmap (cairo_win32_surface_t *surface,
 		       HDC                    original_dc,

Index: cairo_xcb_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_xcb_surface.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cairo_xcb_surface.c	16 Mar 2005 20:08:41 -0000	1.18
+++ cairo_xcb_surface.c	23 Mar 2005 21:49:33 -0000	1.19
@@ -158,30 +158,6 @@
     return ret;
 }
 
-void
-cairo_set_target_xcb (cairo_t		*cr,
-		      XCBConnection	*dpy,
-		      XCBDRAWABLE		drawable,
-		      XCBVISUALTYPE	*visual,
-		      cairo_format_t	format)
-{
-    cairo_surface_t *surface;
-
-    if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
-	    return;
-
-    surface = cairo_xcb_surface_create (dpy, drawable, visual, format);
-    if (surface == NULL) {
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-	return;
-    }
-
-    cairo_set_target_surface (cr, surface);
-
-    /* cairo_set_target_surface takes a reference, so we must destroy ours */
-    cairo_surface_destroy (surface);
-}
-
 typedef struct cairo_xcb_surface {
     cairo_surface_t base;
 

Index: cairo_xlib_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_xlib_surface.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- cairo_xlib_surface.c	17 Mar 2005 21:27:26 -0000	1.51
+++ cairo_xlib_surface.c	23 Mar 2005 21:49:33 -0000	1.52
@@ -46,47 +46,6 @@
 
 static void _cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface);
 
-/**
- * cairo_set_target_drawable:
- * @cr: a #cairo_t
- * @dpy: an X display
- * @drawable: a window or pixmap on the default screen of @dpy
- * 
- * Directs output for a #cairo_t to an Xlib drawable.  @drawable must
- * be a Window or Pixmap on the default screen of @dpy using the
- * default colormap and visual.  Using this function is slow because
- * the function must retrieve information about @drawable from the X
- * server.
- 
- * The combination of cairo_xlib_surface_create() and
- * cairo_set_target_surface() is somewhat more flexible, although
- * it still is slow.
- **/
-void
-cairo_set_target_drawable (cairo_t	*cr,
-			   Display	*dpy,
-			   Drawable	drawable)
-{
-    cairo_surface_t *surface;
-
-    if (cr->status && cr->status != CAIRO_STATUS_NO_TARGET_SURFACE)
-	    return;
-
-    surface = cairo_xlib_surface_create (dpy, drawable,
-					 DefaultVisual (dpy, DefaultScreen (dpy)),
-					 0,
-					 DefaultColormap (dpy, DefaultScreen (dpy)));
-    if (surface == NULL) {
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-	return;
-    }
-
-    cairo_set_target_surface (cr, surface);
-
-    /* cairo_set_target_surface takes a reference, so we must destroy ours */
-    cairo_surface_destroy (surface);
-}
-
 struct _cairo_xlib_surface {
     cairo_surface_t base;
 




More information about the cairo-commit mailing list