gdkwindow: Store the implicit paint in a list

This changes nothing, but lets us later have multiple
implicit paints

https://bugzilla.gnome.org/show_bug.cgi?id=687842
This commit is contained in:
Alexander Larsson
2012-11-07 13:01:09 +01:00
parent f6383ebf9e
commit ada6d81247
2 changed files with 12 additions and 9 deletions

View File

@ -247,7 +247,7 @@ struct _GdkWindow
GdkCursor *cursor; GdkCursor *cursor;
GHashTable *device_cursor; GHashTable *device_cursor;
GdkWindowPaint *implicit_paint; GSList *implicit_paint;
GList *outstanding_moves; GList *outstanding_moves;

View File

@ -2752,7 +2752,7 @@ gdk_window_begin_implicit_paint (GdkWindow *window, GdkRectangle *rect)
MAX (rect->height, 1)); MAX (rect->height, 1));
cairo_surface_set_device_offset (paint->surface, -rect->x, -rect->y); cairo_surface_set_device_offset (paint->surface, -rect->x, -rect->y);
window->implicit_paint = paint; window->implicit_paint = g_slist_prepend (window->implicit_paint, paint);
return TRUE; return TRUE;
} }
@ -2807,7 +2807,7 @@ gdk_window_flush_implicit_paint (GdkWindow *window)
if (impl_window->implicit_paint == NULL) if (impl_window->implicit_paint == NULL)
return; return;
paint = impl_window->implicit_paint; paint = impl_window->implicit_paint->data;
region = cairo_region_copy (window->clip_region_with_children); region = cairo_region_copy (window->clip_region_with_children);
cairo_region_translate (region, window->abs_x, window->abs_y); cairo_region_translate (region, window->abs_x, window->abs_y);
@ -2838,9 +2838,10 @@ gdk_window_end_implicit_paint (GdkWindow *window)
g_assert (window->implicit_paint != NULL); g_assert (window->implicit_paint != NULL);
paint = window->implicit_paint; paint = window->implicit_paint->data;
window->implicit_paint = NULL; window->implicit_paint = g_slist_delete_link (window->implicit_paint,
window->implicit_paint);
if (!GDK_WINDOW_DESTROYED (window) && !cairo_region_is_empty (paint->region)) if (!GDK_WINDOW_DESTROYED (window) && !cairo_region_is_empty (paint->region))
{ {
@ -2957,7 +2958,7 @@ gdk_window_begin_paint_region (GdkWindow *window,
} }
impl_window = gdk_window_get_impl_window (window); impl_window = gdk_window_get_impl_window (window);
implicit_paint = impl_window->implicit_paint; implicit_paint = impl_window->implicit_paint != NULL ? impl_window->implicit_paint->data : NULL;
paint = g_new (GdkWindowPaint, 1); paint = g_new (GdkWindowPaint, 1);
paint->region = cairo_region_copy (region); paint->region = cairo_region_copy (region);
@ -3325,6 +3326,8 @@ move_region_on_impl (GdkWindow *impl_window,
cairo_region_t *region, /* In impl window coords */ cairo_region_t *region, /* In impl window coords */
int dx, int dy) int dx, int dy)
{ {
GSList *l;
if ((dx == 0 && dy == 0) || if ((dx == 0 && dy == 0) ||
cairo_region_is_empty (region)) cairo_region_is_empty (region))
{ {
@ -3363,9 +3366,9 @@ move_region_on_impl (GdkWindow *impl_window,
/* If we're currently exposing this window, don't copy to this /* If we're currently exposing this window, don't copy to this
destination, as it will be overdrawn when the expose is done, destination, as it will be overdrawn when the expose is done,
instead invalidate it and repaint later. */ instead invalidate it and repaint later. */
if (impl_window->implicit_paint) for (l = impl_window->implicit_paint; l != NULL; l = l->next)
{ {
GdkWindowPaint *implicit_paint = impl_window->implicit_paint; GdkWindowPaint *implicit_paint = l->data;
cairo_region_t *exposing; cairo_region_t *exposing;
exposing = cairo_region_copy (implicit_paint->region); exposing = cairo_region_copy (implicit_paint->region);
@ -4083,7 +4086,7 @@ gdk_window_process_updates_internal (GdkWindow *window)
* be to late to anti-expose now. Since this is merely an * be to late to anti-expose now. Since this is merely an
* optimization we just avoid doing it at all in that case. * optimization we just avoid doing it at all in that case.
*/ */
if (window->implicit_paint != NULL && !window->implicit_paint->flushed) if (window->implicit_paint != NULL && !((GdkWindowPaint *)window->implicit_paint->data)->flushed)
save_region = impl_class->queue_antiexpose (window, update_area); save_region = impl_class->queue_antiexpose (window, update_area);
gdk_window_end_implicit_paint (window); gdk_window_end_implicit_paint (window);