From 1fe9c5bd6aaf31f9471e99840d02d5a00f1c82bb Mon Sep 17 00:00:00 2001 From: Till Theato Date: Sat, 1 Jan 2011 22:47:57 +0000 Subject: [PATCH] Bezier Spline Editor: Do not draw handle 1 of first and handle 2 of last point svn path=/trunk/kdenlive/; revision=5236 --- src/beziercurve/beziersplineeditor.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/beziercurve/beziersplineeditor.cpp b/src/beziercurve/beziersplineeditor.cpp index 9846ee1f..cf2c1741 100644 --- a/src/beziercurve/beziersplineeditor.cpp +++ b/src/beziercurve/beziersplineeditor.cpp @@ -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)); -- 2.39.2