[Kst] extragear/graphics/kst/kst
George Staikos
staikos at kde.org
Sat Oct 22 07:25:16 CEST 2005
SVN commit 472825 by staikos:
paint objects top->down instead of bottom->up to make sure we don't get inproper
geometries or artifacts. As a side effect, painting goes from O(n^2) to O(n)
which is nice.
BUG: 114788
M +4 -2 ksttoplevelview.cpp
M +8 -10 kstviewobject.cpp
--- trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp #472824:472825
@@ -180,10 +180,13 @@
void KstTopLevelView::paint(KstPaintType type, const QRegion& bounds) {
- QRegion boundary = bounds;
QPainter p;
p.begin(_w);
p.setViewXForm(true);
+ // Paint everything else first so that geometries are properly updated.
+ paint(type, p, bounds);
+
+ QRegion boundary = bounds;
for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
boundary -= (*i)->clipRegion();
}
@@ -191,7 +194,6 @@
p.setClipRegion(boundary);
p.fillRect(geometry(), QBrush(_backgroundColor));
p.setClipping(false);
- paint(type, p, bounds);
}
p.end();
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #472824:472825
@@ -309,29 +309,27 @@
}
}
- if (!maximized) {
- for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
+ if (!maximized && !_children.isEmpty()) {
+ QRegion clipRegion = oldRegion;
+ KstViewObjectList::Iterator begin = _children.begin();
+ for (KstViewObjectList::Iterator i = _children.fromLast();; --i) {
if (nullBounds || !bounds.intersect(QRegion((*i)->geometry())).isEmpty()) {
#ifdef BENCHMARK
QTime t;
t.start();
#endif
- QRegion clipRegion = oldRegion;
- KstViewObjectList::Iterator j = i;
- for (++j; j != _children.end(); ++j) {
- clipRegion -= (*j)->clipRegion();
- }
(*i)->_lastClipRegion = clipRegion;
p.setClipRegion(clipRegion);
(*i)->paint(type, p, bounds);
+ clipRegion -= (*i)->clipRegion();
#ifdef BENCHMARK
int x = t.elapsed();
kstdDebug() << " -> object " << (*i)->tagName() << " took " << x << "ms" << endl;
#endif
- if ((*i)->_maximized) {
- break;
- }
}
+ if (i == begin) {
+ break;
+ }
}
}
More information about the Kst
mailing list