[cairo-commit] cairo/src cairo-quartz-surface.c, 1.21, 1.22 cairo-quartz.h, 1.9, 1.10

Anders Carlsson commit at pdx.freedesktop.org
Mon Nov 14 12:57:36 PST 2005


Committed by: andersca

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

Modified Files:
	cairo-quartz-surface.c cairo-quartz.h 
Log Message:
2005-11-14  Anders Carlsson  <andersca at imendio.com>

        * src/cairo-quartz-surface.c:
        (_cairo_quartz_surface_release_dest_image):
        If the surface is flipped, flip the CG coordinate system
        before drawing the images.

        (cairo_quartz_surface_create):
        * src/cairo-quartz.h:
        Add "flipped" argument to cairo_quartz_surface_create.



Index: cairo-quartz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-quartz-surface.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cairo-quartz-surface.c	2 Nov 2005 00:40:37 -0000	1.21
+++ cairo-quartz-surface.c	14 Nov 2005 20:57:32 -0000	1.22
@@ -42,6 +42,8 @@
 
     CGContextRef context;
 
+    cairo_bool_t flipped;
+
     int width;
     int height;
 
@@ -174,8 +176,17 @@
 
         rect = CGRectMake(0, 0, surface->width, surface->height);
 
+	if (surface->flipped) {
+	    CGContextSaveGState (surface->context);
+	    CGContextTranslateCTM (surface->context, 0, surface->height);
+	    CGContextScaleCTM (surface->context, 1, -1);
+	}
+
         CGContextDrawImage(surface->context, rect, surface->cgImage);
 
+	if (surface->flipped)
+	    CGContextRestoreGState (surface->context);
+
 	memset(surface->image->data, 0, surface->width * surface->height * 4);
     }
 }
@@ -227,6 +238,7 @@
 
 
 cairo_surface_t *cairo_quartz_surface_create(CGContextRef context,
+					     cairo_bool_t flipped,
                                              int width, int height)
 {
     cairo_quartz_surface_t *surface;
@@ -244,6 +256,7 @@
     surface->height = height;
     surface->image = NULL;
     surface->cgImage = NULL;
+    surface->flipped = flipped;
 
     // Set up the image surface which Cairo draws into and we blit to & from.
     void *foo;

Index: cairo-quartz.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-quartz.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cairo-quartz.h	7 Sep 2005 23:31:22 -0000	1.9
+++ cairo-quartz.h	14 Nov 2005 20:57:32 -0000	1.10
@@ -47,6 +47,7 @@
 
 cairo_public cairo_surface_t *
 cairo_quartz_surface_create (CGContextRef    context,
+			     cairo_bool_t    flipped,
 			     int	     width,
 			     int	     height);
 



More information about the cairo-commit mailing list