From 96e70b86f873302e89c7d0afa7ed3b5a80ac14a6 Mon Sep 17 00:00:00 2001 From: Luciano Montanaro Date: Tue, 24 May 2005 13:54:37 +0000 Subject: [PATCH] Simplified drawB2Rect() svn path=/trunk/KDE/kdebase/kwin/; revision=417752 --- clients/b2/b2client.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/clients/b2/b2client.cpp b/clients/b2/b2client.cpp index c317dfc63f..aaa11aa6f5 100644 --- a/clients/b2/b2client.cpp +++ b/clients/b2/b2client.cpp @@ -146,24 +146,22 @@ static void drawB2Rect(KPixmap *pix, const QColor &primary, bool down) QColor hColor = primary.light(150); QColor lColor = primary.dark(150); + if (down) qSwap(hColor, lColor); + if (QPixmap::defaultDepth() > 8) { - if (down) - KPixmapEffect::gradient(*pix, lColor, hColor, - KPixmapEffect::DiagonalGradient); - else - KPixmapEffect::gradient(*pix, hColor, lColor, - KPixmapEffect::DiagonalGradient); + KPixmapEffect::gradient(*pix, hColor, lColor, + KPixmapEffect::DiagonalGradient); } else pix->fill(primary); int x2 = pix->width() - 1; int y2 = pix->height() - 1; - p.setPen(down ? hColor : lColor); + p.setPen(lColor); p.drawLine(0, 0, x2, 0); p.drawLine(0, 0, 0, y2); p.drawLine(1, x2 - 1, x2 - 1, y2 - 1); p.drawLine(x2 - 1, 1, x2 - 1, y2 - 1); - p.setPen(down ? lColor : hColor); + p.setPen(hColor); p.drawRect(1, 1, x2, y2); }