From 681711792d35b135e2026056e7004165d744c1f7 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Sun, 12 Sep 2010 08:33:35 +0000 Subject: [PATCH] Fix problems when changing duration (from end) of clip with negative crop from start svn path=/trunk/kdenlive/; revision=4873 --- src/abstractclipitem.cpp | 1 + src/customtrackview.cpp | 2 +- src/customtrackview.h | 4 +--- src/renderer.cpp | 9 ++++++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/abstractclipitem.cpp b/src/abstractclipitem.cpp index 2046a6cb..6a406e45 100644 --- a/src/abstractclipitem.cpp +++ b/src/abstractclipitem.cpp @@ -190,6 +190,7 @@ void AbstractClipItem::resizeEnd(int posx) } m_info.cropDuration += durationDiff; + m_info.endPos += durationDiff; setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height()); if (durationDiff > GenTime()) { diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 041a0922..1d73e133 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -4499,7 +4499,7 @@ void CustomTrackView::prepareResizeClipEnd(AbstractClipItem* item, ItemInfo oldI if (item->type() == AVWIDGET) { ItemInfo resizeinfo = info; resizeinfo.track = m_document->tracksCount() - resizeinfo.track; - bool success = m_document->renderer()->mltResizeClipEnd(resizeinfo, resizeinfo.endPos - resizeinfo.startPos); + bool success = m_document->renderer()->mltResizeClipEnd(resizeinfo, resizeinfo.cropDuration); if (success) { // Check if there is an automatic transition on that clip (lower track) Transition *tr = getTransitionItemAtEnd(oldInfo.endPos, oldInfo.track); diff --git a/src/customtrackview.h b/src/customtrackview.h index fdfdc798..adc68714 100644 --- a/src/customtrackview.h +++ b/src/customtrackview.h @@ -398,9 +398,7 @@ private: /** @brief Updates @param item's pan and zoom effect after resize or cut. * @param item clip whose pan and zoom effect should be updated - * @param cutPos (optional) if clip was cut, cut position relative to the original's clip position - * - */ + * @param cutPos (optional) if clip was cut, cut position relative to the original's clip position */ void updatePanZoom(ClipItem *item, GenTime cutPos = GenTime()); private slots: diff --git a/src/renderer.cpp b/src/renderer.cpp index 8ad09f5c..56fccbbe 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -2941,15 +2941,22 @@ bool Render::mltResizeClipEnd(ItemInfo info, GenTime clipDuration) int clipIndex = trackPlaylist.get_clip_index_at((int) info.startPos.frames(m_fps)); //kDebug() << "// SELECTED CLIP START: " << trackPlaylist.clip_start(clipIndex); Mlt::Producer *clip = trackPlaylist.get_clip(clipIndex); + int previousStart = clip->get_in(); int newDuration = (int) clipDuration.frames(m_fps) - 1; - int currentOut = (int)(info.cropStart + info.cropDuration).frames(m_fps) - 1; int diff = newDuration - (trackPlaylist.clip_length(clipIndex) - 1); + + int currentOut; + if (info.cropStart < GenTime()) + currentOut = newDuration - info.cropStart.frames(m_fps); + else + currentOut = newDuration + previousStart; if (currentOut > clip->get_length()) { clip->parent().set("length", currentOut + 1); clip->parent().set("out", currentOut); clip->set("length", currentOut + 1); } + /*if (newDuration > clip->get_out()) { clip->parent().set_in_and_out(0, newDuration + 1); clip->set_in_and_out(0, newDuration + 1); -- 2.39.2