[gtk/wip/chergert/fix-textview-clip] textview: clip to text window when drawing



commit 7927f7a4402090e134c9c870c5609227bdfbd39a
Author: Christian Hergert <chergert redhat com>
Date:   Fri Sep 13 16:26:26 2019 -0700

    textview: clip to text window when drawing
    
    When drawing the GtkTextView text, we need to clip to the visible area
    so that we do not risk drawing under the border windows.

 gtk/gtktextview.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 4568e735fe..dbf89dfa84 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5403,6 +5403,12 @@ draw_text (GtkWidget   *widget,
       gtk_snapshot_translate (snapshot, &translate);
     }
 
+  gtk_snapshot_push_clip (snapshot,
+                          &GRAPHENE_RECT_INIT (0,
+                                               0,
+                                               SCREEN_WIDTH (widget),
+                                               SCREEN_HEIGHT (widget)));
+
   context = gtk_widget_get_style_context (widget);
   gtk_style_context_save_to_node (context, text_view->priv->text_window->css_node);
   gtk_snapshot_render_background (snapshot, context,
@@ -5433,6 +5439,8 @@ draw_text (GtkWidget   *widget,
       gtk_snapshot_restore (snapshot);
     }
 
+  gtk_snapshot_pop (snapshot);
+
   if (translate.x || translate.y)
     gtk_snapshot_restore (snapshot);
 }


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