[gtk+] GtkTextView: Preserve the cairo context around draw_layer



commit 7d55355d4d4dc17b6db6c5bb225a253dec83c14c
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Aug 13 09:14:22 2014 -0400

    GtkTextView: Preserve the cairo context around draw_layer
    
    Otherwise, draw_layer might unintentionally wreak havoc on the
    regular drawing that happens between the two draw_layer calls.

 gtk/gtktextview.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index a3dee23..d61dff9 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5328,12 +5328,20 @@ draw_text (cairo_t  *cr,
   gtk_style_context_restore (context);
 
   if (GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer != NULL)
-    GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_BELOW, cr);
+    {
+      cairo_save (cr);
+      GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_BELOW, cr);
+      cairo_restore (cr);
+    }
 
   gtk_text_view_paint (widget, cr);
 
   if (GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer != NULL)
-    GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_ABOVE, cr);
+    {
+      cairo_save (cr);
+      GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer (text_view, GTK_TEXT_VIEW_LAYER_ABOVE, cr);
+      cairo_restore (cr);
+    }
 }
 
 static void


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