[gtk+/client-side-windows: 79/284] Add _gdk_drawable_get_subwindow_scratch_gc as a way to get cached gcs with GDK_INCLUDE_INFERIORS
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows: 79/284] Add _gdk_drawable_get_subwindow_scratch_gc as a way to get cached gcs with GDK_INCLUDE_INFERIORS
- Date: Thu, 2 Apr 2009 14:06:22 -0400 (EDT)
commit 1ad01acbf2a86af4decb34496f4ef1f05184ee5e
Author: Alexander Larsson <alexl redhat com>
Date: Wed Jan 14 22:14:57 2009 +0100
Add _gdk_drawable_get_subwindow_scratch_gc as a way to get cached gcs with GDK_INCLUDE_INFERIORS
---
gdk/gdkdraw.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
gdk/gdkinternals.h | 1 +
gdk/gdkscreen.h | 1 +
3 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index 73f262a..9c9385f 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -1785,6 +1785,52 @@ _gdk_drawable_get_scratch_gc (GdkDrawable *drawable,
}
/**
+ * _gdk_drawable_get_subwindow_scratch_gc:
+ * @drawable: A #GdkDrawable
+ *
+ * Returns a #GdkGC suitable for drawing on @drawable. The #GdkGC has
+ * the standard values for @drawable, except for the graphics_exposures
+ * field which is %TRUE and the subwindow mode which is %GDK_INCLUDE_INFERIORS.
+ *
+ * The foreground color of the returned #GdkGC is undefined. The #GdkGC
+ * must not be altered in any way, except to change its foreground color.
+ *
+ * Return value: A #GdkGC suitable for drawing on @drawable
+ *
+ * Since: 2.18
+ **/
+GdkGC *
+_gdk_drawable_get_subwindow_scratch_gc (GdkDrawable *drawable)
+{
+ GdkScreen *screen;
+ gint depth;
+
+ g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+
+ screen = gdk_drawable_get_screen (drawable);
+
+ g_return_val_if_fail (!screen->closed, NULL);
+
+ depth = gdk_drawable_get_depth (drawable) - 1;
+
+ if (!screen->subwindow_gcs[depth])
+ {
+ GdkGCValues values;
+ GdkGCValuesMask mask;
+
+ values.graphics_exposures = TRUE;
+ values.subwindow_mode = GDK_INCLUDE_INFERIORS;
+ mask = GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW;
+
+ screen->subwindow_gcs[depth] =
+ gdk_gc_new_with_values (drawable, &values, mask);
+ }
+
+ return screen->subwindow_gcs[depth];
+}
+
+
+/**
* _gdk_drawable_get_source_drawable:
* @drawable: a #GdkDrawable
*
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 62d9f13..3841885 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -241,6 +241,7 @@ cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
/* GC caching */
GdkGC *_gdk_drawable_get_scratch_gc (GdkDrawable *drawable,
gboolean graphics_exposures);
+GdkGC *_gdk_drawable_get_subwindow_scratch_gc (GdkDrawable *drawable);
void _gdk_gc_update_context (GdkGC *gc,
cairo_t *cr,
diff --git a/gdk/gdkscreen.h b/gdk/gdkscreen.h
index b1f3b8e..96ff8d4 100644
--- a/gdk/gdkscreen.h
+++ b/gdk/gdkscreen.h
@@ -51,6 +51,7 @@ struct _GdkScreen
GdkGC *normal_gcs[32];
GdkGC *exposure_gcs[32];
+ GdkGC *subwindow_gcs[32];
cairo_font_options_t *font_options;
double resolution; /* pixels/points scale factor for fonts */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]