[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Wed Oct 26 06:11:05 CEST 2005
SVN commit 474332 by staikos:
and..... a HUGE optimization in painting. Previously we were calling alignment
updates for every paint. Now we only call it when a content is dirty. This is
a lazy fix though, and internalAlignment is really still too messy/slow.
Previous to the commit: expose event could take as much as 2000ms.
After the commit: max event I could generate took 2ms.
That's 1000x improvement.
M +12 -2 ksttoplevelview.cpp
--- trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp #474331:474332
@@ -133,7 +133,17 @@
updateAlignment(type, p);
p.fillRect(geometry(), QBrush(KstSettings::globalSettings()->backgroundColor, SolidPattern));
} else {
- updateAlignment(type, p);
+ // FIXME: this is inefficient, but it's so much faster than the old code
+ // that it doesn't matter!! Eventually we should get this from the
+ // X11 triggered event in that case, since we already iterate.
+ // Also this might break if a draw happens before this is called,
+ // which was at least the case at one time in the past.
+ for (KstViewObjectList::ConstIterator i = _children.begin(); i != _children.end(); ++i) {
+ if ((*i)->dirty()) {
+ updateAlignment(type, p);
+ break;
+ }
+ }
}
#ifdef BENCHMARK
QTime t;
@@ -196,7 +206,7 @@
p.setClipping(false);
}
p.end();
-
+
// now, check what has the focus and repaint the focus rect, as all focus rects are now lost
if (_hoverFocus) {
QPainter p;
More information about the Kst
mailing list