[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Thu Jun 17 18:15:49 CEST 2004


CVS commit by staikos: 

eliminate a good deal of flicker, especially in layout mode


  M +3 -0      ksttoplevelview.cpp   1.57
  M +18 -1     kstviewobject.cpp   1.63


--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.56:1.57
@@ -74,4 +74,7 @@ void KstTopLevelView::save(QTextStream& 
 
 void KstTopLevelView::paint(QPainter& p) {
+  QRegion clipRegion(geometry());
+  p.setClipping(true);
+  p.setClipRegion(clipRegion);
   KstViewObject::paint(p);
   // Anything to draw here?

--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.62:1.63
@@ -189,8 +189,22 @@ void KstViewObject::writeUnlock() const 
 void KstViewObject::paint(QPainter& p) {
   //kdDebug() << "painting " << tagName() << endl;
+  bool hadClipping = p.hasClipping();
+  QRegion oldRegion = p.clipRegion();
+  QRegion clipRegion;
+  p.setClipping(true);
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
+    // Compute the clip reg - this can't be stored if we want to keep the code
+    // generic, but it's slow, so it's a bit of a conundrum
+    clipRegion = oldRegion;
+    KstViewObjectList::Iterator j = i;
+    for (++j; j != _children.end(); ++j) {
+      clipRegion -= QRegion((*j)->geometry());
+    }
+    p.setClipRegion(clipRegion);
     (*i)->paint(p);
   }
 
+  p.setClipRegion(oldRegion);
+
   if (_focus) {
     drawFocusRect(p);
@@ -199,4 +214,6 @@ void KstViewObject::paint(QPainter& p) {
     drawSelectRect(p);
   }
+
+  p.setClipping(hadClipping);
 }
 





More information about the Kst mailing list