[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-cygwin
Subject:    RE: [PATCH] Flicker less drawing
From:       "Chris January" <chris () atomice ! net>
Date:       2004-12-16 20:57:40
Message-ID: 000001c4e3b1$e1e36830$0207a8c0 () avocado
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks.
 
I checked in some of your patch. I'm still checking removing the erase. I
don't think this is the right way to solve this - I think
QETWidget::translatePaintEvent is a better candidate. Also you'll notice
repaint is already called by translateConfigEvent further done. It would
appear the logic in the if statement needs correcting rather than adding an
extra repaint in further up.
 
Cheers,
Chris

Hi,
In file qwidget_win.cpp, in function
    void QWidget::repaint( int x, int y, int w, int h, bool erase )
lines 1547-1548
    QPaintEvent e( r, erase );
    if ( r != rect() )
        qt_set_paintevent_clipping( this, r );
 -> if ( erase )
 ->     this->erase( x, y, w, h );
    QApplication::sendEvent( this, &e );

If erasing is needed, it is done with erase(). I dont know where but it
seems to be done a second time in response to the QPaintEvent raised. So I
removed this 2 lines:
    if ( erase )
        this->erase( x, y, w, h );
and it removed the flickering I saw on the application I am testing. 
 
In file qapplication_win.cpp, lines 5653 & 5705, QWidget window class style
is:
 
wcx.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
 
I always hated CS_HREDRAW and CS_VREDRAW styles. They cause entire window
redrawing => background erasing + redrawing, which causes flickering. I
removed this 2 styles. But, if the window size grows, then painting is
needed.
So I modified
    QETWidget::translateConfigEvent
line 4831:
  if ( isVisible() ) {
        QResizeEvent e( newSize, oldSize );
        QApplication::sendSpontaneousEvent( this, &e );
  
  ->     this->repaint();
    } else {
        QResizeEvent * e = new QResizeEvent( newSize, oldSize );
        QApplication::postEvent( this, e );
    }                        

I added the repaint() call.
 
After that, there is less flickering. This is also true with the dirview
example. But more testing is needed.
There is something strange : if you resize the window backwards  / forwards
horizontally OR vertically, it doesn't flicker. It you resize both
horizontally and vertically (bottom right corner), it does. I think it is
because the 2 resize events are not merged, but 2 events = 2 repaint() are
received / called very shortly. I tried to batch the repaint() call with
InvalidateRect / postEvent(), but it does nothing. But it is the same
behaviour with Qt 2.3 NC. So, if the patch is approved, maybe the bug "[
1060157 ] Unnecessary flicker during repaint" could be considered corrected.
 
Here are the diff output from my local CVS copy:
-----------------------------------8<---------------------------------------
-------
diff -r1.1.2.30.2.23 qapplication_win.cpp
4831a4832,4833
> 
>                 this->repaint();
4835c4837
<             }
---
>             }                        
5653c5655
<     wcx.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
---
>     wcx.style = CS_DBLCLKS; // | CS_HREDRAW | CS_VREDRAW;
5705c5707
<     wcx.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
---
>     wcx.style = CS_DBLCLKS; // | CS_HREDRAW | CS_VREDRAW;
-----------------------------------8<---------------------------------------
-------
diff -r1.1.2.15.2.14 qwidget_win.cpp
1547,1548c1547,1548
<         if ( erase )
<             this->erase( x, y, w, h );
---
>         //if ( erase )
>         //    this->erase( x, y, w, h );
-----------------------------------8<---------------------------------------
-------
 
Regards.


Aurelien REGAT-BARREL 




  _____  

Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos
mails !
Créez
<http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/evt=25917/*htt
p://fr.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_250/default/*http
://fr.promotions.yahoo.com/mail/creer28.html> votre Yahoo! Mail

Avec Yahoo! faites un don et soutenez le Téléthon
<http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/mail_fr/events
/telethon2004/*http://www.telethon.fr/030-Don/10-10_Don.asp> !


[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2900.2523" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Tahoma size=2><SPAN 
class=343024220-16122004>Thanks.</SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN 
class=343024220-16122004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><SPAN class=343024220-16122004>I checked in some 
of your patch. I'm still checking removing the erase. I don't think this is the 
right way to solve this - I think QETWidget::translatePaintEvent is a better 
candidate. Also you'll notice repaint is already called by translateConfigEvent 
further done. It would appear the logic in the if statement needs correcting 
rather than adding an extra repaint in further up.</SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN 
class=343024220-16122004></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2><SPAN 
class=343024220-16122004>Cheers,</SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN 
class=343024220-16122004>Chris</SPAN></FONT></DIV>
<BLOCKQUOTE 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; \
MARGIN-RIGHT: 0px">  <DIV>Hi,</DIV>
  <DIV>In file qwidget_win.cpp,&nbsp;in function</DIV>
  <DIV>&nbsp;&nbsp;&nbsp; void QWidget::repaint( int x, int y, int w, int h, 
  bool erase )</DIV>
  <DIV>lines 1547-1548</DIV>
  <DIV>&nbsp;&nbsp;&nbsp; QPaintEvent e( r, erase );<BR>&nbsp;&nbsp;&nbsp; if ( 
  r != rect() )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  qt_set_paintevent_clipping( this, r );<BR>&nbsp;-&gt; if ( erase 
  )<BR>&nbsp;-&gt;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;erase( x, y, w, h 
  );<BR>&nbsp;&nbsp;&nbsp; QApplication::sendEvent( this, &amp;e );<BR></DIV>
  <DIV>If erasing is needed, it is done with erase(). I dont know where but it 
  seems to be done a second time in response to the QPaintEvent raised. So I 
  removed this 2 lines:</DIV>
  <DIV>&nbsp;&nbsp; &nbsp;if ( erase )<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; 
  this-&gt;erase( x, y, w, h );<BR>and it removed the flickering I saw on the 
  application I am testing. </DIV>
  <DIV>&nbsp;</DIV>
  <DIV>In file qapplication_win.cpp, lines 5653 &amp; 5705, QWidget window class 
  style is:</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
  <DIV>wcx.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
  <DIV>I always hated CS_HREDRAW and CS_VREDRAW styles. They cause entire window 
  redrawing =&gt; background erasing + redrawing, which causes flickering. I 
  removed this 2 styles. But, if the window size grows, then painting is 
  needed.</DIV>
  <DIV>So I modified</DIV>
  <DIV>&nbsp;&nbsp;&nbsp; QETWidget::translateConfigEvent</DIV>
  <DIV>line 4831:</DIV>
  <DIV>&nbsp; if ( isVisible() ) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  QResizeEvent e( newSize, oldSize 
  );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  QApplication::sendSpontaneousEvent( this, &amp;e );<BR>&nbsp; <BR>&nbsp; 
  -&gt;&nbsp;&nbsp;&nbsp;&nbsp; this-&gt;repaint();<BR>&nbsp;&nbsp;&nbsp; } else 
  {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QResizeEvent * e = new 
  QResizeEvent( newSize, oldSize 
  );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QApplication::postEvent( 
  this, e );<BR>&nbsp;&nbsp;&nbsp; 
  }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  <BR></DIV>
  <DIV>I added the repaint() call.</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
  <DIV>After that, there is less flickering. This is also true with the dirview 
  example. But more testing is needed.</DIV>
  <DIV>There is something strange : if you resize the window backwards&nbsp; / 
  forwards horizontally OR vertically, it doesn't flicker. It you resize both 
  horizontally and vertically (bottom right corner), it does. I think it is 
  because the 2 resize events are not merged, but 2 events = 2 repaint() are 
  received / called very shortly. I tried to batch the repaint() call with 
  InvalidateRect / postEvent(), but it does nothing. But it is the same 
  behaviour with Qt 2.3 NC. So, if the patch is approved, maybe the bug "[ 
  1060157 ] Unnecessary flicker during repaint" could be considered 
  corrected.</DIV>
  <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
  <DIV>Here&nbsp;are the diff output from my local CVS copy:</DIV>
  <DIV>-----------------------------------8&lt;----------------------------------------------</DIV>
  <DIV>diff -r1.1.2.30.2.23 qapplication_win.cpp<BR>4831a4832,4833<BR>&gt; 
  <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  this-&gt;repaint();<BR>4835c4837<BR>&lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  }<BR>---<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  <BR>5653c5655<BR>&lt;&nbsp;&nbsp;&nbsp;&nbsp; wcx.style = CS_DBLCLKS | 
  CS_HREDRAW | CS_VREDRAW;<BR>---<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; wcx.style = 
  CS_DBLCLKS; // | CS_HREDRAW | 
  CS_VREDRAW;<BR>5705c5707<BR>&lt;&nbsp;&nbsp;&nbsp;&nbsp; wcx.style = 
  CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;<BR>---<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; 
  wcx.style = CS_DBLCLKS; // | CS_HREDRAW | CS_VREDRAW;</DIV>
  <DIV>-----------------------------------8&lt;----------------------------------------------</DIV>
  <DIV>diff -r1.1.2.15.2.14 
  qwidget_win.cpp<BR>1547,1548c1547,1548<BR>&lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  if ( erase 
  )<BR>&lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  this-&gt;erase( x, y, w, h 
  );<BR>---<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //if ( erase 
  )<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp;&nbsp;&nbsp; 
  this-&gt;erase( x, y, w, h );</DIV>
  <DIV>-----------------------------------8&lt;----------------------------------------------</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>Regards.</DIV><BR><BR>
  <DIV>
  <DIV>
  <DIV>Aurelien REGAT-BARREL <BR></DIV></DIV></DIV>
  <P>
  <HR SIZE=1>
  Découvrez le nouveau Yahoo! Mail : <FONT color=red>250 Mo d'espace</FONT> de 
  stockage pour vos mails !<BR><A 
  href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/evt=25917/*http:/ \
/fr.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_250/default/*http://fr.promotions.yahoo.com/mail/creer28.html">Créez \
  votre Yahoo! Mail</A><BR><BR>Avec Yahoo! faites un don et soutenez le <A 
  href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/mail_fr/events/telethon2004/*http://www.telethon.fr/030-Don/10-10_Don.asp">Téléthon \
                
  !</A></BLOCKQUOTE></BODY></HTML>



_______________________________________________
kde-cygwin mailing list
kde-cygwin@kde.org
https://mail.kde.org/mailman/listinfo/kde-cygwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic