[cairo-commit] boilerplate/cairo-boilerplate.c boilerplate/cairo-boilerplate-private.h boilerplate/cairo-quartz-boilerplate.c boilerplate/Makefile.am

Brian Ewins brianewins at kemper.freedesktop.org
Tue Apr 3 17:23:28 PDT 2007


 boilerplate/Makefile.am                 |    1 
 boilerplate/cairo-boilerplate-private.h |   45 ++++++++++++++++++++++
 boilerplate/cairo-boilerplate.c         |   44 ++--------------------
 boilerplate/cairo-quartz-boilerplate.c  |   64 ++++++++++++++++++++++++++++++++
 4 files changed, 115 insertions(+), 39 deletions(-)

New commits:
diff-tree 3646839060de7ab51c805bf5614fc3d1ea8b7fc3 (from 174ebc43fe84854876d642e67fc3a442d280b59e)
Author: Brian Ewins <Brian.Ewins at gmail.com>
Date:   Wed Apr 4 01:16:30 2007 +0100

    [boilerplate] split quartz out to avoid symbol clash.
    
    Quartz and Xlib both define Picture and Cursor, and clashed in
    cairo-boilerplate.c. Splitting quartz out allows a single mac 
    build with --enable-quartz --enable-atsui.

diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index ad3c126..4cd6bf1 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -2,6 +2,7 @@ EXTRA_LTLIBRARIES = libcairoboilerplate.
 
 libcairoboilerplate_la_SOURCES =\
 cairo-boilerplate.c	\
+cairo-quartz-boilerplate.c	\
 cairo-boilerplate.h	\
 xmalloc.c		\
 xmalloc.h
diff --git a/boilerplate/cairo-boilerplate-private.h b/boilerplate/cairo-boilerplate-private.h
new file mode 100644
index 0000000..a523085
--- /dev/null
+++ b/boilerplate/cairo-boilerplate-private.h
@@ -0,0 +1,45 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
+/*
+ * Copyright © 2004,2007 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth at cworth.org>
+ */
+
+#ifndef _CAIRO_BOILERPLATE_PRIVATE_H_
+#define _CAIRO_BOILERPLATE_PRIVATE_H_
+
+#if CAIRO_HAS_QUARTZ_SURFACE
+
+cairo_surface_t *
+_cairo_quartz_boilerplate_create_surface (const char		*name,
+					  cairo_content_t	 content,
+					  int			 width,
+					  int			 height,
+					  cairo_boilerplate_mode_t  mode,
+					  void			**closure);
+
+void
+_cairo_quartz_boilerplate_cleanup (void *closure);
+
+#endif /* CAIRO_HAS_QUARTZ_SURFACE */
+
+#endif
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index f726d42..be168e5 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -25,6 +25,7 @@
  */
 
 #include "cairo-boilerplate.h"
+#include "cairo-boilerplate-private.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -706,41 +707,6 @@ cleanup_cairo_glitz_wgl (void *closure)
 
 #endif /* CAIRO_HAS_GLITZ_SURFACE */
 
-#if CAIRO_HAS_QUARTZ_SURFACE
-
-#include <cairo-quartz.h>
-
-static cairo_surface_t *
-create_quartz_surface (const char		*name,
-		       cairo_content_t		 content,
-		       int			 width,
-		       int			 height,
-		       cairo_boilerplate_mode_t  mode,
-		       void **closure)
-{
-    cairo_format_t format;
-
-    switch (content) {
-	case CAIRO_CONTENT_COLOR: format = CAIRO_FORMAT_RGB24; break;
-	case CAIRO_CONTENT_COLOR_ALPHA: format = CAIRO_FORMAT_ARGB32; break;
-	case CAIRO_CONTENT_ALPHA: format = CAIRO_FORMAT_A8; break;
-	default:
-	    assert (0); /* not reached */
-	    return NULL;
-    }
-
-    *closure = NULL;
-
-    return cairo_quartz_surface_create (format, width, height);
-}
-
-static void
-cleanup_quartz (void *closure)
-{
-    /* nothing */
-}
-#endif
-
 /* Testing the win32 surface isn't interesting, since for
  * ARGB images it just chains to the image backend
  */
@@ -1424,11 +1390,11 @@ cairo_boilerplate_target_t targets[] =
 #endif /* CAIRO_HAS_GLITZ_SURFACE */
 #if CAIRO_HAS_QUARTZ_SURFACE
     { "quartz", CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR_ALPHA, 0,
-      create_quartz_surface, cairo_surface_write_to_png,
-      cleanup_quartz },
+      _cairo_quartz_boilerplate_create_surface, cairo_surface_write_to_png,
+      _cairo_quartz_boilerplate_cleanup },
     { "quartz", CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR, 0,
-      create_quartz_surface, cairo_surface_write_to_png,
-      cleanup_quartz },
+      _cairo_quartz_boilerplate_create_surface, cairo_surface_write_to_png,
+      _cairo_quartz_boilerplate_cleanup },
 #endif
 #if CAIRO_HAS_WIN32_SURFACE
     { "win32", CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR, 0,
diff --git a/boilerplate/cairo-quartz-boilerplate.c b/boilerplate/cairo-quartz-boilerplate.c
new file mode 100644
index 0000000..8cf6a5c
--- /dev/null
+++ b/boilerplate/cairo-quartz-boilerplate.c
@@ -0,0 +1,64 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
+/*
+ * Copyright © 2004,2007 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth at cworth.org>
+ */
+
+#include "cairo-boilerplate.h"
+#include "cairo-boilerplate-private.h"
+
+#if CAIRO_HAS_QUARTZ_SURFACE
+
+#include <cairo-quartz.h>
+
+cairo_surface_t *
+_cairo_quartz_boilerplate_create_surface (const char		*name,
+					  cairo_content_t	 content,
+					  int			 width,
+					  int			 height,
+					  cairo_boilerplate_mode_t  mode,
+					  void			**closure)
+{
+    cairo_format_t format;
+
+    switch (content) {
+	case CAIRO_CONTENT_COLOR: format = CAIRO_FORMAT_RGB24; break;
+	case CAIRO_CONTENT_COLOR_ALPHA: format = CAIRO_FORMAT_ARGB32; break;
+	case CAIRO_CONTENT_ALPHA: format = CAIRO_FORMAT_A8; break;
+	default:
+	    assert (0); /* not reached */
+	    return NULL;
+    }
+
+    *closure = NULL;
+
+    return cairo_quartz_surface_create (format, width, height);
+}
+
+void
+_cairo_quartz_boilerplate_cleanup (void *closure)
+{
+    /* nothing */
+}
+#endif
+


More information about the cairo-commit mailing list