[Kst] extragear/graphics/kst/kst

Rick Chern rchern at interchange.ubc.ca
Tue Jul 19 02:41:36 CEST 2005


SVN commit 436088 by rchern:

Some sanity checks for RMatrix range


 M  +28 -1     kstrmatrix.cpp  


--- trunk/extragear/graphics/kst/kst/kstrmatrix.cpp #436087:436088
@@ -418,7 +418,34 @@
   } else {
     _nY = _reqNY;
   } 
+  
+  // now do some sanity checks
+  if (realXStart > xSize - 1) {
+    realXStart = xSize - 1;
+  }
+  if (realXStart < 0) {
+    realXStart = 0;  
+  }
+  if (realYStart > ySize - 1) {
+    realYStart = ySize - 1;  
+  }
+  if (realYStart < 0) {
+    realYStart = 0;  
+  }
+  if (_nX < 1) {
+    _nX = 1;  
+  }
+  if (realXStart + _nX > xSize) {
+    _nX = xSize - realXStart;  
+  }
+  if (_nY < 1) {
+    _nY = 1;  
+  }
+  if (realYStart + _nY > ySize) {
+    _nY = ySize - realYStart;  
+  }
 
+  // do the reading; skip or non-skip version
   if (_doSkip) {
     if (!doUpdateSkip(realXStart, realYStart, force)) {
       return NO_CHANGE;  
@@ -429,7 +456,7 @@
     }
   }
   
-  // otherwise remember these as the last updated range
+  // remember these as the last updated range
   _lastXStart = realXStart;
   _lastYStart = realYStart;
   _lastNX = _nX;


More information about the Kst mailing list