[gtk+/client-side-windows: 151/284] Don't use drawable_get, release_context in _gdk_windowing_create_cairo_surface
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows: 151/284] Don't use drawable_get, release_context in _gdk_windowing_create_cairo_surface
- Date: Thu, 2 Apr 2009 14:12:25 -0400 (EDT)
commit 348abef6f20cd19e439820aa8d6c5034204fd74a
Author: Richard Hult <richard imendio com>
Date: Tue Jan 20 14:04:03 2009 +0100
Don't use drawable_get,release_context in _gdk_windowing_create_cairo_surface
This fixes a mismatch in save/release gstate for the CGContext. If
this function is ever used for pixmaps, we need to add support for
that, probably will have to do so soon.
---
gdk/quartz/gdkdrawable-quartz.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
index 59e030d..66c4092 100644
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ b/gdk/quartz/gdkdrawable-quartz.c
@@ -45,12 +45,21 @@ _gdk_windowing_create_cairo_surface (GdkDrawable *drawable,
int height)
{
CGContextRef cg_context;
+ cairo_surface_t *surface;
- cg_context = gdk_quartz_drawable_get_context (drawable, TRUE);
+ /* FIXME: Can this ever be called on a non-window drawable? If so we
+ * need to check whether it's a window or pixmap and get the right
+ * kind of context, and also release it in destroy below (for bitmap
+ * context).
+ */
+
+ cg_context = [[NSGraphicsContext currentContext] graphicsPort];
if (!cg_context)
return NULL;
- return cairo_quartz_surface_create_for_cg_context (cg_context, width, height);
+ surface = cairo_quartz_surface_create_for_cg_context (cg_context, width, height);
+
+ return surface;
}
static void
@@ -59,9 +68,6 @@ gdk_quartz_cairo_surface_destroy (void *data)
GdkQuartzCairoSurfaceData *surface_data = data;
GdkDrawableImplQuartz *impl = GDK_DRAWABLE_IMPL_QUARTZ (surface_data->drawable);
- gdk_quartz_drawable_release_context (surface_data->drawable,
- surface_data->cg_context);
-
impl->cairo_surface = NULL;
g_free (surface_data);
@@ -204,8 +210,6 @@ gdk_quartz_draw_arc (GdkDrawable *drawable,
GDK_QUARTZ_CONTEXT_FILL :
GDK_QUARTZ_CONTEXT_STROKE);
- CGContextSaveGState (context);
-
start_angle = angle1 * 2.0 * G_PI / 360.0 / 64.0;
end_angle = start_angle + angle2 * 2.0 * G_PI / 360.0 / 64.0;
@@ -254,8 +258,6 @@ gdk_quartz_draw_arc (GdkDrawable *drawable,
CGContextStrokePath (context);
}
- CGContextRestoreGState (context);
-
gdk_quartz_drawable_release_context (drawable, context);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]