[meld] linkmap: Stop deriving the corner radius from the line height



commit 1cc1326024acea01ae8be4beb67f9011309b8102
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Nov 28 06:54:26 2014 +1000

    linkmap: Stop deriving the corner radius from the line height
    
    Doing this makes very little sense, and it's always going to be within
    a pixel or two of the constant value. Erring on the side of a lower
    rounding here.

 meld/linkmap.py |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/meld/linkmap.py b/meld/linkmap.py
index 4645815..30d0e24 100644
--- a/meld/linkmap.py
+++ b/meld/linkmap.py
@@ -20,6 +20,10 @@ import math
 from gi.repository import Gtk
 
 
+# Rounded rectangle corner radius for culled changes display
+RADIUS = 3
+
+
 class LinkMap(Gtk.DrawingArea):
 
     __gtype_name__ = "LinkMap"
@@ -36,8 +40,6 @@ class LinkMap(Gtk.DrawingArea):
 
         self.set_color_scheme((filediff.fill_colors, filediff.line_colors))
 
-        self.line_height = filediff.pixels_per_line
-
     def set_color_scheme(self, color_map):
         self.fill_colors, self.line_colors = color_map
         self.queue_draw()
@@ -67,8 +69,6 @@ class LinkMap(Gtk.DrawingArea):
         wtotal = allocation.width
         # For bezier control points
         x_steps = [-0.5, (1. / 3) * wtotal, (2. / 3) * wtotal, wtotal + 0.5]
-        # Rounded rectangle corner radius for culled changes display
-        radius = self.line_height // 3
         q_rad = math.pi / 2
 
         left, right = self.view_indices
@@ -83,15 +83,15 @@ class LinkMap(Gtk.DrawingArea):
             if (t0 < 0 and t1 < 0) or (t0 > height and t1 > height):
                 if f0 == f1:
                     continue
-                context.arc(x_steps[0], f0 - 0.5 + radius, radius, -q_rad, 0)
-                context.arc(x_steps[0], f1 - 0.5 - radius, radius, 0, q_rad)
+                context.arc(x_steps[0], f0 - 0.5 + RADIUS, RADIUS, -q_rad, 0)
+                context.arc(x_steps[0], f1 - 0.5 - RADIUS, RADIUS, 0, q_rad)
                 context.close_path()
             elif (f0 < 0 and f1 < 0) or (f0 > height and f1 > height):
                 if t0 == t1:
                     continue
-                context.arc_negative(x_steps[3], t0 - 0.5 + radius, radius,
+                context.arc_negative(x_steps[3], t0 - 0.5 + RADIUS, RADIUS,
                                      -q_rad, q_rad * 2)
-                context.arc_negative(x_steps[3], t1 - 0.5 - radius, radius,
+                context.arc_negative(x_steps[3], t1 - 0.5 - RADIUS, RADIUS,
                                      q_rad * 2, q_rad)
                 context.close_path()
             else:


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