[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Sat Oct 22 08:13:51 CEST 2005
SVN commit 472916 by staikos:
optimize away some calls
M +27 -10 kstdoc.cpp
--- trunk/extragear/graphics/kst/kst/kstdoc.cpp #472915:472916
@@ -759,6 +759,7 @@
}
void KstDoc::samplesUp() {
+ bool changed = false;
KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);
for (int i = 0; i < (int)rvl.count(); i++) {
KstRVectorPtr V = rvl[i];
@@ -770,23 +771,32 @@
bool doAve = V->doAve();
int fileN = V->fileLength();
+ bool didChange = false;
if (f0 + 2 * n > fileN) {
+ didChange = f0 != fileN - n;
+ changed = changed || didChange;
f0 = fileN - n;
} else {
+ didChange = true;
f0 += n;
}
- V->changeFrames(f0, n, skip, doSkip, doAve);
+
+ if (didChange) {
+ V->changeFrames(f0, n, skip, doSkip, doAve);
+ }
V->writeUnlock();
}
- setModified();
- forceUpdate();
-
- emit dataChanged();
+ if (changed) {
+ setModified();
+ forceUpdate();
+ emit dataChanged();
+ }
}
void KstDoc::samplesDown() {
+ bool changed = false;
KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);
for (int i = 0; i < (int)rvl.count(); i++) {
KstRVectorPtr V = rvl[i];
@@ -800,20 +810,27 @@
bool doSkip = V->doSkip();
bool doAve = V->doAve();
+ bool didChange = false;
if (f0 - n < 0) {
+ didChange = f0 != 0;
+ changed = changed || didChange;
f0 = 0;
} else {
+ didChange = true;
f0 -= n;
}
- V->changeFrames(f0, n, skip, doSkip, doAve);
+ if (didChange) {
+ V->changeFrames(f0, n, skip, doSkip, doAve);
+ }
V->writeUnlock();
}
- setModified();
- forceUpdate();
-
- emit dataChanged();
+ if (changed) {
+ setModified();
+ forceUpdate();
+ emit dataChanged();
+ }
}
More information about the Kst
mailing list