1c7749
From 30d6e3abe2a0251b11513d66d15a59cd0705a828 Mon Sep 17 00:00:00 2001
1c7749
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
1c7749
Date: Mon, 27 May 2019 17:48:41 +0000
1c7749
Subject: [PATCH 1/2] clutter-text: Fix selection color drawing
1c7749
1c7749
Commit cabcad185 removed the call to cogl_set_source_color4ub() before
1c7749
cogl_fill_path(), so instead of the previously assigned selection color,
1c7749
the background is drawn with the last set source.
1c7749
1c7749
In order to honour the newly added framebuffer parameter and still apply
1c7749
the correct color, switch from cogl_fill_path() to the (deprecated!)
1c7749
cogl_framebuffer_fill_path() method.
1c7749
1c7749
https://gitlab.gnome.org/GNOME/mutter/issues/494
1c7749
---
1c7749
 clutter/clutter/clutter-text.c | 11 ++++++++++-
1c7749
 1 file changed, 10 insertions(+), 1 deletion(-)
1c7749
1c7749
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
1c7749
index fb9d926df..000bbbbd4 100644
1c7749
--- a/clutter/clutter/clutter-text.c
1c7749
+++ b/clutter/clutter/clutter-text.c
1c7749
@@ -1975,6 +1975,7 @@ selection_paint (ClutterText     *self,
1c7749
   else
1c7749
     {
1c7749
       /* Paint selection background first */
1c7749
+      CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
1c7749
       PangoLayout *layout = clutter_text_get_layout (self);
1c7749
       CoglPath *selection_path = cogl_path_new ();
1c7749
       CoglColor cogl_color = { 0, };
1c7749
@@ -1987,11 +1988,19 @@ selection_paint (ClutterText     *self,
1c7749
       else
1c7749
         color = &priv->text_color;
1c7749
 
1c7749
+      cogl_color_init_from_4ub (&cogl_color,
1c7749
+                                color->red,
1c7749
+                                color->green,
1c7749
+                                color->blue,
1c7749
+                                paint_opacity * color->alpha / 255);
1c7749
+      cogl_color_premultiply (&cogl_color);
1c7749
+      cogl_pipeline_set_color (color_pipeline, &cogl_color);
1c7749
+
1c7749
       clutter_text_foreach_selection_rectangle_prescaled (self,
1c7749
                                                           add_selection_rectangle_to_path,
1c7749
                                                           selection_path);
1c7749
 
1c7749
-      cogl_path_fill (selection_path);
1c7749
+      cogl_framebuffer_fill_path (fb, color_pipeline, selection_path);
1c7749
 
1c7749
       /* Paint selected text */
1c7749
       cogl_framebuffer_push_path_clip (fb, selection_path);
1c7749
-- 
1c7749
2.21.0
1c7749
1c7749
1c7749
From 13a1624c1050c91cd4d8a298f7a10fafe56fe9e5 Mon Sep 17 00:00:00 2001
1c7749
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
1c7749
Date: Mon, 27 May 2019 22:40:47 +0000
1c7749
Subject: [PATCH 2/2] cogl-path: Undeprecate framebuffer functions
1c7749
1c7749
It looks like deprecating the functions with explicit framebuffer/pipeline
1c7749
arguments made it to (cogl) master by mistake:
1c7749
1c7749
https://mail.gnome.org/archives/clutter-list/2016-April/msg00008.html
1c7749
1c7749
We now use one of them, so this is a good time to undeprecate the lot.
1c7749
1c7749
https://gitlab.gnome.org/GNOME/mutter/merge_requests/597
1c7749
---
1c7749
 cogl/cogl-path/cogl-path-functions.h | 6 ------
1c7749
 cogl/cogl-path/cogl-path.c           | 3 ---
1c7749
 2 files changed, 9 deletions(-)
1c7749
1c7749
diff --git a/cogl/cogl-path/cogl-path-functions.h b/cogl/cogl-path/cogl-path-functions.h
1c7749
index d4ef328d2..318fed028 100644
1c7749
--- a/cogl/cogl-path/cogl-path-functions.h
1c7749
+++ b/cogl/cogl-path/cogl-path-functions.h
1c7749
@@ -460,9 +460,7 @@ cogl_path_fill (CoglPath *path);
1c7749
  * use while filling a path.</note>
1c7749
  *
1c7749
  * Stability: unstable
1c7749
- * Deprecated: 1.16: Use cogl_path_fill() instead
1c7749
  */
1c7749
-COGL_DEPRECATED_FOR (cogl_path_fill)
1c7749
 void
1c7749
 cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
1c7749
                             CoglPipeline *pipeline,
1c7749
@@ -492,9 +490,7 @@ cogl_path_stroke (CoglPath *path);
1c7749
  * regardless of the current transformation matrix.
1c7749
  *
1c7749
  * Stability: unstable
1c7749
- * Deprecated: 1.16: Use cogl_path_stroke() instead
1c7749
  */
1c7749
-COGL_DEPRECATED_FOR (cogl_path_stroke)
1c7749
 void
1c7749
 cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
1c7749
                               CoglPipeline *pipeline,
1c7749
@@ -529,9 +525,7 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
1c7749
  *
1c7749
  * Since: 1.8
1c7749
  * Stability: Unstable
1c7749
- * Deprecated: 1.16: Use cogl_framebuffer_push_path_clip() instead
1c7749
  */
1c7749
-COGL_DEPRECATED_FOR (cogl_framebuffer_push_path_clip)
1c7749
 void
1c7749
 cogl_clip_push_from_path (CoglPath *path);
1c7749
 
1c7749
diff --git a/cogl/cogl-path/cogl-path.c b/cogl/cogl-path/cogl-path.c
1c7749
index 4d86c6fb5..8774406f8 100644
1c7749
--- a/cogl/cogl-path/cogl-path.c
1c7749
+++ b/cogl/cogl-path/cogl-path.c
1c7749
@@ -1504,7 +1504,6 @@ cogl_framebuffer_push_path_clip (CoglFramebuffer *framebuffer,
1c7749
       COGL_FRAMEBUFFER_STATE_CLIP;
1c7749
 }
1c7749
 
1c7749
-/* XXX: deprecated */
1c7749
 void
1c7749
 cogl_clip_push_from_path (CoglPath *path)
1c7749
 {
1c7749
@@ -1575,7 +1574,6 @@ _cogl_path_build_stroke_attribute_buffer (CoglPath *path)
1c7749
   data->stroke_n_attributes = n_attributes;
1c7749
 }
1c7749
 
1c7749
-/* XXX: deprecated */
1c7749
 void
1c7749
 cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
1c7749
                             CoglPipeline *pipeline,
1c7749
@@ -1588,7 +1586,6 @@ cogl_framebuffer_fill_path (CoglFramebuffer *framebuffer,
1c7749
   _cogl_path_fill_nodes (path, framebuffer, pipeline, 0 /* flags */);
1c7749
 }
1c7749
 
1c7749
-/* XXX: deprecated */
1c7749
 void
1c7749
 cogl_framebuffer_stroke_path (CoglFramebuffer *framebuffer,
1c7749
                               CoglPipeline *pipeline,
1c7749
-- 
1c7749
2.21.0
1c7749