Index: Makefile.am =================================================================== RCS file: /cvs/cairo/cairo/test/Makefile.am,v retrieving revision 1.70 diff -p -u -r1.70 Makefile.am --- Makefile.am 28 Jul 2005 22:55:01 -0000 1.70 +++ Makefile.am 31 Jul 2005 17:03:42 -0000 @@ -137,6 +137,8 @@ buffer-diff.c \ buffer-diff.h \ cairo-test.c \ cairo-test.h \ +cairo-test-quartz.c \ +cairo-test-quartz.h \ read-png.c \ read-png.h \ write-png.c \ @@ -146,6 +148,10 @@ xmalloc.h LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la +if CAIRO_HAS_QUARTZ_SURFACE +AM_LDFLAGS = -framework Carbon +endif + # ARGH! I have to repeat the list of tests a third time. Maybe it's # time to break down and auto-generate the Makefile.am or something # from autogen.sh. My, but this is painful... Index: cairo-test-quartz.c =================================================================== RCS file: cairo-test-quartz.c diff -N cairo-test-quartz.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ cairo-test-quartz.c 31 Jul 2005 17:03:42 -0000 @@ -0,0 +1,75 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2004 Billy Biggs + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Billy Biggs + * + * Contributor(s): + * Billy Biggs + */ + +#include "cairo-test-quartz.h" + +#if CAIRO_HAS_QUARTZ_SURFACE + +#include "cairo-quartz.h" + +typedef struct _quartz_target_closure +{ + void *data; + CGContextRef context; +} quartz_target_closure_t; + +cairo_surface_t * +create_quartz_surface (int width, int height, void **closure) +{ + quartz_target_closure_t *qtc; + CGColorSpaceRef colorspace; + int stride = width * 4; + + *closure = qtc = xmalloc (sizeof (quartz_target_closure_t)); + + qtc->data = xmalloc (stride * height); + colorspace = CGColorSpaceCreateDeviceRGB (); + qtc->context = CGBitmapContextCreate (qtc->data, width, height, + 8, stride, colorspace, + kCGImageAlphaNoneSkipLast); + CGColorSpaceRelease (colorspace); + return cairo_quartz_surface_create (qtc->context, width, height); +} + +void +cleanup_quartz (void *closure) +{ + quartz_target_closure_t *qtc = (quartz_target_closure_t *) closure; + CGContextRelease (qtc->context); + free (qtc->data); +} + +#endif + Index: cairo-test-quartz.h =================================================================== RCS file: cairo-test-quartz.h diff -N cairo-test-quartz.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ cairo-test-quartz.h 31 Jul 2005 17:03:42 -0000 @@ -0,0 +1,47 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2004 Billy Biggs + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Billy Biggs + * + * Contributor(s): + * Billy Biggs + */ + +#include + +#if CAIRO_HAS_QUARTZ_SURFACE + +cairo_surface_t * +create_quartz_surface (int width, int height, void **closure); + +void +cleanup_quartz (void *closure); + +#endif + Index: cairo-test.c =================================================================== RCS file: /cvs/cairo/cairo/test/cairo-test.c,v retrieving revision 1.47 diff -p -u -r1.47 cairo-test.c --- cairo-test.c 28 Jul 2005 18:22:43 -0000 1.47 +++ cairo-test.c 31 Jul 2005 17:03:43 -0000 @@ -31,6 +31,7 @@ #include #include "cairo-test.h" +#include "cairo-test-quartz.h" #include "buffer-diff.h" #include "read-png.h" @@ -161,20 +162,6 @@ cleanup_glitz (cairo_t *cr) } #endif -#if CAIRO_HAS_QUARTZ_SURFACE -static cairo_surface_t * -create_quartz_surface (int width, int height, void **closure) -{ -#error Not yet implemented -} - -static void -cleanup_quartz (void *closure) -{ -#error Not yet implemented -} -#endif - /* Testing the win32 surface isn't interesting, since for * ARGB images it just chains to the image backend */