[meld: 149/180] sourceview: Update drawing to use cairo clip extents for bounds
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld: 149/180] sourceview: Update drawing to use cairo clip extents for bounds
- Date: Thu, 23 Jul 2015 21:43:54 +0000 (UTC)
commit 35069302d59176c458494466a8640f0c9e14266b
Author: Kai Willadsen <kai willadsen gmail com>
Date: Tue Nov 11 06:26:34 2014 +1000
sourceview: Update drawing to use cairo clip extents for bounds
Previously, we checked to see what portion of the TextView was visible
when deciding which changes needed redrawing. That doesn't work now
with the pixel cache, which draws both above and below what's actually
on screen.
With this change, we trust that the cairo clip extents match up with
what's going in to the pixel cache, and so use those as bounds for our
change drawing.
meld/sourceview.py | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/meld/sourceview.py b/meld/sourceview.py
index cb3f83b..fb0a04f 100644
--- a/meld/sourceview.py
+++ b/meld/sourceview.py
@@ -165,13 +165,15 @@ class MeldSourceView(GtkSource.View):
visible = self.get_visible_rect()
textbuffer = self.get_buffer()
- x, y = self.window_to_buffer_coords(
- Gtk.TextWindowType.WIDGET, 0, 0)
- view_allocation = self.get_allocation()
+ _, rect = Gdk.cairo_get_clip_rectangle(context)
+ _, y = self.window_to_buffer_coords(
+ Gtk.TextWindowType.WIDGET, 0, rect.y)
+ _, y_end = self.window_to_buffer_coords(
+ Gtk.TextWindowType.WIDGET, 0, rect.y + rect.height)
bounds = (self.get_line_num_for_y(y),
- self.get_line_num_for_y(y + view_allocation.height + 1))
+ self.get_line_num_for_y(y_end))
- width, height = view_allocation.width, view_allocation.height
+ width = self.get_allocation().width
context.set_line_width(1.0)
# Paint chunk backgrounds and outlines
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]