]> git.sesse.net Git - kdenlive/commitdiff
Bezier Spline Editor: Do not draw handle 1 of first and handle 2 of last point
authorTill Theato <root@ttill.de>
Sat, 1 Jan 2011 22:47:57 +0000 (22:47 +0000)
committerTill Theato <root@ttill.de>
Sat, 1 Jan 2011 22:47:57 +0000 (22:47 +0000)
svn path=/trunk/kdenlive/; revision=5236

src/beziercurve/beziersplineeditor.cpp

index 9846ee1fb36debe40f5b79b18e087b6e4f584e60..cf2c17410e5e63daf44e4616041e476f8e6e3afe 100644 (file)
@@ -127,6 +127,7 @@ void BezierSplineEditor::paintEvent(QPaintEvent* event)
     /*
      * Points + Handles
      */
+    int max = m_spline.points().count() - 1;
     p.setPen(QPen(Qt::red, 1, Qt::SolidLine));
     BPoint point;
     QPolygon handle(4);
@@ -135,18 +136,22 @@ void BezierSplineEditor::paintEvent(QPaintEvent* event)
                      4,  1,
                      1,  4,
                      -2, 1);
-    for (int i = 0; i < m_spline.points().count(); ++i) {
+    for (int i = 0; i <= max; ++i) {
         point = m_spline.points().at(i);
         if (i == m_currentPointIndex) {
             p.setBrush(QBrush(QColor(Qt::red), Qt::SolidPattern));
-            p.drawLine(QLineF(point.h1.x() * wWidth, wHeight - point.h1.y() * wHeight, point.p.x() * wWidth, wHeight - point.p.y() * wHeight).translated(offset, offset));
-            p.drawLine(QLineF(point.p.x() * wWidth, wHeight - point.p.y() * wHeight, point.h2.x() * wWidth, wHeight - point.h2.y() * wHeight).translated(offset, offset));
+            if (i != 0)
+                p.drawLine(QLineF(point.h1.x() * wWidth, wHeight - point.h1.y() * wHeight, point.p.x() * wWidth, wHeight - point.p.y() * wHeight).translated(offset, offset));
+            if (i != max)
+                p.drawLine(QLineF(point.p.x() * wWidth, wHeight - point.p.y() * wHeight, point.h2.x() * wWidth, wHeight - point.h2.y() * wHeight).translated(offset, offset));
         }
 
         p.drawEllipse(QRectF(point.p.x() * wWidth - 3,
                              wHeight - 3 - point.p.y() * wHeight, 6, 6).translated(offset, offset));
-        p.drawConvexPolygon(handle.translated(point.h1.x() * wWidth, wHeight - point.h1.y() * wHeight).translated(offset, offset));
-        p.drawConvexPolygon(handle.translated(point.h2.x() * wWidth, wHeight - point.h2.y() * wHeight).translated(offset, offset));
+        if (i != 0)
+            p.drawConvexPolygon(handle.translated(point.h1.x() * wWidth, wHeight - point.h1.y() * wHeight).translated(offset, offset));
+        if (i != max)
+            p.drawConvexPolygon(handle.translated(point.h2.x() * wWidth, wHeight - point.h2.y() * wHeight).translated(offset, offset));
 
         if ( i == m_currentPointIndex)
             p.setBrush(QBrush(Qt::NoBrush));