From 76664ef89193ad9e7194a0d11b4cd27ea10d6a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 27 May 2019 17:48:41 +0000 Subject: 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 9222cedfc..616655026 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); -- cgit v1.2.1