[Kst] Flicker found

George Staikos staikos at kde.org
Fri Jul 16 20:58:53 CEST 2004


I found the reason for the flicker (or at least one reason).  Kst2DPlot 
revision 1.147 introduced it:

date: 2004/07/15 01:17:44;  author: arwalker;  state: Exp;  lines: +41 -51
This removes additional redraws that would happen every time a plot was 
printed
 or exported.
The technique now is to modify all the values of _geom more carefully, so that
before and after the print/export operation they are guarenteed to be the 
same,
 which gets rid of the need for a redraw.

The only problem encountered was with kst2dPlot::xInternalAlignment() which 
wou
ld reduce the size of the back-buffer every time a repaint is done. During 
prin
ting this would cause the buffer to shrink in size, and so not all of the plot
would be subsequently redrawn following the print. I addressed this by not 
call
ing xInternalAlignment() during a print or export operation.

--- kst2dplot.cpp       14 Jul 2004 22:59:32 -0000      1.146
+++ kst2dplot.cpp       15 Jul 2004 01:17:44 -0000      1.147
[...]
+    _oldXAlignment = KST::alignment.x(size());
+    _oldSize = sizeNew;
+
+    p.setClipping(false);
     _buffer.paintInto(p, geometry());
     updateTieBox(p);


   Putting  p.setClipping(false) in there explicitly disables all the clipping 
calculations that happen just before this function is called.  What is the 
reasoning for adding this?

   Also, what's the reasoning for adding the conjunction here?  Is there any 
way that it could ever paint properly if we force a draw during zoom pause?  
I don't think so because we purposely want to avoid drawing under all 
circumstances - our view and our variables are two different things in this 
situation.

-/* Draws to the buffer */
+void Kst2DPlot::draw(QPainter &p, double resolutionEnhancement, bool 
bForceDra
w) {
+  /* Draws to the buffer */

-  if (_zoomPaused) {
+  if (_zoomPaused && !bForceDraw) {
     return;
   }



Also, please don't remove commented out debug output like here:

@@ -901,7 +891,6 @@ void Kst2DPlot::resize(const QSize& size
 void Kst2DPlot::updateTieBox(QPainter& p) {
-//kdDebug() << "Update tie box for " << tagName() << endl;
   QRect tr = GetTieBoxRegion();
   p.setPen(foregroundColor());
   if (isTied()) {

I use these for profiling and doing performance work.  In particular I still 
need this one because we still get minor flicker in tie boxes.  It's not 
critical and it's actually better than it's ever been, but I do want to fix 
it one day.


-- 
George Staikos
KDE Developer			http://www.kde.org/
Staikos Computing Services Inc.	http://www.staikos.net/



More information about the Kst mailing list