summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2019-05-27 17:48:41 +0000
committerFlorian Müllner <fmuellner@gnome.org>2019-05-27 18:39:39 +0000
commit76664ef89193ad9e7194a0d11b4cd27ea10d6a7d (patch)
treedac65d8425bcabfd03e8890dca60be9d747a8d88
parentb1ea768949251aac72aba8c2cd9db8bf026800a5 (diff)
downloadmutter-76664ef89193ad9e7194a0d11b4cd27ea10d6a7d.tar.gz
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
-rw-r--r--clutter/clutter/clutter-text.c11
1 files changed, 10 insertions, 1 deletions
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);