[gtk/wip/exalm/textview-selection: 1/4] textlayout: Only special case selection rendering for opaque colors




commit f413d5ef22fc31e153c9eccac1858f7e1c37d727
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon May 3 19:03:47 2021 +0500

    textlayout: Only special case selection rendering for opaque colors
    
    If the selection is partially transparent, it may still be desirable to
    see the colors from tags underneath.

 gtk/gtktextlayout.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index d127c489b2..b31c70799e 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -3873,8 +3873,12 @@ render_para (GskPangoRenderer   *crenderer,
       if (at_last_line)
         selection_height += line_display->bottom_margin;
 
+      /* Don't draw the text underneath if the whole line is selected. We can
+       * only do it if the selection is opaque.
+       */
       if (selection_start_index < byte_offset &&
-          selection_end_index > line->length + byte_offset) /* All selected */
+          selection_end_index > line->length + byte_offset &&
+          selection->alpha >= 1)
         {
           gtk_snapshot_append_color (crenderer->snapshot,
                                      selection,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]