Index: src/cairo-quartz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-quartz-surface.c,v
retrieving revision 1.19
diff -p -u -r1.19 cairo-quartz-surface.c
--- src/cairo-quartz-surface.c	31 Jul 2005 18:03:35 -0000	1.19
+++ src/cairo-quartz-surface.c	1 Aug 2005 03:10:34 -0000
@@ -99,7 +99,7 @@ _cairo_quartz_surface_acquire_source_ima
 
     rowBytes = surface->width * 4;
     imageDataSize = rowBytes * surface->height;
-    imageData = malloc(imageDataSize);
+    imageData = calloc (imageDataSize);
 
     dataProvider =
         CGDataProviderCreateWithData(NULL, imageData, imageDataSize,
@@ -131,7 +131,8 @@ _cairo_quartz_surface_acquire_source_ima
     }
 
     *image_out = surface->image;
-    *image_extra = NULL;
+    if (image_extra)
+	*image_extra = NULL;
 
     return CAIRO_STATUS_SUCCESS;
 }
@@ -175,8 +176,6 @@ _cairo_quartz_surface_release_dest_image
         rect = CGRectMake(0, 0, surface->width, surface->height);
 
         CGContextDrawImage(surface->context, rect, surface->cgImage);
-
-	memset(surface->image->data, 0, surface->width * surface->height * 4);
     }
 }
 
@@ -246,8 +245,7 @@ cairo_surface_t *cairo_quartz_surface_cr
     surface->cgImage = NULL;
 
     // Set up the image surface which Cairo draws into and we blit to & from.
-    void *foo;
-    _cairo_quartz_surface_acquire_source_image(surface, &surface->image, &foo);
+    _cairo_quartz_surface_acquire_source_image(surface, &surface->image, NULL);
 
     return (cairo_surface_t *) surface;
 }
Index: test/Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo/test/Makefile.am,v
retrieving revision 1.70
diff -p -u -r1.70 Makefile.am
--- test/Makefile.am	28 Jul 2005 22:55:01 -0000	1.70
+++ test/Makefile.am	1 Aug 2005 03:10:34 -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=-Xlinker -framework -Xlinker 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: test/cairo-test-quartz.c
===================================================================
RCS file: test/cairo-test-quartz.c
diff -N test/cairo-test-quartz.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ test/cairo-test-quartz.c	1 Aug 2005 03:10:34 -0000
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2005 Billy Biggs
+ *
+ * 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
+ * Billy Biggs not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Billy Biggs makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * BILLY BIGGS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL BILLY BIGGS 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: Billy Biggs <vektor@dumbterm.net>
+ */
+
+#include "cairo-test-quartz.h"
+#include "xmalloc.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);
+    memset (qtc->data, 0, stride * height);
+    colorspace = CGColorSpaceCreateDeviceRGB ();
+    qtc->context = CGBitmapContextCreate (qtc->data, width, height,
+                                          8, stride, colorspace,
+                                          kCGImageAlphaPremultipliedFirst);
+    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 /* CAIRO_HAS_QUARTZ_SURFACE */
Index: test/cairo-test-quartz.h
===================================================================
RCS file: test/cairo-test-quartz.h
diff -N test/cairo-test-quartz.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ test/cairo-test-quartz.h	1 Aug 2005 03:10:34 -0000
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2005 Billy Biggs
+ *
+ * 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
+ * Billy Biggs not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Billy Biggs makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * BILLY BIGGS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL BILLY BIGGS 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: Billy Biggs <vektor@dumbterm.net>
+ */
+
+#ifndef _CAIRO_TEST_QUARTZ_H_
+#define _CAIRO_TEST_QUARTZ_H_
+
+#include <cairo.h>
+
+#if CAIRO_HAS_QUARTZ_SURFACE
+
+cairo_surface_t *
+create_quartz_surface (int width, int height, void **closure);
+
+void
+cleanup_quartz (void *closure);
+
+#endif /* CAIRO_HAS_QUARTZ_SURFACE */
+#endif /* _CAIRO_TEST_QUARTZ_H_ */
Index: test/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
--- test/cairo-test.c	28 Jul 2005 18:22:43 -0000	1.47
+++ test/cairo-test.c	1 Aug 2005 03:10:34 -0000
@@ -31,6 +31,7 @@
 #include <string.h>
 
 #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
  */
