[gtksourceview] Add missing cairo_save/cairo_restore calls
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Add missing cairo_save/cairo_restore calls
- Date: Wed, 19 Oct 2016 12:40:53 +0000 (UTC)
commit 73cd200fa1dff529479aeb5acc764ded608c1d2d
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Oct 19 14:27:53 2016 +0200
Add missing cairo_save/cairo_restore calls
When drawing something, it should not affect the next things to draw.
gtksourceview/gtksourcespacedrawer.c | 2 ++
gtksourceview/gtksourceview.c | 5 +++++
2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcespacedrawer.c b/gtksourceview/gtksourcespacedrawer.c
index e326d2e..df5251e 100644
--- a/gtksourceview/gtksourcespacedrawer.c
+++ b/gtksourceview/gtksourcespacedrawer.c
@@ -1386,6 +1386,7 @@ _gtk_source_space_drawer_draw (GtkSourceSpaceDrawer *drawer,
gtk_text_view_get_iter_at_location (text_view, &start, min_x, min_y);
gtk_text_view_get_iter_at_location (text_view, &end, max_x, max_y);
+ cairo_save (cr);
gdk_cairo_set_source_rgba (cr, drawer->priv->color);
cairo_set_line_width (cr, 0.8);
cairo_translate (cr, -0.5, -0.5);
@@ -1452,6 +1453,7 @@ _gtk_source_space_drawer_draw (GtkSourceSpaceDrawer *drawer,
};
cairo_stroke (cr);
+ cairo_restore (cr);
#ifdef ENABLE_PROFILE
g_timer_stop (timer);
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index a82cc8f..e3ddade 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -2371,6 +2371,7 @@ gtk_source_view_paint_line_background (GtkTextView *text_view,
{
gdouble x1, y1, x2, y2;
+ cairo_save (cr);
cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
gdk_cairo_set_source_rgba (cr, (GdkRGBA *)color);
@@ -2378,6 +2379,7 @@ gtk_source_view_paint_line_background (GtkTextView *text_view,
cairo_rectangle (cr, x1 + .5, y + .5, x2 - x1 - 1, height - 1);
cairo_stroke_preserve (cr);
cairo_fill (cr);
+ cairo_restore (cr);
}
static void
@@ -2527,6 +2529,7 @@ gtk_source_view_paint_right_margin (GtkSourceView *view,
x = view->priv->cached_right_margin_pos + gtk_text_view_get_left_margin (text_view);
+ cairo_save (cr);
cairo_set_line_width (cr, 1.0);
if (x + 1 >= clip.x && x <= clip.x + clip.width)
@@ -2550,6 +2553,8 @@ gtk_source_view_paint_right_margin (GtkSourceView *view,
cairo_fill (cr);
}
+ cairo_restore (cr);
+
PROFILE ({
g_timer_stop (timer);
g_print (" gtk_source_view_paint_right_margin time: "
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]