[dia] [substitute] Standard - ZigZagLine: keep points in range



commit 5a3480649772cd61463a3d29239fc735bb95d807
Author: Hans Breuer <hans breuer org>
Date:   Sat Aug 16 15:23:55 2014 +0200

    [substitute] Standard - ZigZagLine: keep points in range

 objects/standard/zigzagline.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/objects/standard/zigzagline.c b/objects/standard/zigzagline.c
index af5456d..ccfffd7 100644
--- a/objects/standard/zigzagline.c
+++ b/objects/standard/zigzagline.c
@@ -409,7 +409,10 @@ _convert_to_bezierline_callback (DiaObject *obj, Point *clicked, gpointer data)
   for (i = 1, j = 1; i < num_points && j < orth->numpoints; ++i) {
     bp[i].type = BEZ_CURVE_TO;
     bp[i].p1 = orth->points[j++];
-    bp[i].p2 = orth->points[j++];
+    if (j == orth->numpoints - 1)
+      bp[i].p2 = orth->points[j-1]; /* use the previous point again */
+    else
+      bp[i].p2 = orth->points[j++];
     if (j + 2 < orth->numpoints) {
       /* if we have more than two points left, use the middle of the segment */
       Point p = { (orth->points[j-1].x + orth->points[j].x) / 2.0,


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