[mutter/gnome-3-32] clutter-text: Fix selection color drawing



commit 30d6e3abe2a0251b11513d66d15a59cd0705a828
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon May 27 17:48:41 2019 +0000

    clutter-text: Fix selection color drawing
    
    Commit cabcad185 removed the call to cogl_set_source_color4ub() before
    cogl_fill_path(), so instead of the previously assigned selection color,
    the background is drawn with the last set source.
    
    In order to honour the newly added framebuffer parameter and still apply
    the correct color, switch from cogl_fill_path() to the (deprecated!)
    cogl_framebuffer_fill_path() method.
    
    https://gitlab.gnome.org/GNOME/mutter/issues/494

 clutter/clutter/clutter-text.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
index fb9d926df..000bbbbd4 100644
--- a/clutter/clutter/clutter-text.c
+++ b/clutter/clutter/clutter-text.c
@@ -1975,6 +1975,7 @@ selection_paint (ClutterText     *self,
   else
     {
       /* Paint selection background first */
+      CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
       PangoLayout *layout = clutter_text_get_layout (self);
       CoglPath *selection_path = cogl_path_new ();
       CoglColor cogl_color = { 0, };
@@ -1987,11 +1988,19 @@ selection_paint (ClutterText     *self,
       else
         color = &priv->text_color;
 
+      cogl_color_init_from_4ub (&cogl_color,
+                                color->red,
+                                color->green,
+                                color->blue,
+                                paint_opacity * color->alpha / 255);
+      cogl_color_premultiply (&cogl_color);
+      cogl_pipeline_set_color (color_pipeline, &cogl_color);
+
       clutter_text_foreach_selection_rectangle_prescaled (self,
                                                           add_selection_rectangle_to_path,
                                                           selection_path);
 
-      cogl_path_fill (selection_path);
+      cogl_framebuffer_fill_path (fb, color_pipeline, selection_path);
 
       /* Paint selected text */
       cogl_framebuffer_push_path_clip (fb, selection_path);


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