[clutter] text: Use the background color when painting



commit 477d399c31dc2c5e5af91ee3c561f0a40f21155b
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Tue Mar 6 15:06:52 2012 +0000

    text: Use the background color when painting
    
    If the ClutterActor:background-color-set property is set to TRUE.

 clutter/clutter-text.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c
index 583be65..57e5234 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]