reviewed by: Richard Hult
2008-07-20 Sven Herzberg <sven@imendio.com> reviewed by: Richard Hult Fixes #543868: GdkPixmap is upside down on quartz * gdk/quartz/gdkdrawable-quartz.c (gdk_quartz_draw_drawable): flip the coordinate space from GTK+ orientation to CoreGraphics orientation before calling CoreGraphics code * gdk/quartz/gdkgc-quartz.c (gdk_quartz_draw_tiled_pattern): drop the coordinate space flipping (we always get it right, now) * gdk/quartz/gdkpixmap-quartz.c (gdk_pixmap_impl_quartz_get_context): flip the coordinate space when creating the CGContextRef svn path=/trunk/; revision=20870
This commit is contained in:

committed by
Sven Herzberg

parent
61ca4f71a0
commit
bd86f2e8fb
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2008-07-20 Sven Herzberg <sven@imendio.com>
|
||||||
|
|
||||||
|
reviewed by: Richard Hult
|
||||||
|
|
||||||
|
Fixes #543868: GdkPixmap is upside down on quartz
|
||||||
|
|
||||||
|
* gdk/quartz/gdkdrawable-quartz.c (gdk_quartz_draw_drawable): flip the
|
||||||
|
coordinate space from GTK+ orientation to CoreGraphics orientation
|
||||||
|
before calling CoreGraphics code
|
||||||
|
* gdk/quartz/gdkgc-quartz.c (gdk_quartz_draw_tiled_pattern): drop the
|
||||||
|
coordinate space flipping (we always get it right, now)
|
||||||
|
* gdk/quartz/gdkpixmap-quartz.c
|
||||||
|
(gdk_pixmap_impl_quartz_get_context): flip the coordinate space when
|
||||||
|
creating the CGContextRef
|
||||||
|
|
||||||
2008-07-20 Sven Herzberg <sven@imendio.com>
|
2008-07-20 Sven Herzberg <sven@imendio.com>
|
||||||
|
|
||||||
reviewed by: Richard Hult
|
reviewed by: Richard Hult
|
||||||
|
@ -337,6 +337,7 @@ gdk_quartz_draw_drawable (GdkDrawable *drawable,
|
|||||||
else if (dest_depth != 0 && src_depth == dest_depth)
|
else if (dest_depth != 0 && src_depth == dest_depth)
|
||||||
{
|
{
|
||||||
CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
|
CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
|
||||||
|
gint width, height;
|
||||||
|
|
||||||
if (!context)
|
if (!context)
|
||||||
return;
|
return;
|
||||||
@ -344,6 +345,13 @@ gdk_quartz_draw_drawable (GdkDrawable *drawable,
|
|||||||
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
_gdk_quartz_gc_update_cg_context (gc, drawable, context,
|
||||||
GDK_QUARTZ_CONTEXT_STROKE);
|
GDK_QUARTZ_CONTEXT_STROKE);
|
||||||
|
|
||||||
|
CGContextSaveGState (context);
|
||||||
|
|
||||||
|
/* convert coordinates from gtk+ to core graphics */
|
||||||
|
gdk_drawable_get_size (drawable, &width, &height);
|
||||||
|
CGContextTranslateCTM (context, 0, height);
|
||||||
|
CGContextScaleCTM (context, 1.0, -1.0);
|
||||||
|
|
||||||
CGContextClipToRect (context, CGRectMake (xdest, ydest, width, height));
|
CGContextClipToRect (context, CGRectMake (xdest, ydest, width, height));
|
||||||
CGContextTranslateCTM (context, xdest - xsrc, ydest - ysrc);
|
CGContextTranslateCTM (context, xdest - xsrc, ydest - ysrc);
|
||||||
CGContextDrawImage (context,
|
CGContextDrawImage (context,
|
||||||
@ -352,6 +360,8 @@ gdk_quartz_draw_drawable (GdkDrawable *drawable,
|
|||||||
GDK_PIXMAP_IMPL_QUARTZ (src_impl)->height),
|
GDK_PIXMAP_IMPL_QUARTZ (src_impl)->height),
|
||||||
GDK_PIXMAP_IMPL_QUARTZ (src_impl)->image);
|
GDK_PIXMAP_IMPL_QUARTZ (src_impl)->image);
|
||||||
|
|
||||||
|
CGContextRestoreGState (context);
|
||||||
|
|
||||||
gdk_quartz_drawable_release_context (drawable, context);
|
gdk_quartz_drawable_release_context (drawable, context);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -290,12 +290,6 @@ gdk_quartz_draw_tiled_pattern (void *info,
|
|||||||
width = CGImageGetWidth (pattern_image);
|
width = CGImageGetWidth (pattern_image);
|
||||||
height = CGImageGetHeight (pattern_image);
|
height = CGImageGetHeight (pattern_image);
|
||||||
|
|
||||||
if (private->is_window)
|
|
||||||
{
|
|
||||||
CGContextTranslateCTM (context, 0, height);
|
|
||||||
CGContextScaleCTM (context, 1.0, -1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
CGContextDrawImage (context,
|
CGContextDrawImage (context,
|
||||||
CGRectMake (0, 0, width, height),
|
CGRectMake (0, 0, width, height),
|
||||||
pattern_image);
|
pattern_image);
|
||||||
|
@ -47,6 +47,7 @@ gdk_pixmap_impl_quartz_get_context (GdkDrawable *drawable,
|
|||||||
{
|
{
|
||||||
GdkPixmapImplQuartz *impl = GDK_PIXMAP_IMPL_QUARTZ (drawable);
|
GdkPixmapImplQuartz *impl = GDK_PIXMAP_IMPL_QUARTZ (drawable);
|
||||||
CGContextRef cg_context;
|
CGContextRef cg_context;
|
||||||
|
size_t height;
|
||||||
|
|
||||||
cg_context = CGBitmapContextCreate (impl->data,
|
cg_context = CGBitmapContextCreate (impl->data,
|
||||||
CGImageGetWidth (impl->image),
|
CGImageGetWidth (impl->image),
|
||||||
@ -57,6 +58,12 @@ gdk_pixmap_impl_quartz_get_context (GdkDrawable *drawable,
|
|||||||
CGImageGetBitmapInfo (impl->image));
|
CGImageGetBitmapInfo (impl->image));
|
||||||
CGContextSetAllowsAntialiasing (cg_context, antialias);
|
CGContextSetAllowsAntialiasing (cg_context, antialias);
|
||||||
|
|
||||||
|
/* convert coordinates from core graphics to gtk+ */
|
||||||
|
height = CGImageGetHeight (impl->image);
|
||||||
|
|
||||||
|
CGContextTranslateCTM (cg_context, 0, height);
|
||||||
|
CGContextScaleCTM (cg_context, 1.0, -1.0);
|
||||||
|
|
||||||
return cg_context;
|
return cg_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user