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

List:       kde-commits
Subject:    koffice/krita/core
From:       Casper Boemann <cbr () boemann ! dk>
Date:       2006-03-10 14:29:41
Message-ID: 1142000981.567613.8449.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 517271 by boemann:

Truly fix bug 123160
It was more complicated than first thought, and this also fixes the bad 
results for some angles of rotation.

CCBUG: 123160


 M  +11 -12    kis_transform_worker.cc  


--- trunk/koffice/krita/core/kis_transform_worker.cc #517270:517271
@@ -421,7 +421,12 @@
     Q_INT32 xtranslate = m_xtranslate;
     Q_INT32 ytranslate = m_ytranslate;
 
-    int rotQuadrant = int(rotation /(M_PI/2) + 0.5);
+    if(rotation < 0.0)
+        rotation = -fmod(-rotation, 2*M_PI) + 2*M_PI;
+    else
+        rotation = fmod(rotation, 2*M_PI);
+    int rotQuadrant = int(rotation /(M_PI/2) + 0.5) & 3;
+
     double tmp;
     switch(rotQuadrant)
     {
@@ -438,12 +443,15 @@
         case 2:
             rotate180(srcdev, tmpdev1);
             srcdev = tmpdev1;
-            rotation += M_PI;
+            rotation -= M_PI;
             break;
         case 3:
             rotateLeft90(srcdev, tmpdev1);
             srcdev = tmpdev1;
-            rotation += M_PI/2;
+            rotation += M_PI/2 + 2*M_PI;
+            tmp = xscale;
+            xscale = yscale;
+            yscale = tmp;
             break;
         default:
             break;
@@ -478,15 +486,6 @@
         return false;
     }
 
-/*
-    yscale = 1.0;
-    yshear = 0;
-    xscale = 1.0;
-    xshear = 0.25;
-    xtranslate = 0;
-    ytranslate = 0;
-*/
-
     transformPass <KisVLineIteratorPixel>(srcdev, tmpdev2, yscale, yshear, ytranslate, m_filter);
 //printf("time taken first pass %d\n",time.restart());
     if(m_dev->hasSelection())
[prev in list] [next in list] [prev in thread] [next in thread] 

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