From 477d399c31dc2c5e5af91ee3c561f0a40f21155b Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 6 Mar 2012 15:06:52 +0000 Subject: [PATCH] text: Use the background color when painting If the ClutterActor:background-color-set property is set to TRUE. --- clutter/clutter-text.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 583be65dd..57e523409 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -2005,6 +2005,7 @@ clutter_text_paint (ClutterActor *self) guint8 real_opacity; gint text_x = priv->text_x; gboolean clip_set = FALSE; + gboolean bg_color_set = FALSE; guint n_chars; /* Note that if anything in this paint method changes it needs to be @@ -2022,6 +2023,23 @@ clutter_text_paint (ClutterActor *self) clutter_actor_get_allocation_box (self, &alloc); + g_object_get (self, "background-color-set", &bg_color_set, NULL); + if (bg_color_set) + { + ClutterColor bg_color; + + clutter_actor_get_background_color (self, &bg_color); + bg_color.alpha = clutter_actor_get_paint_opacity (self) + * bg_color.alpha + / 255; + + cogl_set_source_color4ub (bg_color.red, + bg_color.green, + bg_color.blue, + bg_color.alpha); + cogl_rectangle (0, 0, alloc.x2 - alloc.x1, alloc.y2 - alloc.y1); + } + if (priv->editable && priv->single_line_mode) layout = clutter_text_create_layout (text, -1, -1); else