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.
This commit is contained in:
Anders Carlsson 2005-11-14 12:57:31 +00:00
parent b5759f9e07
commit a16d93f367
3 changed files with 25 additions and 0 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);