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

List:       kde-commits
Subject:    KDE/kdebase/workspace/kwin/clients
From:       Matthew Woehlke <mw_triad () users ! sourceforge ! net>
Date:       2007-08-28 0:37:28
Message-ID: 1188261448.997608.3760.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 705465 by mwoehlke:

Don't use kdrawutils.


 M  +24 -8     kde2/kde2.cpp  
 M  +22 -8     quartz/quartz.cpp  


--- trunk/KDE/kdebase/workspace/kwin/clients/kde2/kde2.cpp #705464:705465
@@ -8,6 +8,9 @@
  *
  *	Draws mini titlebars for tool windows.
  *	Many features are now customizable.
+ *
+ *	drawColorBitmaps orignally from kdefx:
+ *	  Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>
  */
 
 #include "kde2.h"
@@ -116,6 +119,23 @@
   0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xc0, 0x3f, 0xc0, 0x31, 0xc0, 0x20,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
+void drawColorBitmaps(QPainter *p, const QPalette &pal, int x, int y, int w, int h,
+                      const uchar *lightColor, const uchar *midColor, const uchar *blackColor)
+{
+    const uchar *data[]={lightColor, midColor, blackColor};
+
+    QColor colors[]={pal.color(QPalette::Light), pal.color(QPalette::Mid), Qt::black};
+
+    int i;
+    QSize s(w,h);
+    for(i=0; i < 3; ++i){
+		QBitmap b = QBitmap::fromData(s, data[i], QImage::Format_MonoLSB );
+		b.setMask(b);
+		p->setPen(colors[i]);
+		p->drawPixmap(x, y, b);
+    }
+}
+
 // ===========================================================================
 
 static QPixmap* titlePix;
@@ -331,15 +351,13 @@
 	g = options()->palette( ColorButtonBg, true );
 	pinUpPix  = new QPixmap(16, 16);
 	p.begin( pinUpPix );
-	kColorBitmaps( &p, g, 0, 0, 16, 16, true, pinup_white_bits,
-		pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL );
+    drawColorBitmaps( &p, g, 0, 0, 16, 16, pinup_white_bits, pinup_gray_bits, pinup_dgray_bits );
 	p.end();
 	pinUpPix->setMask( QBitmap::fromData(QSize( 16, 16 ), pinup_mask_bits) );
 
 	pinDownPix = new QPixmap(16, 16);
 	p.begin( pinDownPix );
-	kColorBitmaps( &p, g, 0, 0, 16, 16, true, pindown_white_bits,
-		pindown_gray_bits, NULL, NULL, pindown_dgray_bits, NULL );
+    drawColorBitmaps( &p, g, 0, 0, 16, 16, pindown_white_bits, pindown_gray_bits, pindown_dgray_bits );
 	p.end();
 	pinDownPix->setMask( QBitmap::fromData(QSize( 16, 16 ), pindown_mask_bits) );
 
@@ -347,15 +365,13 @@
 	g = options()->palette( ColorButtonBg, false );
 	ipinUpPix = new QPixmap(16, 16);
 	p.begin( ipinUpPix );
-	kColorBitmaps( &p, g, 0, 0, 16, 16, true, pinup_white_bits,
-		pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL );
+    drawColorBitmaps( &p, g, 0, 0, 16, 16, pinup_white_bits, pinup_gray_bits, pinup_dgray_bits );
 	p.end();
 	ipinUpPix->setMask( QBitmap::fromData(QSize( 16, 16 ), pinup_mask_bits) );
 
 	ipinDownPix = new QPixmap(16, 16);
 	p.begin( ipinDownPix );
-	kColorBitmaps( &p, g, 0, 0, 16, 16, true, pindown_white_bits,
-		pindown_gray_bits, NULL, NULL, pindown_dgray_bits, NULL );
+    drawColorBitmaps( &p, g, 0, 0, 16, 16, pindown_white_bits, pindown_gray_bits, pindown_dgray_bits );
 	p.end();
 	ipinDownPix->setMask( QBitmap::fromData(QSize( 16, 16 ), pindown_mask_bits) );
 
--- trunk/KDE/kdebase/workspace/kwin/clients/quartz/quartz.cpp #705464:705465
@@ -12,6 +12,8 @@
  * Includes mini titlebars for ToolWindow Support.
  * Button positions are now customizable.
  *
+ *	drawColorBitmaps orignally from kdefx:
+ *	  Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>
  */
 
 #include <kconfig.h>
@@ -105,7 +107,23 @@
   0x00, 0x00, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
+void drawColorBitmaps(QPainter *p, const QPalette &pal, int x, int y, int w, int h,
+                      const uchar *lightColor, const uchar *midColor, const uchar *blackColor)
+{
+    const uchar *data[]={lightColor, midColor, blackColor};
 
+    QColor colors[]={pal.color(QPalette::Light), pal.color(QPalette::Mid), Qt::black};
+
+    int i;
+    QSize s(w,h);
+    for(i=0; i < 3; ++i){
+		QBitmap b = QBitmap::fromData(s, data[i], QImage::Format_MonoLSB );
+		b.setMask(b);
+		p->setPen(colors[i]);
+		p->drawPixmap(x, y, b);
+    }
+}
+
 ///////////////////////////////////////////////////////////////////////////
 
 // Titlebar button positions
@@ -323,15 +341,13 @@
 	pinUpPix = new QPixmap(16, 16);
 	p.begin( pinUpPix );
 	p.fillRect( 0, 0, 16, 16, c);
-	kColorBitmaps( &p, g2, 0, 1, 16, 16, true, pinup_white_bits,
-					pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL );
+    drawColorBitmaps( &p, g2, 0, 1, 16, 16, pinup_white_bits, pinup_gray_bits, pinup_dgray_bits );
 	p.end();
 
 	pinDownPix = new QPixmap(16, 16);
 	p.begin( pinDownPix );
 	p.fillRect( 0, 0, 16, 16, c);
-	kColorBitmaps( &p, g2, 0, 1, 16, 16, true, pindown_white_bits,
-					pindown_gray_bits, NULL, NULL, pindown_dgray_bits, NULL );
+    drawColorBitmaps( &p, g2, 0, 1, 16, 16, pindown_white_bits, pindown_gray_bits, pindown_dgray_bits );
 	p.end();
 
 
@@ -345,15 +361,13 @@
 	ipinUpPix = new QPixmap(16, 16);
 	p.begin( ipinUpPix );
 	p.fillRect( 0, 0, 16, 16, c);
-	kColorBitmaps( &p, g2, 0, 1, 16, 16, true, pinup_white_bits,
-					pinup_gray_bits, NULL, NULL, pinup_dgray_bits, NULL );
+    drawColorBitmaps( &p, g2, 0, 1, 16, 16, pinup_white_bits, pinup_gray_bits, pinup_dgray_bits );
 	p.end();
 
 	ipinDownPix = new QPixmap(16, 16);
 	p.begin( ipinDownPix );
 	p.fillRect( 0, 0, 16, 16, c);
-	kColorBitmaps( &p, g2, 0, 1, 16, 16, true, pindown_white_bits,
-					pindown_gray_bits, NULL, NULL, pindown_dgray_bits, NULL );
+    drawColorBitmaps( &p, g2, 0, 1, 16, 16, pindown_white_bits, pindown_gray_bits, pindown_dgray_bits );
 	p.end();
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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