Bug 76107 - Flicker in plastik and dotnet scrollbar
Summary: Flicker in plastik and dotnet scrollbar
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kstyle (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Sandro Giessl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-25 12:33 UTC by Allan Sandfeld
Modified: 2004-09-11 18:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Allan Sandfeld 2004-02-25 12:33:39 UTC
Version:            (using KDE KDE 3.2.0)
Installed from:    Compiled From Sources

When moving the slider up and down the scrollbar, there is noticeable flicker on the parts outside of the slider. This especially noticeable on homepages with scrollbar-colouring like osnews.com.

It happens in Plastik and .NET, but neither in Classic nor Keramik.
Comment 1 Chris Lee 2004-03-14 01:01:18 UTC
I can't reproduce this on my system. Can you go into a little more detail? Version of Qt, X server, video card? I'd like to know how to reproduce this as I haven't ever seen it, but several users have reported it.
Comment 2 Sandro Giessl 2004-03-14 01:46:32 UTC
> ------- Additional Comments From clee kde org  2004-03-14 01:01
> ------- I can't reproduce this on my system. Can you go into a little
> more detail? Version of Qt, X server, video card? I'd like to know
> how to reproduce this as I haven't ever seen it, but several users
> have reported it.

I finally managed to reproduce it with qt-copy, some recent 4.3 X server 
and nvidia binary drivers.
The problem is that in PE_ScrollBarAddPage/PE_ScrollBarSubPage we are 
painting some pixels two times; first with a solid background color and 
a few lines later with a light Dense4Pattern. This produces some 
flicker...
A simple pixmap buffer would do it, but in Plastik I'm probably going to 
replace the Dense4Pattern stuff with something better. Sometime.

Comment 3 Allan Sandfeld 2004-03-14 12:06:02 UTC
I have no problem reproducing the problem. I see it both on my home system:
KDE-HEAD
qt-copy-HEAD
Xfree 4.3 (and 4.4) with builtin 3dfx driver

And at the university with
KDE 3.2
Qt 3.2
And Sun's X-server (xwin) on Sunray terminals.
Comment 4 Sandro Giessl 2004-09-11 17:58:32 UTC
CVS commit by giessl: 

Draw PE_ScrollBarAddPage/PE_ScrollBarSubPage double buffered to avoid
flicker...

CCMAIL: 76107@bugs.kde.org


  M +27 -17    plastik.cpp   1.91


--- kdeartwork/styles/plastik/plastik.cpp  #1.90:1.91
@@ -1632,27 +1632,37 @@ void PlastikStyle::drawPrimitive(Primiti
         case PE_ScrollBarAddPage:
         case PE_ScrollBarSubPage: {
-            // TODO: imho this is somewhat strange... have a look at this later...
-            if (on || down) {
-                p->fillRect(r, QBrush(cg.mid().dark()));
+            // draw double buffered to avoid flicker...
+            QPixmap buffer;
+            if(flags & Style_Horizontal) {
+                buffer.resize(2, r.width() );
             } else {
-                p->save();
+                buffer.resize(r.height(), 2 );
+            }
+            QRect br(buffer.rect() );
+            QPainter bp(&buffer);
 
+            if (on || down) {
+                bp.fillRect(br, QBrush(cg.mid().dark()));
+            } else {
                 if(flags & Style_Horizontal) {
-                    p->setPen(cg.background().dark(106));
-                    p->drawLine(r.left(), r.top(), r.right(), r.top());
-                    p->setPen(cg.background().light(106));
-                    p->drawLine(r.left(), r.bottom(), r.right(), r.bottom());
-                    p->fillRect(r.left(), r.top()+1, r.width(), r.height()-2,cg.background());
+                    bp.setPen(cg.background().dark(106));
+                    bp.drawLine(br.left(), br.top(), br.right(), br.top());
+                    bp.setPen(cg.background().light(106));
+                    bp.drawLine(br.left(), br.bottom(), br.right(), br.bottom());
+                    bp.fillRect(br.left(), br.top()+1, br.width(), br.height()-2,cg.background());
                 } else {
-                    p->setPen(cg.background().dark(106));
-                    p->drawLine(r.left(), r.top(), r.left(), r.bottom());
-                    p->setPen(cg.background().light(106));
-                    p->drawLine(r.right(), r.top(), r.right(), r.bottom());
-                    p->fillRect(r.left()+1, r.top(), r.width()-2, r.height(),cg.background());
+                    bp.setPen(cg.background().dark(106));
+                    bp.drawLine(br.left(), br.top(), br.left(), br.bottom());
+                    bp.setPen(cg.background().light(106));
+                    bp.drawLine(br.right(), br.top(), br.right(), br.bottom());
+                    bp.fillRect(br.left()+1, br.top(), br.width()-2, br.height(),cg.background());
                 }
-
-                p->restore();
             }
-            p->fillRect(r, QBrush(cg.background().light(), Dense4Pattern));
+
+            bp.fillRect(br, QBrush(cg.background().light(), Dense4Pattern));
+
+            bp.end();
+
+            p->drawTiledPixmap(r, buffer);
             break;
         }


Comment 5 Sandro Giessl 2004-09-11 18:15:40 UTC
CVS commit by giessl: 

Same for dotNet: Draw PE_ScrollBarAddPage/PE_ScrollBarSubPage double buffered
to avoid flicker... 

CCMAIL: 76107-done@bugs.kde.org


  M +12 -3     dotnet.cpp   2.13


--- kdeartwork/styles/dotnet/dotnet.cpp  #2.12:2.13
@@ -471,10 +471,19 @@ void dotNETstyle::drawPrimitive(Primitiv
                 case PE_ScrollBarAddPage:
                 case PE_ScrollBarSubPage: {
+                        // draw double buffered to avoid flicker...
+                        QPixmap buffer(2,2);
+                        QRect br(buffer.rect() );
+                        QPainter bp(&buffer);
+ 
                         if (on || down) {
-                                p->fillRect(r, QBrush(cg.mid().dark()));
+                                bp.fillRect(br, QBrush(cg.mid().dark()));
                         } else {
-                                p->fillRect(r, QBrush(cg.background()));
+                                bp.fillRect(br, QBrush(cg.background()));
                         }
-                        p->fillRect(r, QBrush(cg.background().light(), Dense4Pattern));
+                        bp.fillRect(br, QBrush(cg.background().light(), Dense4Pattern));
+
+                        bp.end();
+                        p->drawTiledPixmap(r, buffer);
+
                         break;
                 }