text: Use the background color when painting

If the ClutterActor:background-color-set property is set to TRUE.
This commit is contained in:
Emmanuele Bassi 2012-03-06 15:06:52 +00:00
parent 663d6179ff
commit 477d399c31

View File

@ -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