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

List:       kde-commits
Subject:    kdebase/kwin/clients/plastik
From:       Sandro Giessl <sandro () giessl ! com>
Date:       2005-03-12 9:34:45
Message-ID: 20050312093445.490BD17B90 () office ! kde ! org
[Download RAW message or body]

CVS commit by giessl: 

optimize the painting of title bar tiles a bit...


  M +12 -21    plastikclient.cpp   1.36


--- kdebase/kwin/clients/plastik/plastikclient.cpp  #1.35:1.36
@@ -338,7 +338,9 @@ void PlastikClient::paintEvent(QPaintEve
         painter.drawLine(r_x2-1, r_y+3, r_x2-1, titleEdgeTopBottom );
 
-        painter.drawTiledPixmap(r_x+2, r_y+2,
-                                r_w-2*2, titleEdgeTop-2,
-                                active ? *aTitleBarTopTile : *iTitleBarTopTile );
+        tempRect.setRect(r_x+2, r_y+2, r_w-2*2, titleEdgeTop-2 );
+        if (tempRect.isValid() && region.contains(tempRect) ) {
+            painter.drawTiledPixmap(tempRect, active ? *aTitleBarTopTile : *iTitleBarTopTile);
+        }
+
         // outside the region normally masked by doShape
         painter.setPen(filledCorner);
@@ -350,4 +352,6 @@ void PlastikClient::paintEvent(QPaintEve
 
     // leftTitleSpacer
+    int titleMarginLeft = 0;
+    int titleMarginRight = 0;
     if(titleEdgeLeft > 0)
     {
@@ -359,14 +363,7 @@ void PlastikClient::paintEvent(QPaintEve
                          r_x+1, Rtitle.bottom() );
 
-        painter.drawTiledPixmap(r_x+2, Rtitle.top(), titleEdgeLeft-2, Rtitle.height(),
-                active ? *aTitleBarTile : *iTitleBarTile );
+        titleMarginLeft = 2;
     }
 
-    // Space under the left button group
-    painter.drawTiledPixmap(titleEdgeLeftRight+1, Rtitle.top(),
-                            (Rtitle.left()-1)-titleEdgeLeftRight, Rtitle.height(),
-                            active ? *aTitleBarTile : *iTitleBarTile );
-
-
     // rightTitleSpacer
     if(titleEdgeRight > 0)
@@ -379,13 +376,7 @@ void PlastikClient::paintEvent(QPaintEve
                          r_x2-1, Rtitle.bottom() );
 
-        painter.drawTiledPixmap(titleEdgeRightLeft, Rtitle.top(), titleEdgeRight-2, Rtitle.height(),
-                active ? *aTitleBarTile : *iTitleBarTile );
+        titleMarginRight = 2;
     }
 
-    // Space under the right button group
-    painter.drawTiledPixmap(Rtitle.right()+1, Rtitle.top(),
-                            (titleEdgeRightLeft-1)-Rtitle.right(), Rtitle.height(),
-                            active ? *aTitleBarTile : *iTitleBarTile );
-
     // titleSpacer
     QPixmap *titleBfrPtr = active ? aCaptionBuffer : iCaptionBuffer;
@@ -399,6 +390,6 @@ void PlastikClient::paintEvent(QPaintEve
 
         // left to the title
-        tempRect.setRect(Rtitle.left(), m_captionRect.top(),
-                         m_captionRect.left() - Rtitle.left(), m_captionRect.height() );
+        tempRect.setRect(r_x+titleMarginLeft, m_captionRect.top(),
+                         m_captionRect.left() - (r_x+titleMarginLeft), m_captionRect.height() );
         if (tempRect.isValid() && region.contains(tempRect) ) {
             painter.drawTiledPixmap(tempRect, active ? *aTitleBarTile : *iTitleBarTile);
@@ -407,5 +398,5 @@ void PlastikClient::paintEvent(QPaintEve
         // right to the title
         tempRect.setRect(m_captionRect.right()+1, m_captionRect.top(),
-                         Rtitle.right() - m_captionRect.right(), m_captionRect.height() );
+                         (r_x2-titleMarginRight) - m_captionRect.right(), m_captionRect.height() );
         if (tempRect.isValid() && region.contains(tempRect) ) {
             painter.drawTiledPixmap(tempRect, active ? *aTitleBarTile : *iTitleBarTile);


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

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