commit acd7a4b2a58a0e4b6eb12a2bd8a2e07fbd64eb36 Author: Brian Ewins Date: Mon Mar 26 02:49:40 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.la 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..61ca4b0 --- /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 + */ + +#ifndef _CAIRO_BOILERPLATE_PRIVATE_H_ +#define _CAIRO_BOILERPLATE_PRIVATE_H_ + +#if CAIRO_HAS_QUARTZ_SURFACE + +cairo_surface_t * +create_quartz_surface (const char *name, + cairo_content_t content, + int width, + int height, + cairo_boilerplate_mode_t mode, + void **closure); + +void +cleanup_quartz (void *closure); + +#endif /* CAIRO_HAS_QUARTZ_SURFACE */ + +#endif diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index f726d42..f77b279 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 #include @@ -706,41 +707,6 @@ cleanup_cairo_glitz_wgl (void *closure) #endif /* CAIRO_HAS_GLITZ_SURFACE */ -#if CAIRO_HAS_QUARTZ_SURFACE - -#include - -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 */ diff --git a/boilerplate/cairo-quartz-boilerplate.c b/boilerplate/cairo-quartz-boilerplate.c new file mode 100644 index 0000000..ab34bdd --- /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 + */ + +#include "cairo-boilerplate.h" +#include "cairo-boilerplate-private.h" + +#if CAIRO_HAS_QUARTZ_SURFACE + +#include + +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); +} + +void +cleanup_quartz (void *closure) +{ + /* nothing */ +} +#endif +