]> git.sesse.net Git - kdenlive/commitdiff
Fix resizing issue
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 22 Sep 2009 19:43:45 +0000 (19:43 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 22 Sep 2009 19:43:45 +0000 (19:43 +0000)
svn path=/trunk/kdenlive/; revision=3925

src/abstractclipitem.cpp
src/clipitem.cpp

index 5bb88b982fce697cc302369f76dd2d7bc164d7dd..0e4228659d9fa70970f43d6a68a8410dd526ade5 100644 (file)
@@ -100,7 +100,7 @@ void AbstractClipItem::resizeStart(int posx, double speed)
     }
     //kDebug()<<"// DURATION DIFF: "<<durationDiff.frames(25)<<", POS: "<<pos().x();
     m_info.startPos += durationDiff;
-    GenTime originalDiff = GenTime((int)(durationDiff.frames(m_fps) * speed + 0.5), m_fps);
+    GenTime originalDiff = GenTime((int)(durationDiff.frames(m_fps) * speed), m_fps);
 
     if (type() == AVWIDGET) {
         m_info.cropStart += durationDiff;
@@ -114,7 +114,8 @@ void AbstractClipItem::resizeStart(int posx, double speed)
     if ((int) scenePos().x() != posx) {
         //kDebug()<<"//////  WARNING, DIFF IN XPOS: "<<pos().x()<<" == "<<m_startPos.frames(m_fps);
         GenTime diff = GenTime((int) pos().x() - posx, m_fps);
-        GenTime originalDiff = GenTime((int)(diff.frames(m_fps) * speed + 0.5), m_fps);
+        GenTime originalDiff = GenTime((int)(diff.frames(m_fps) * speed), m_fps);
+
         if (type() == AVWIDGET) {
             m_info.cropStart += diff;
             m_info.originalcropStart += originalDiff;
@@ -150,12 +151,12 @@ void AbstractClipItem::resizeEnd(int posx, double speed)
 {
     GenTime durationDiff = GenTime(posx, m_fps) - endPos();
     if (durationDiff == GenTime()) return;
-    //kDebug() << "// DUR DIFF1:" << durationDiff.frames(25) << ", ADJUSTED: " << durationDiff.frames(25) * speed << ", SPED:" << speed;
     if (cropDuration() + durationDiff <= GenTime()) {
         durationDiff = GenTime() - (cropDuration() - GenTime(3, m_fps));
     }
-    //kDebug() << "// DUR DIFF2:" << durationDiff.frames(25) << ", ADJUSTED: " << durationDiff.frames(25) * speed << ", SPED:" << speed;
-    m_info.cropDuration += GenTime((int)(durationDiff.frames(m_fps) * speed + 0.5), m_fps);
+
+    m_info.cropDuration += GenTime((int)(durationDiff.frames(m_fps) * speed), m_fps);
+
     setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
     if (durationDiff > GenTime()) {
         QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
@@ -166,7 +167,7 @@ void AbstractClipItem::resizeEnd(int posx, double speed)
                 kDebug() << "/////////  CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos();
                 kDebug() << "/////////  COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos();*/
                 GenTime diff = ((AbstractClipItem *)item)->startPos() - GenTime(1, m_fps) - startPos();
-                m_info.cropDuration = GenTime((int)(diff.frames(m_fps) * speed + 0.5), m_fps);
+                m_info.cropDuration = GenTime((int)(diff.frames(m_fps) * speed), m_fps);
                 setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
                 break;
             }
index f5fc70ade392402f442bc363fffefde53cfc20d6..e1f6331c7387bce9537c3b5816fcb1a1b450f258 100644 (file)
@@ -1086,10 +1086,9 @@ void ClipItem::resizeEnd(int posx, double /*speed*/)
     if (posx > max && maxDuration() != GenTime()) posx = max;
     if (posx == endPos().frames(m_fps)) return;
     //kDebug() << "// NEW POS: " << posx << ", OLD END: " << endPos().frames(m_fps);
-    const int previous = (int)(cropStart() + cropDuration()).frames(m_fps) - 1;
+    const int previous = cropDuration().frames(m_fps);
     AbstractClipItem::resizeEnd(posx, m_speed);
-    const int current = (int)(cropStart() + cropDuration()).frames(m_fps) - 1;
-    if (current != previous) {
+    if ((int) cropDuration().frames(m_fps) != previous) {
         if (m_hasThumbs && KdenliveSettings::videothumbnails()) {
             /*connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));*/
             m_endThumbTimer.start(150);