[Kst] branches/work/kst/portto4/kst

Barth Netterfield netterfield at astro.utoronto.ca
Mon Aug 23 06:52:04 CEST 2010


SVN commit 1166844 by netterfield:

Speedup:

Don't do a qstring keyed hash lookup in the inner loop of drawing images.



 M  +0 -17     devel-docs/Kst2Specs/Wishlist  
 M  +3 -1      src/libkst/matrix.h  
 M  +5 -3      src/libkstmath/image.cpp  
 M  +1 -1      src/libkstmath/image.h  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Wishlist #1166843:1166844
@@ -41,25 +41,8 @@
 
 1.x kst file read compatibility...
 
-------------
-
-DECIDE: absolute or relative file names in kst files?
-  kst1.x uses absolute.  This becomes a problem when the directory changes.
-
------------
-
-Easier way to specify reversed axis when loading sky images:
-  -can desire to reverse be gleaned from the fits image?
-  -command line option?
-  -new-image (sticky) option?
-
 ---------
 
-After the label creation dialog has been applied, attach the label to
-the mouse, to allow it to be dragged around until placed by a click.
-
----------
-
 Thread kst2
 
 --------------------
--- branches/work/kst/portto4/kst/src/libkst/matrix.h #1166843:1166844
@@ -30,6 +30,9 @@
 
 namespace Kst {
 
+class Matrix;
+typedef SharedPtr<Matrix> MatrixPtr;
+
 class KSTCORE_EXPORT Matrix : public Primitive {
   Q_OBJECT
 
@@ -185,7 +188,6 @@
 
 };
 
-typedef SharedPtr<Matrix> MatrixPtr;
 typedef ObjectList<Matrix> MatrixList;
 typedef ObjectMap<Matrix> MatrixMap;
 
--- branches/work/kst/portto4/kst/src/libkstmath/image.cpp #1166843:1166844
@@ -144,10 +144,10 @@
 }
 
 
-QColor Image::getMappedColor(double x, double y) {
+QColor Image::getMappedColor(MatrixPtr m, double x, double y) {
   bool ok;
 
-  double z = _inputMatrices[THEMATRIX]->value(x, y, &ok);
+  double z = m->value(x, y, &ok);
   if (ok) {
     int index;
     if (_zUpper - _zLower != 0) {
@@ -526,6 +526,8 @@
 
       // color map
       QColor thisPixel;
+      MatrixPtr m = _inputMatrices.value(THEMATRIX);
+
       if (image->hasColorMap()) {
         int hXlXDiff = d2i(img_Hx_pix - img_Lx_pix);
         int hYlYDiff = d2i(img_Hy_pix - img_Ly_pix - 1);
@@ -544,7 +546,7 @@
             } else {
               new_y = (y + 1 + img_Ly_pix - b_Y) / m_Y;
             }
-            thisPixel = image->getMappedColor(new_x, new_y);
+            thisPixel = image->getMappedColor(m, new_x, new_y);
             if (thisPixel.isValid()) {
               scanLine[x] = thisPixel.rgb();
             }
--- branches/work/kst/portto4/kst/src/libkstmath/image.h #1166843:1166844
@@ -51,7 +51,7 @@
     virtual QString propertyString() const;
 
     virtual bool getNearestZ(double x, double y, double& z);
-    virtual QColor getMappedColor(double x, double y);
+    virtual QColor getMappedColor(MatrixPtr m, double x, double y);
     virtual void setPalette(const Palette &pal);
     virtual void setUpperThreshold(double z);
     virtual void setLowerThreshold(double z);


More information about the Kst mailing list