[meld] Avoid missing pixels in linkmap insert/delete chunks (closes bgo#580311)



commit 5d4633ce97abafed79c26edee71436914c507d1d
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Jul 17 10:30:27 2009 +1000

    Avoid missing pixels in linkmap insert/delete chunks (closes bgo#580311)
    
    Painting of insert/delete chunks in the linkmap currently leaves a
    single-pixel gap around the insertion point. This patch slightly improves
    the visual appearance by having the lines meet up properly. The tradeoff
    is that ending lines on the textview are now drawn one pixel higher, and
    this makes changed chunks look not-quite-as-nice. However, it also avoids
    a visual bug in three-way comparisons in the middle pane when a line gap
    acts as both a chunk end and a chunk start.

 filediff.py |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/filediff.py b/filediff.py
index acc1546..7b6e5d7 100644
--- a/filediff.py
+++ b/filediff.py
@@ -689,11 +689,11 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
             context.stroke()
             if change[2] != change[1]:
                 ypos1 = self._line_to_pixel(pane, change[2]) - visible.y
-                context.move_to(-0.5, ypos1 + 0.5)
+                context.move_to(-0.5, ypos1 - 0.5)
                 context.rel_line_to(width + 1, 0)
                 context.stroke()
                 context.set_source_rgb(*self.fill_colors[change[0]])
-                context.rectangle(0, ypos0, width, ypos1 - ypos0)
+                context.rectangle(0, ypos0, width, ypos1 - ypos0 - 1)
                 context.fill()
 
         for change in self.linediffer.single_changes(pane):
@@ -1176,19 +1176,14 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
             f0,f1 = [self._line_to_pixel(which,   l) - pix_start[which  ] for l in c[1:3] ]
             t0,t1 = [self._line_to_pixel(which+1, l) - pix_start[which+1] for l in c[3:5] ]
 
-            if f0 == f1:
-                f0 -= 1
-            if t0 == t1:
-                t0 -= 1
-
             context.move_to(x_steps[0], f0 - 0.5)
             context.curve_to(x_steps[1], f0 - 0.5,
                              x_steps[2], t0 - 0.5,
                              x_steps[3], t0 - 0.5)
-            context.line_to(x_steps[3], t1 + 0.5)
-            context.curve_to(x_steps[2], t1 + 0.5,
-                             x_steps[1], f1 + 0.5,
-                             x_steps[0], f1 + 0.5)
+            context.line_to(x_steps[3], t1 - 0.5)
+            context.curve_to(x_steps[2], t1 - 0.5,
+                             x_steps[1], f1 - 0.5,
+                             x_steps[0], f1 - 0.5)
             context.close_path()
 
             context.set_source_rgb(*self.fill_colors[c[0]])



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