[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Thu Feb 12 05:44:28 CET 2004


CVS commit by staikos: 

lots of important performance fixes, update fixes, and crash avoidances


  M +6 -4      filterintermediate.h   1.4
  M +6 -3      kstdoc.cpp   1.54
  M +5 -1      kstequationcurve.cpp   1.42
  M +9 -2      kstfilteredvector.cpp   1.7
  M +11 -9     kstvector.cpp   1.56


--- kdeextragear-2/kst/kst/filterintermediate.h  #1.3:1.4
@@ -35,4 +35,5 @@ class FilterListBoxItem : public QListBo
           txt += ", ";
         }
+        if (it.data()) {
         if (it.data()->isGlobal()) {
           txt += it.data()->tagName();
@@ -41,4 +42,5 @@ class FilterListBoxItem : public QListBo
         }
       }
+      }
       txt += ")";
       setText(txt);

--- kdeextragear-2/kst/kst/kstdoc.cpp  #1.53:1.54
@@ -381,5 +381,5 @@ class FakeLocker {
 KstObject::UpdateType KstDoc::update(bool force) {
   unsigned i;
-  int lastFrame=-1;
+  int lastFrame = -1;
   QString message;
   KstObject::UpdateType tU, U = KstObject::NO_CHANGE;
@@ -438,7 +438,10 @@ KstObject::UpdateType KstDoc::update(boo
 
   /* update all vectors  -  brute force */
+  // FIXME: can't update slave vectors, so for now we just check for
+  //        filtered vectors - yuck
   KstVectorList vl = KST::vectorList;
   for (KstVectorList::Iterator it = vl.begin(); it != vl.end(); ++it) {
-    if (dynamic_cast<KstRVector*>((*it).data())) {
+    //if (dynamic_cast<KstRVector*>((*it).data())) {
+    if (!dynamic_cast<KstFilteredVector*>((*it).data())) {
       continue;
     }
@@ -450,5 +453,5 @@ KstObject::UpdateType KstDoc::update(boo
         return KstObject::NO_CHANGE;
       }
-      if (tU == KstObject::READ) {
+      if (tU == KstObject::READ && U != KstObject::UPDATE) {
         U = KstObject::READ;
       } else if (U == KstObject::NO_CHANGE) {

--- kdeextragear-2/kst/kst/kstequationcurve.cpp  #1.41:1.42
@@ -529,4 +529,6 @@ bool KstEquationCurve::FillY(bool force)
   int ns;
 
+  kdDebug() << "FillY <<<<<<< " << endl;
+
   // determine value of Interp
   if (DoInterp) {
@@ -605,4 +607,6 @@ bool KstEquationCurve::FillY(bool force)
   KstVectorPtr iv = (*_xVector);
 
+  // This is WAY too expensive.  We need to compile the equation into a tree
+  // and execute without string parsing
   for(i = i0; i < NS; ++i) {
     //X = (float)i*x_step + MinX;
@@ -745,6 +749,6 @@ bool KstEquationCurve::FillY(bool force)
   }
 
+  kdDebug() << "FillY >>>>>>> " << endl;
   return true;
-
 }
 

--- kdeextragear-2/kst/kst/kstfilteredvector.cpp  #1.6:1.7
@@ -55,10 +55,17 @@ KstFilteredVector::~KstFilteredVector() 
 
 KstObject::UpdateType KstFilteredVector::update(int update_counter) {
+  KstObject::UpdateType ut = KstObject::NO_CHANGE;
   if (_parent && _filterSet) {
-    _parent->update(update_counter);
+    ut = _parent->update(update_counter);
     _filterSet->apply(_parent, KstVectorPtr(this));
   }
 
-  KstObject::UpdateType ut = KstVector::update(update_counter);
+  if (update_counter == -1 || ut != KstObject::NO_CHANGE) {
+    KstObject::UpdateType u = KstVector::update(update_counter);
+    if (ut != KstObject::UPDATE) {
+      ut = u;
+    }
+  }
+
   return ut;
 }

--- kdeextragear-2/kst/kst/kstvector.cpp  #1.55:1.56
@@ -259,5 +259,5 @@ KstObject::UpdateType KstVector::update(
       /* Do Nothing */ ;
 
-    if (i==_size) {
+    if (i == _size) {
       _scalars["sum"]->setValue(sum);
       _scalars["sumsquared"]->setValue(sum2);
@@ -273,16 +273,17 @@ KstObject::UpdateType KstVector::update(
     i0 = i;
 
-    if (i0>0) {
+    if (i0 > 0) {
       _is_rising = false;
     }
 
     max = min = sum = sum2 = _v[i0];
-    if (_v[i0]>0)
+    if (_v[i0] > 0) {
       minpos = _v[i0];
-    else
+    } else {
       minpos = 1.0E300;
+    }
 
     last_v = _v[i0];
-    for (i=i0; i < _size; i++) {
+    for (i = i0; i < _size; i++) {
       v = _v[i]; // get rid of redirections
 
@@ -292,6 +292,6 @@ KstObject::UpdateType KstVector::update(
         dv2 += dv*dv;
 
-        if (v<=last_v) {
-          if (i!=i0) {
+        if (v <= last_v) {
+          if (i != i0) {
             _is_rising = false;
           }
@@ -334,6 +335,7 @@ KstObject::UpdateType KstVector::update(
         } else {
           i += 20;
-          if (i < _size)
+          if (i < _size) {
             last_v = _v[i];
+          }
           i++;
         }





More information about the Kst mailing list