minor titlebar edge cleanup

remove the ShadowEngine... it is just too slow and even makes e.g. kmail feel
slower when dragging messages over the folder list. have a bogus shadow
instead (various drawText calls with blended colors) which also looks quite nice and
is twice as fast. Still no kwin decoration seems to feel as fast as metacity when it
comes to caption changes such as in the kmail example... This is something that should
be looked into IMHO.

svn path=/trunk/kdebase/kwin/; revision=398994
This commit is contained in:
Sandro Giessl 2005-03-19 16:01:36 +00:00
parent c77a4202fb
commit 50a21c6be9

View file

@ -38,7 +38,6 @@
#include "plastikclient.h" #include "plastikclient.h"
#include "plastikbutton.h" #include "plastikbutton.h"
#include "misc.h" #include "misc.h"
#include "shadow.h"
namespace KWinPlastik namespace KWinPlastik
{ {
@ -328,20 +327,12 @@ void PlastikClient::paintEvent(QPaintEvent *e)
if(titleEdgeTop > 0) if(titleEdgeTop > 0)
{ {
painter.setPen(highlightTop ); painter.setPen(highlightTop );
painter.drawLine(r_x+3, r_y+1, r_x2-3, r_y+1 ); painter.drawLine(r_x+2, r_y+1, r_x2-2, r_y+1 );
// a bit anti-aliasing for the window contour...
painter.setPen(alphaBlendColors(highlightTop, windowContour, 150) );
painter.drawPoint(r_x+2, r_y+1);
painter.drawPoint(r_x2-2, r_y+1);
painter.setPen(alphaBlendColors(highlightTitleLeft, windowContour, 150) );
painter.drawPoint(r_x+1, r_y+2);
painter.setPen(alphaBlendColors(highlightTitleRight, windowContour, 150) );
painter.drawPoint(r_x2-1, r_y+2);
// highlight... // highlight...
painter.setPen(highlightTitleLeft); painter.setPen(highlightTitleLeft);
painter.drawLine(r_x+1, r_y+3, r_x+1, titleEdgeTopBottom ); painter.drawLine(r_x+1, r_y+2, r_x+1, titleEdgeTopBottom );
painter.setPen(highlightTitleRight); painter.setPen(highlightTitleRight);
painter.drawLine(r_x2-1, r_y+3, r_x2-1, titleEdgeTopBottom ); painter.drawLine(r_x2-1, r_y+2, r_x2-1, titleEdgeTopBottom );
tempRect.setRect(r_x+2, r_y+2, r_w-2*2, titleEdgeTop-2 ); tempRect.setRect(r_x+2, r_y+2, r_w-2*2, titleEdgeTop-2 );
if (tempRect.isValid() && region.contains(tempRect) ) { if (tempRect.isValid() && region.contains(tempRect) ) {
@ -612,23 +603,15 @@ const QPixmap &PlastikClient::captionPixmap() const
QPainter painter; QPainter painter;
const int thickness = 2; const int thickness = 2;
QPixmap textPixmap(captionWidth+2*thickness, captionHeight+2*thickness);
if(Handler()->titleShadow()) {
textPixmap.fill(QColor(0,0,0) );
painter.begin(&textPixmap);
painter.setFont(s_titleFont);
painter.setPen(Qt::white);
painter.drawText(textPixmap.rect(), AlignCenter, c );
painter.end();
}
QPixmap *captionPixmap = new QPixmap(captionWidth+2*thickness, th); QPixmap *captionPixmap = new QPixmap(captionWidth+2*thickness, th);
painter.begin(captionPixmap); painter.begin(captionPixmap);
painter.drawTiledPixmap(captionPixmap->rect(), painter.drawTiledPixmap(captionPixmap->rect(),
Handler()->pixmap(TitleBarTile, active, isToolWindow()) ); Handler()->pixmap(TitleBarTile, active, isToolWindow()) );
painter.setFont(s_titleFont);
QPoint tp(1, captionHeight-1);
if(Handler()->titleShadow()) if(Handler()->titleShadow())
{ {
QColor shadowColor; QColor shadowColor;
@ -636,11 +619,16 @@ const QPixmap &PlastikClient::captionPixmap() const
shadowColor = QColor(255, 255, 255); shadowColor = QColor(255, 255, 255);
else else
shadowColor = QColor(0,0,0); shadowColor = QColor(0,0,0);
paintShadow(&painter, textPixmap, 0,1, thickness, shadowColor);
painter.setPen(alphaBlendColors(options()->color(ColorTitleBar, active), shadowColor, 205) );
painter.drawText(tp+QPoint(1,2), c);
painter.setPen(alphaBlendColors(options()->color(ColorTitleBar, active), shadowColor, 225) );
painter.drawText(tp+QPoint(2,2), c);
painter.setPen(alphaBlendColors(options()->color(ColorTitleBar, active), shadowColor, 165) );
painter.drawText(tp+QPoint(1,1), c);
} }
painter.setFont(s_titleFont);
painter.setPen(Handler()->getColor(TitleFont,active) ); painter.setPen(Handler()->getColor(TitleFont,active) );
painter.drawText(captionPixmap->rect(), AlignCenter, c ); painter.drawText(tp, c );
painter.end(); painter.end();
m_captionPixmaps[active] = captionPixmap; m_captionPixmaps[active] = captionPixmap;