[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Thu Dec 8 00:30:11 CET 2005


SVN commit 486489 by staikos:

fix flicker when objects are nested in plots.  introduces an inefficiency to be
sorted out soon, or in 1.2.1 due to too much clip mask computation, and some
re-entrancy.


 M  +20 -3     kst2dplot.cpp  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #486488:486489
@@ -2189,6 +2189,7 @@
 
 
 void Kst2DPlot::paint(KstPainter& p, const QRegion& bounds) {
+  bool wasDirty = dirty();
   if (p.type() == KstPainter::P_EXPORT || p.type() == KstPainter::P_PRINT) {
     p.save();
 
@@ -2199,10 +2200,25 @@
       draw(p, 1.0);
     }
     p.restore();
+    KstPlotBase::paint(p, bounds);
   } else {
-    if (_zoomPaused && dirty()) {
+    if (_zoomPaused && wasDirty) {
       return;
     }
+
+    if (p.makingMask()) {
+      KstPlotBase::paint(p, bounds);
+    } else {
+      QRegion boundary = bounds & _lastClipRegion;
+      KstPlotBase::paint(p, boundary);
+      // FIXME: inefficient
+      for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
+        boundary -= (*i)->clipRegion();
+      }
+      boundary -= p.uiMask();
+      p.setClipRegion(boundary);
+    }
+
     // check for optimizations
     const QSize sizeNew(size());
     const QRect alignment(KST::alignment.limits(geometry()));
@@ -2210,7 +2226,7 @@
 
     updateDirtyFromLabels();
 
-    if (!dirty()) {
+    if (!wasDirty) {
       if (p.type() == KstPainter::P_PAINT) {
         if (_oldSize == sizeNew) {
           doDraw = false;
@@ -2241,6 +2257,7 @@
     drawCursorPos(p);
     updateTieBox(p);
 
+    // FIXME: active view may not be us!
     // we might need to redraw the datamode marker.
     KstTopLevelViewPtr tlv = KstApp::inst()->activeView();
     if (tlv) {
@@ -2262,8 +2279,8 @@
       updateXYGuideline(KstApp::inst()->activeView()->widget(), QPoint(-1, -1), KstApp::inst()->activeView()->widget()->mapFromGlobal(QCursor::pos()), GetPlotRegion(), gzType);
       _mouse.lastGuideline = KstApp::inst()->activeView()->widget()->mapFromGlobal(QCursor::pos());
     }
+    p.setClipping(false);
   }
-  KstPlotBase::paint(p, bounds);
 }
 
 


More information about the Kst mailing list