Commit 1ad01acb authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Add _gdk_drawable_get_subwindow_scratch_gc as a way to get cached gcs with GDK_INCLUDE_INFERIORS

parent 4d187531
......@@ -1784,6 +1784,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
......
......@@ -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,
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment