[gtk+/gtk-style-context: 247/533] GtkStyleContext: Fix animation framework to work with the new draw() semantics.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 247/533] GtkStyleContext: Fix animation framework to work with the new draw() semantics.
- Date: Wed, 1 Dec 2010 02:26:34 +0000 (UTC)
commit 8afde0441160e51f7f332a5a79cbbba28cf8716e
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Oct 9 15:19:52 2010 +0200
GtkStyleContext: Fix animation framework to work with the new draw() semantics.
Invalidation region coalescing now happens recursively as draw() runs, and the
widget's x/y as now drawing coordinates are 0,0 based.
gtk/gtkstylecontext.c | 9 ++++++++-
gtk/gtkstylecontext.h | 4 +++-
gtk/gtkwidget.c | 12 +++++++-----
3 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 0923633..69e7797 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1852,7 +1852,9 @@ _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context)
}
void
-_gtk_style_context_coalesce_animation_areas (GtkStyleContext *context)
+_gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
+ gint rel_x,
+ gint rel_y)
{
GtkStyleContextPrivate *priv;
GSList *l;
@@ -1885,11 +1887,16 @@ _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context)
cairo_rectangle_int_t *rect;
rect = &g_array_index (info->rectangles, cairo_rectangle_int_t, i);
+ rect->x += rel_x;
+ rect->y += rel_y;
+
cairo_region_union_rectangle (info->invalidation_region, rect);
}
g_array_remove_range (info->rectangles, 0, info->rectangles->len);
}
+
+ priv->animations_invalidated = FALSE;
}
static void
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 5064bf6..3daf753 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -152,7 +152,9 @@ const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
GType widget_type,
GParamSpec *pspec);
void _gtk_style_context_invalidate_animation_areas (GtkStyleContext *context);
-void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context);
+void _gtk_style_context_coalesce_animation_areas (GtkStyleContext *context,
+ gint rel_x,
+ gint rel_y);
/* Animation for state changes */
void gtk_style_context_state_transition_start (GtkStyleContext *context,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 997e99b..8889d49 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4187,7 +4187,6 @@ gtk_widget_realize (GtkWidget *widget)
GtkWidgetPrivate *priv;
GdkExtensionMode mode;
cairo_region_t *region;
- GtkStyleContext *context;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (widget->priv->anchored ||
@@ -5440,6 +5439,8 @@ _gtk_widget_draw_internal (GtkWidget *widget,
cairo_t *cr,
gboolean clip_to_size)
{
+ GtkStyleContext *context;
+
if (!gtk_widget_is_drawable (widget))
return;
@@ -5460,6 +5461,11 @@ _gtk_widget_draw_internal (GtkWidget *widget,
0, cr,
&result);
}
+
+ context = gtk_widget_get_style_context (widget);
+ _gtk_style_context_coalesce_animation_areas (context,
+ widget->priv->allocation.x,
+ widget->priv->allocation.y);
}
/**
@@ -5679,7 +5685,6 @@ gtk_widget_send_expose (GtkWidget *widget,
cairo_t *cr;
int x, y;
gboolean do_clip;
- GtkStyleContext *context;
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
g_return_val_if_fail (gtk_widget_get_realized (widget), TRUE);
@@ -5704,9 +5709,6 @@ gtk_widget_send_expose (GtkWidget *widget,
gtk_cairo_set_event (cr, NULL);
cairo_destroy (cr);
- context = gtk_widget_get_style_context (widget);
- _gtk_style_context_coalesce_animation_areas (context);
-
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]