kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

Blame SOURCES/fix-text-selection-drawing.patch

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