[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [digikam] libs/dimg/filters/transform: fikx infinite loop if image don't have black border hole to c
From:       Gilles Caulier <caulier.gilles () gmail ! com>
Date:       2013-03-31 13:24:30
Message-ID: 20130331132430.74CEEA604F () git ! kde ! org
[Download RAW message or body]

Git commit b53ca584361daf1a134d698bfcaedf9021975b84 by Gilles Caulier.
Committed on 31/03/2013 at 15:22.
Pushed by cgilles into branch 'master'.

fikx infinite loop if image don't have black border hole to crop.

M  +9    -17   libs/dimg/filters/transform/autocrop.cpp

http://commits.kde.org/digikam/b53ca584361daf1a134d698bfcaedf9021975b84

diff --git a/libs/dimg/filters/transform/autocrop.cpp b/libs/dimg/filters/transform/autocrop.cpp
index cd95c20..2f99fec 100644
--- a/libs/dimg/filters/transform/autocrop.cpp
+++ b/libs/dimg/filters/transform/autocrop.cpp
@@ -106,21 +106,6 @@ void AutoCrop::startAnalyse()
     breakflag  = 0;
     int width  = img.width();
     int height = img.height();
-    QPoint p;
-
-    //    for(i=210; i < 211; i++)
-    //    {
-    //        for(j=400; j < 410; j++)
-    //        {
-    //            p.setX(j);
-    //            p.setY(i);
-    //            c = QColor::fromRgb(img.pixel(p));
-    //            kDebug() << c;
-    //            if(c == Qt::white)
-    //                kDebug() << "WHITE! yay!";
-    //        }
-    //    }
-    //    kDebug() << "I'm a genius!";
 
     for(i=0; i < width; i++)
     {
@@ -427,15 +412,17 @@ void AutoCrop::startAnalyse()
     bool fixrightmargin  = false;
     bool fixleftmargin   = false;
     bool fixbottommargin = false;
-    //    int count=0;
+    int count=0;
 
     endupi      = centeri;
     endupj      = centerj;
     travelright = traveldown = -1;
     travelleft  = travelup   = 0;
+    count       = limitcolumn + limitrow - 2;
 
-    while(true)
+    while(count!=0)
     {
+        count--;
         switch((counter%4))
         {
             case 0 :    //travelling right
@@ -661,6 +648,7 @@ void AutoCrop::startAnalyse()
             break;
     }
 
+    kDebug() << "Count     : " << count;
     kDebug() << "Endupi    : " << endupi;
     kDebug() << "Endupj    : " << endupj;
     kDebug() << "Endrighti : " << endrighti;
@@ -689,6 +677,10 @@ void AutoCrop::startAnalyse()
     d->cropArea.setTopLeft(icp1);
     d->cropArea.setBottomRight(icp2);
 
+    if( count == 0 )
+    {
+        d->cropArea = crop;
+    }
     kDebug () << "Inner Crop Area : " << d->cropArea;
 }
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic