Diagram.py: set color right before drawing the stroke in draw_line()
authorAntonio Ospite <ao2@ao2.it>
Thu, 18 Jun 2015 10:04:25 +0000 (12:04 +0200)
committerAntonio Ospite <ao2@ao2.it>
Thu, 18 Jun 2015 10:04:25 +0000 (12:04 +0200)
Diagram.py

index ee7dd36..74c3bb2 100755 (executable)
@@ -156,10 +156,10 @@ class Diagram(object):
 
     def draw_line(self, x1, y1, x2, y2, stroke_color=[0, 0, 0, 1]):
         cr = self.cr
 
     def draw_line(self, x1, y1, x2, y2, stroke_color=[0, 0, 0, 1]):
         cr = self.cr
-        r, g, b, a = self.color_to_rgba(stroke_color)
-        cr.set_source_rgba(r, g, b, a)
         cr.move_to(x1, y1)
         cr.line_to(x2, y2)
         cr.move_to(x1, y1)
         cr.line_to(x2, y2)
+        r, g, b, a = self.color_to_rgba(stroke_color)
+        cr.set_source_rgba(r, g, b, a)
         cr.stroke()
 
     def draw_rect_from_center(self, cx, cy, width, height, theta=0,
         cr.stroke()
 
     def draw_rect_from_center(self, cx, cy, width, height, theta=0,