[Kst] extragear/graphics/kst/src/libkst

Eli Fidler eli at staikos.net
Thu Feb 8 00:28:37 CET 2007


SVN commit 631421 by fidler:

disable display tag updating for efficiency

don't do a complete rename when in setTagName() when changing to the
same tag


 M  +2 -0      kstdatasource.cpp  
 M  +16 -0     kstmatrix.cpp  
 M  +17 -0     kstvector.cpp  


--- trunk/extragear/graphics/kst/src/libkst/kstdatasource.cpp #631420:631421
@@ -442,10 +442,12 @@
 
 //  kstdDebug() << "  removing metadata strings" << endl;
   KST::stringList.lock().writeLock();
+  KST::stringList.setUpdateDisplayTags(false);
   for (QDictIterator<KstString> it(_metaData); it.current(); ++it) {
 //    kstdDebug() << "    removing " << it.current()->tag().tagString() << endl;
     KST::stringList.remove(it.current());
   }
+  KST::stringList.setUpdateDisplayTags(true);
   KST::stringList.lock().unlock();
 
   _numFramesScalar = 0L;
--- trunk/extragear/graphics/kst/src/libkst/kstmatrix.cpp #631420:631421
@@ -77,10 +77,12 @@
 KstMatrix::~KstMatrix() {
   // get rid of the stat scalars
   KST::scalarList.lock().writeLock();
+  KST::scalarList.setUpdateDisplayTags(false);
   for (QDictIterator<KstScalar> iter(_statScalars); iter.current(); ++iter) {
     KST::scalarList.remove(iter.current());
     iter.current()->_KShared_unref();  
   }
+  KST::scalarList.setUpdateDisplayTags(true);
   KST::scalarList.lock().unlock();
 
   if (_z) {
@@ -371,6 +373,10 @@
     
     
 void KstMatrix::setTagName(const KstObjectTag& tag) {
+  if (tag == this->tag()) {
+    return;
+  }
+
   KstWriteLocker l(&KST::matrixList.lock());
 
   KST::matrixList.doRename(this, tag);
@@ -420,6 +426,9 @@
 
 
 void KstMatrix::createScalars() {
+  KstWriteLocker sl(&KST::scalarList.lock());
+  KST::scalarList.setUpdateDisplayTags(false);
+
   _statScalars.insert("max", new KstScalar(KstObjectTag("Max", tag()), this));
   _statScalars["max"]->_KShared_ref();
   _statScalars.insert("min", new KstScalar(KstObjectTag("Min", tag()), this));
@@ -438,10 +447,15 @@
   _statScalars["sumsquared"]->_KShared_ref();
   _statScalars.insert("minpos", new KstScalar(KstObjectTag("MinPos", tag()), this));
   _statScalars["minpos"]->_KShared_ref();
+
+  KST::scalarList.setUpdateDisplayTags(true);
 }
 
 
 void KstMatrix::renameScalars() {
+  KstWriteLocker sl(&KST::scalarList.lock());
+  KST::scalarList.setUpdateDisplayTags(false);
+
   _statScalars["max"]->setTagName(KstObjectTag("Max", tag()));
   _statScalars["min"]->setTagName(KstObjectTag("Min", tag()));
   _statScalars["mean"]->setTagName(KstObjectTag("Mean", tag()));
@@ -451,6 +465,8 @@
   _statScalars["sum"]->setTagName(KstObjectTag("Sum", tag()));
   _statScalars["sumsquared"]->setTagName(KstObjectTag("SumSquared", tag()));
   _statScalars["minpos"]->setTagName(KstObjectTag("MinPos", tag()));
+
+  KST::scalarList.setUpdateDisplayTags(true);
 }
 
 
--- trunk/extragear/graphics/kst/src/libkst/kstvector.cpp #631420:631421
@@ -152,10 +152,12 @@
 KstVector::~KstVector() {
   //kstdDebug() << "+++ DELETING VECTOR: " << (void*) this << endl;
   KST::scalarList.lock().writeLock();
+  KST::scalarList.setUpdateDisplayTags(false);
   for (QDictIterator<KstScalar> it(_scalars); it.current(); ++it) {
     KST::scalarList.remove(it.current());
     it.current()->_KShared_unref();
   }
+  KST::scalarList.setUpdateDisplayTags(true);
   KST::scalarList.lock().unlock();
 
   if (_v) {
@@ -310,6 +312,10 @@
 void KstVector::CreateScalars() {
   if (!_isScalarList) {
     _min = _max = _mean = _minPos = 0.0;
+
+    KstWriteLocker sl(&KST::scalarList.lock());
+    KST::scalarList.setUpdateDisplayTags(false);
+
     KstScalarPtr sp;
     _scalars.insert("max", sp = new KstScalar(KstObjectTag("Max", tag()), this));
     sp->_KShared_ref();
@@ -333,11 +339,16 @@
     sp->_KShared_ref();
     _scalars.insert("minpos", sp = new KstScalar(KstObjectTag("MinPos", tag()), this));
     sp->_KShared_ref();
+
+    KST::scalarList.setUpdateDisplayTags(true);
   }
 }
 
 void KstVector::RenameScalars() {
   if (!_isScalarList) {
+    KstWriteLocker sl(&KST::scalarList.lock());
+    KST::scalarList.setUpdateDisplayTags(false);
+
     _scalars["max"]->setTagName(KstObjectTag("Max", tag()));
     _scalars["min"]->setTagName(KstObjectTag("Min", tag()));
     _scalars["last"]->setTagName(KstObjectTag("Last", tag()));
@@ -349,6 +360,8 @@
     _scalars["sum"]->setTagName(KstObjectTag("Sum", tag()));
     _scalars["sumsquared"]->setTagName(KstObjectTag("SumSquared", tag()));
     _scalars["minpos"]->setTagName(KstObjectTag("MinPos", tag()));
+
+    KST::scalarList.setUpdateDisplayTags(true);
   }
 }
 
@@ -592,6 +605,10 @@
 
 
 void KstVector::setTagName(const KstObjectTag& newTag) {
+  if (newTag == tag()) {
+    return;
+  }
+
   KstWriteLocker l(&KST::vectorList.lock());
 
   KST::vectorList.doRename(this, newTag);


More information about the Kst mailing list