From fd5e422b9fc58bec4cd98d626226b0ae03766e98 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 20 Dec 2011 17:05:48 +0000 Subject: [PATCH] actor: Paint the background color in the paint class handler We need to paint the background color in the default class handler for two reasons: it's logically appropriate, and we don't want actor subclasses overriding the ::paint class handler to change behaviour only because somebody decided to set the background color. --- clutter/clutter-actor.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 62917b47a..4e0344764 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -2867,14 +2867,31 @@ add_or_remove_flatten_effect (ClutterActor *self) static void clutter_actor_real_paint (ClutterActor *actor) { + ClutterActorPrivate *priv = actor->priv; ClutterActor *iter; - for (iter = actor->priv->first_child; + /* paint the background color, if set */ + if (priv->bg_color_set) + { + float width, height; + + clutter_actor_box_get_size (&priv->allocation, &width, &height); + + cogl_set_source_color4ub (priv->bg_color.red, + priv->bg_color.green, + priv->bg_color.blue, + priv->bg_color.alpha); + + cogl_rectangle (0, 0, width, height); + } + + for (iter = priv->first_child; iter != NULL; iter = iter->priv->next_sibling) { - CLUTTER_NOTE (PAINT, "Painting %s at { %.2f, %.2f - %.2f x %.2f }", + CLUTTER_NOTE (PAINT, "Painting %s, child of %s, at { %.2f, %.2f - %.2f x %.2f }", _clutter_actor_get_debug_name (iter), + _clutter_actor_get_debug_name (actor), iter->priv->allocation.x1, iter->priv->allocation.y1, iter->priv->allocation.x2 - iter->priv->allocation.x1, @@ -3158,23 +3175,6 @@ clutter_actor_continue_paint (ClutterActor *self) { if (_clutter_context_get_pick_mode () == CLUTTER_PICK_NONE) { - /* paint the background color, if set */ - if (priv->bg_color_set) - { - float width, height; - - clutter_actor_box_get_size (&priv->allocation, - &width, - &height); - - cogl_set_source_color4ub (priv->bg_color.red, - priv->bg_color.green, - priv->bg_color.blue, - priv->bg_color.alpha); - - cogl_rectangle (0, 0, width, height); - } - g_signal_emit (self, actor_signals[PAINT], 0); } else