return priv->surface;
}
+/**
+ * gdk_draw_context_get_frame_region:
+ * @context: a #GdkDrawContext
+ *
+ * Retrieves the region that is currently in the process of being repainted.
+ *
+ * After a call to gdk_draw_context_begin_frame() this function will return
+ * a union of the region passed to that function and the area of the surface
+ * that the @context determined needs to be repainted.
+ *
+ * If @context is not inbetween calls to gdk_draw_context_begin_frame() and
+ * gdk_draw_context_end_frame(), %NULL will be returned.
+ *
+ * Returns: (transfer none) (nullable): a Cairo region or %NULL if not drawing
+ * a frame.
+ */
+const cairo_region_t *
+gdk_draw_context_get_frame_region (GdkDrawContext *context)
+{
+ g_return_val_if_fail (GDK_IS_DRAW_CONTEXT (context), NULL);
+
+ return context->frame_region;
+}
const cairo_region_t *region)
{
GdkDrawingContext *context;
- cairo_region_t *real_region;
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
g_return_val_if_fail (gdk_surface_has_native (surface), NULL);
return NULL;
}
- real_region = cairo_region_copy (region);
+ draw_context->frame_region = cairo_region_copy (region);
- gdk_draw_context_begin_frame (draw_context, real_region);
+ gdk_draw_context_begin_frame (draw_context, draw_context->frame_region);
context = g_object_new (GDK_TYPE_DRAWING_CONTEXT,
"surface", surface,
"paint-context", draw_context,
- "clip", real_region,
+ "clip", draw_context->frame_region,
NULL);
/* Do not take a reference, to avoid creating cycles */
surface->drawing_context = context;
- cairo_region_destroy (real_region);
-
return context;
}
g_return_if_fail (surface->drawing_context == context);
paint_context = gdk_drawing_context_get_paint_context (context);
- if (paint_context)
- {
- cairo_region_t *clip = gdk_drawing_context_get_clip (context);
-
- gdk_draw_context_end_frame (paint_context,
- clip,
- surface->active_update_area);
-
- cairo_region_destroy (clip);
- }
- else
- {
- }
+ gdk_draw_context_end_frame (paint_context,
+ paint_context->frame_region,
+ surface->active_update_area);
surface->drawing_context = NULL;
+ g_clear_pointer (&paint_context->frame_region, cairo_region_destroy);
g_object_unref (context);
}