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