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

List:       kde-commits
Subject:    koffice/krita/core
From:       Cyrille Berger <cyb () lepi ! org>
Date:       2006-02-22 18:07:45
Message-ID: 1140631665.736408.21523.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 512511 by berger:

fix crash in the convolution painter when a layer doesn't start at 0,0

CC: boud@valdyas.org


 M  +11 -11    kis_convolution_painter.cc  


--- trunk/koffice/krita/core/kis_convolution_painter.cc #512510:512511
@@ -105,14 +105,14 @@
     }
 
     // Determine the kernel's extent from the center pixel
-    Q_INT32 kw, kh, khalfWidth, khalfHeight, widthMinuskhw, heightMinuskhh;
+    Q_INT32 kw, kh, khalfWidth, khalfHeight, xLastMinuskhw, yLastMinuskhh;
     kw = kernel->width;
     kh = kernel->height;
     khalfWidth = (kw - 1) / 2;
     khalfHeight = (kh - 1) / 2;
 
-    widthMinuskhw = (w - khalfWidth);
-    heightMinuskhh = (h - khalfHeight);
+    xLastMinuskhw = x + (w - khalfWidth);
+    yLastMinuskhh = y + (h - khalfHeight);
 
     // Don't try to convolve on an area smaller than the kernel, or with a kernel \
                that is not square or has no center pixel.
     if (w < kw || h < kh || kw&1 == 0 || kh&1 == 0 || kernel->factor == 0 ) return;
@@ -221,14 +221,14 @@
 {
     int lastProgressPercent = 0;
     // Determine the kernel's extent from the center pixel
-    Q_INT32 kw, kh, khalfWidth, khalfHeight, widthMinuskhw, heightMinuskhh;
+    Q_INT32 kw, kh, khalfWidth, khalfHeight, xLastMinuskhw, yLastMinuskhh;
     kw = kernel->width;
     kh = kernel->height;
     khalfWidth = (kw - 1) / 2;
     khalfHeight = (kh - 1) / 2;
 
-    widthMinuskhw = (w - khalfWidth);
-    heightMinuskhh = (h - khalfHeight);
+    xLastMinuskhw = x + (w - khalfWidth);
+    yLastMinuskhh = y + (h - khalfHeight);
 
     KisColorSpace * cs = m_device->colorSpace();
 
@@ -253,9 +253,9 @@
         {
             itH += itStart;
             itStart = 0;
-        } else if(itStart + kh > heightMinuskhh)
+        } else if(itStart + kh > yLastMinuskhh)
         {
-            itH -= itStart + kh - heightMinuskhh;
+            itH -= itStart + kh - yLastMinuskhh;
         }
         KisVLineIteratorPixel kit = m_device -> createVLineIterator(col + \
khalfWidth, itStart, itH, false);  while (!hit.isDone()) {
@@ -301,9 +301,9 @@
                         i = krow * kw;
                     }
                     Q_INT32 itH = kh;
-                    if(row + khalfHeight > heightMinuskhh)
+                    if(row + khalfHeight > yLastMinuskhh)
                     {
-                        itH += heightMinuskhh - row - khalfHeight;
+                        itH += yLastMinuskhh - row - khalfHeight;
                     }
                     for (; krow <  itH; ++krow) {
 
@@ -345,7 +345,7 @@
                         Q_UINT8** d = pixelPtrCache.data() + krow * kw;
                         memmove( d, d + 1, (kw-1)*sizeof(Q_UINT8*));
                     }
-                    if(col < widthMinuskhw)
+                    if(col < xLastMinuskhw)
                     {
                         Q_INT32 i = kw - 1;
 //                         KisVLineIteratorPixel kit = m_device -> \
createVLineIterator(col + khalfWidth, itStart, itH, false);


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

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