[Kst] extragear/graphics/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Mon Sep 19 11:36:03 CEST 2005


SVN commit 461932 by netterfield:

remove another render on resize in viewlabels by using the back-buffer to generate
the transparency mask.



 M  +1 -1      kst2dplot.cpp  
 M  +7 -20     kstviewlabel.cpp  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #461931:461932
@@ -2283,7 +2283,7 @@
     if (_zoomPaused) {
       return;
     }
-    kdDebug() << type << "paint 2dplot\n";
+    //kdDebug() << type << "paint 2dplot\n";
     // check for optimizations
     QSize sizeNew = size();
     QRect alignment = KST::alignment.limits(geometry());
--- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #461931:461932
@@ -293,7 +293,7 @@
 
 
 void KstViewLabel::paint(KstPaintType type, QPainter& p) {
-  //kdDebug() << type << "paint viewlabel\n";
+  kdDebug() << type << ": paint viewlabel\n";
   if (type == P_PRINT) {
     p.save();
     if (_autoResize) {
@@ -313,7 +313,6 @@
         adjustSizeForText(p.window()); // calls computeTextSize and drawToBuffer
       } else {
         computeTextSize(_parsed);
-        kdDebug() << "in paint/no autoResize\n";
         drawToBuffer(_parsed);
       }
     }
@@ -337,24 +336,12 @@
   }
 
   if (_clipMask.isNull()) {
-    QPixmap pm(geometry().bottomRight().x(), geometry().bottomRight().y());
-    if (!pm.isNull()) {
-      if (dirty()) {
-        //computeTextSize(_parsed); // hmm this is inefficient?
-      }
-      pm.fill();
-      QPainter p(&pm);
-      //p.setRasterOp(Qt::SetROP);
-      p.setClipRect(geometry());
-      p.translate(position().x(), position().y());
-      drawToPainter(_parsed, p);
-      p.flush();
-      QBitmap bm;
-      bm = pm.createHeuristicMask(false); // slow but preserves antialiasing...
-      _clipMask = QRegion(bm);
-    } else {
-      _clipMask = QRegion();
-    }
+    kdDebug() << "--- setting clipmask\n";
+    QBitmap bm = _backBuffer.buffer().createHeuristicMask(false); // slow but preserves antialiasing...
+    _clipMask = QRegion(bm);
+    _clipMask.translate(geometry().topLeft().x(), geometry().topLeft().y());
+  } else {
+    kdDebug() << "--- not setting clipmask\n";
   }
 
   return _clipMask;


More information about the Kst mailing list