mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-15 14:50:06 +00:00
gdk: Try harder at tracking drawing contexts
If gdk_cairo_create() is called within a frame draw operation, we can still associate the Cairo context with a GdkDrawingContext.
This commit is contained in:
parent
32a37351cf
commit
222bcf1a71
@ -180,7 +180,7 @@ gdk_drawing_context_init (GdkDrawingContext *self)
|
||||
|
||||
static const cairo_user_data_key_t draw_context_key;
|
||||
|
||||
static void
|
||||
void
|
||||
gdk_cairo_set_drawing_context (cairo_t *cr,
|
||||
GdkDrawingContext *context)
|
||||
{
|
||||
|
@ -451,6 +451,8 @@ void gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface,
|
||||
GdkWindow *window);
|
||||
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
|
||||
|
||||
void gdk_cairo_set_drawing_context (cairo_t *cr,
|
||||
GdkDrawingContext *context);
|
||||
|
||||
/*************************************
|
||||
* Interfaces used by windowing code *
|
||||
|
@ -3553,20 +3553,17 @@ gdk_cairo_create (GdkWindow *window)
|
||||
|
||||
cr = cairo_create (surface);
|
||||
|
||||
if (window->impl_window->current_paint.region != NULL)
|
||||
{
|
||||
region = cairo_region_copy (window->impl_window->current_paint.region);
|
||||
cairo_region_translate (region, -window->abs_x, -window->abs_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
region = cairo_region_copy (window->clip_region);
|
||||
}
|
||||
|
||||
region = gdk_window_get_current_paint_region (window);
|
||||
gdk_cairo_region (cr, region);
|
||||
cairo_region_destroy (region);
|
||||
cairo_clip (cr);
|
||||
|
||||
/* Assign a drawing context, if one is set; if gdk_cairo_create()
|
||||
* is called outside of a frame drawing then this is going to be
|
||||
* NULL.
|
||||
*/
|
||||
gdk_cairo_set_drawing_context (cr, window->drawing_context);
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
return cr;
|
||||
|
Loading…
Reference in New Issue
Block a user