summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@imendio.com>2005-11-14 12:57:31 +0000
committerAnders Carlsson <andersca@imendio.com>2005-11-14 12:57:31 +0000
commita16d93f367af721a535ed13fc5bc07636e6549d2 (patch)
treed8b893802bf26d4a9764c734938d519a4e2fcad5
parentb5759f9e0746b48064c031009be8cd203f9bbaa5 (diff)
If the surface is flipped, flip the CG coordinate system before drawing the images.
(cairo_quartz_surface_create): Add "flipped" argument to cairo_quartz_surface_create.
-rw-r--r--ChangeLog11
-rw-r--r--src/cairo-quartz-surface.c13
-rw-r--r--src/cairo-quartz.h1
3 files changed, 25 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 0eca5433f..74f75d700 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-11-14 Anders Carlsson <andersca@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.
+
2005-11-10 Carl Worth <cworth@cworth.org>
* ROADMAP: Change scheduled release date of 1.2.0 out to
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 257d5b418..bfd3d5ca5 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -42,6 +42,8 @@ typedef struct cairo_quartz_surface {
CGContextRef context;
+ cairo_bool_t flipped;
+
int width;
int height;
@@ -174,8 +176,17 @@ _cairo_quartz_surface_release_dest_image(void *abstract_surface,
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 @@ static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
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 @@ cairo_surface_t *cairo_quartz_surface_create(CGContextRef context,
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;
diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h
index 02992dced..9ef537ed3 100644
--- a/src/cairo-quartz.h
+++ b/src/cairo-quartz.h
@@ -47,6 +47,7 @@ CAIRO_BEGIN_DECLS
cairo_public cairo_surface_t *
cairo_quartz_surface_create (CGContextRef context,
+ cairo_bool_t flipped,
int width,
int height);