]> git.sesse.net Git - kdenlive/commitdiff
Do not allow crop from start to get negative. This should fix a lot a problems that...
authorTill Theato <root@ttill.de>
Sun, 19 Sep 2010 08:25:11 +0000 (08:25 +0000)
committerTill Theato <root@ttill.de>
Sun, 19 Sep 2010 08:25:11 +0000 (08:25 +0000)
I will remove all the checks for cropStart < 0 in a few weeks if this change does not introduce some new problems.

svn path=/trunk/kdenlive/; revision=4906

src/abstractclipitem.cpp

index 6a406e45d18e6df6d0db1c977da0af743ca46a19..09d837a1b88e9ead91bf37d4631686917008ad17 100644 (file)
@@ -135,13 +135,18 @@ void AbstractClipItem::resizeStart(int posx, bool hasSizeLimit)
         durationDiff = GenTime() - cropStart();
     } else if (durationDiff >= cropDuration()) {
         return;
-        if (cropDuration() > GenTime(3, m_fps)) durationDiff = GenTime(3, m_fps);
-        else return;
+        /*if (cropDuration() > GenTime(3, m_fps)) durationDiff = GenTime(3, m_fps);
+        else return;*/
     }
     m_info.startPos += durationDiff;
 
-    if (type() == AVWIDGET)
+    // set to true if crop from start is negative (possible for color clips, images as they have no size limit)
+    bool negCropStart = false;
+    if (type() == AVWIDGET) {
         m_info.cropStart += durationDiff;
+        if (m_info.cropStart < GenTime())
+            negCropStart = true;
+    }
 
     m_info.cropDuration -= durationDiff;
     setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
@@ -159,6 +164,9 @@ void AbstractClipItem::resizeStart(int posx, bool hasSizeLimit)
         //kDebug()<<"// NEW START: "<<m_startPos.frames(25)<<", NW DUR: "<<m_cropDuration.frames(25);
     }
 
+    // set crop from start to 0 (isn't relevant as this only happens for color clips, images)
+    if (negCropStart)
+        m_info.cropStart = GenTime();
 
     //kDebug() << "-- NEW CLIP=" << startPos().frames(25) << "-" << endPos().frames(25);
     //setRect((double) m_startPos.frames(m_fps) * scale, rect().y(), (double) m_cropDuration.frames(m_fps) * scale, rect().height());