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

List:       kde-commits
Subject:    kdeartwork/styles/plastik
From:       Sandro Giessl <sandro () giessl ! com>
Date:       2004-09-11 15:58:25
Message-ID: 20040911155825.888CE24FD () office ! kde ! org
[Download RAW message or body]

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;
         }


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

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