[multimedia/kdenlive] src/dialogs: timeremap: draw time_map curve in RemapView
Jean-Baptiste Mardelle <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit e7bd0747e0737bef32282a9a2e115e57e2c421e5 by Jean-Baptiste Mardelle, on behalf of Yash Bavadiya.
Committed on 18/08/2026 at 08:31.
Pushed by mardelle into branch 'master'.
timeremap: draw time_map curve in RemapView
M +27 -0 src/dialogs/timeremap.cpp
https://invent.kde.org/multimedia/kdenlive/-/commit/e7bd0747e0737bef32282a9a2e115e57e2c421e5
diff --git a/src/dialogs/timeremap.cpp b/src/dialogs/timeremap.cpp
index 129cc91ea7..b24d5c9e8f 100644
--- a/src/dialogs/timeremap.cpp
+++ b/src/dialogs/timeremap.cpp
@@ -1544,6 +1544,33 @@ void RemapView::paintEvent(QPaintEvent *event)
p.drawLine(outPos, m_lineHeight, outPos, m_bottomView - m_lineHeight);
}
+ /*
+ * Time remap curve, drawn between the two rulers. The x axis is the output
+ * position, the y axis is the source position sampled from the time_map
+ * animation, so the curve shape matches what MLT will play back
+ */
+ if (!m_keyframes.isEmpty() && m_remapProps.is_valid() && m_remapProps.property_exists("time_map")) {
+ int maxSource = remapMax();
+ if (maxSource > 0) {
+ double curveTop = m_lineHeight * 1.75;
+ double curveBottom = m_bottomView - m_lineHeight * 1.75;
+ QColor curveColor = m_colSelected;
+ curveColor.setAlpha(160);
+ p.setPen(curveColor);
+ p.setRenderHint(QPainter::Antialiasing);
+ QPolygonF curvePoints;
+ for (int px = 0; px <= maxWidth; px++) {
+ int framePos = int((px / m_zoomFactor + m_zoomStart) / m_scale);
+ double sourcePos = m_remapProps.anim_get_double("time_map", framePos + m_inFrame) * fps - m_inFrame;
+ double ratio = qBound(0., sourcePos / maxSource, 1.);
+ curvePoints << QPointF(px + m_offset, curveBottom - ratio * (curveBottom - curveTop));
+ }
+ p.drawPolyline(curvePoints);
+ p.setRenderHint(QPainter::Antialiasing, false);
+ p.setPen(m_colKeyframe);
+ }
+ }
+
/*
* Keyframes
*/