Removed KPixmapEffect refreences. Fixed rendering glitches.

svn path=/trunk/KDE/kdebase/workspace/; revision=718496
This commit is contained in:
Luciano Montanaro 2007-09-28 20:47:39 +00:00
parent 0f80762214
commit 04fd66ec60
2 changed files with 24 additions and 31 deletions

View file

@ -6,7 +6,7 @@ set(kwin3_redmond_PART_SRCS redmond.cpp)
kde4_add_plugin(kwin3_redmond ${kwin3_redmond_PART_SRCS}) kde4_add_plugin(kwin3_redmond ${kwin3_redmond_PART_SRCS})
target_link_libraries(kwin3_redmond ${KDE4_KDEFX_LIBS} kdecorations) target_link_libraries(kwin3_redmond kdecorations)
install(TARGETS kwin3_redmond DESTINATION ${PLUGIN_INSTALL_DIR}) install(TARGETS kwin3_redmond DESTINATION ${PLUGIN_INSTALL_DIR})

View file

@ -19,8 +19,6 @@
//Added by qt3to4: //Added by qt3to4:
#include <QPixmap> #include <QPixmap>
#include <QPaintEvent> #include <QPaintEvent>
#include <kpixmapeffect.h>
#include <kimageeffect.h>
#include <klocale.h> #include <klocale.h>
#include <QBitmap> #include <QBitmap>
@ -131,6 +129,18 @@ static void drawButtonFrame( QPixmap *pix, const QPalette &g, bool sunken )
p.drawLine(x2, 0, x2, y2); p.drawLine(x2, 0, x2, y2);
} }
static void gradientFill(QPixmap *pixmap,
const QColor &color1, const QColor &color2, bool horizontal = false)
{
QPainter p(pixmap);
QLinearGradient gradient(0, 0,
horizontal ? pixmap->width() : 0,
horizontal ? 0 : pixmap->height());
gradient.setColorAt(0.0, color1);
gradient.setColorAt(1.0, color2);
QBrush brush(gradient);
p.fillRect(pixmap->rect(), brush);
}
static void create_pixmaps () static void create_pixmaps ()
{ {
@ -165,27 +175,18 @@ static void create_pixmaps ()
*iMiniBtnDownPix1 = QPixmap(toolTitleHeight, toolTitleHeight); *iMiniBtnDownPix1 = QPixmap(toolTitleHeight, toolTitleHeight);
if (highcolor && false) { if (highcolor && false) {
KPixmapEffect::gradient(*btnPix1, c.light(130), c.dark(130), gradientFill(btnPix1, c.light(130), c.dark(130));
KPixmapEffect::VerticalGradient); gradientFill(btnDownPix1, c.dark(130), c.light(130));
KPixmapEffect::gradient(*btnDownPix1, c.dark(130), c.light(130), gradientFill(miniBtnPix1, c.light(130), c.dark(130));
KPixmapEffect::VerticalGradient); gradientFill(miniBtnDownPix1, c.dark(130), c.light(130));
KPixmapEffect::gradient(*miniBtnPix1, c.light(130), c.dark(130),
KPixmapEffect::VerticalGradient);
KPixmapEffect::gradient(*miniBtnDownPix1, c.dark(130), c.light(130),
KPixmapEffect::VerticalGradient);
g = options()->palette(KDecoration::ColorButtonBg, false); g = options()->palette(KDecoration::ColorButtonBg, false);
g.setCurrentColorGroup( QPalette::Active ); g.setCurrentColorGroup( QPalette::Active );
c = g.background(); c = g.background();
KPixmapEffect::gradient(*iBtnPix1, c.light(130), c.dark(130), gradientFill(iBtnPix1, c.light(130), c.dark(130));
KPixmapEffect::VerticalGradient); gradientFill(iBtnDownPix1, c.dark(130), c.light(130));
KPixmapEffect::gradient(*iBtnDownPix1, c.dark(130), c.light(130), gradientFill(iMiniBtnPix1, c.light(130), c.dark(130));
KPixmapEffect::VerticalGradient); gradientFill(iMiniBtnDownPix1, c.dark(130), c.light(130));
KPixmapEffect::gradient(*iMiniBtnPix1, c.light(130), c.dark(130),
KPixmapEffect::VerticalGradient);
KPixmapEffect::gradient(*iMiniBtnDownPix1, c.dark(130), c.light(130),
KPixmapEffect::VerticalGradient);
} else { } else {
btnPix1->fill(c.rgb()); btnPix1->fill(c.rgb());
btnDownPix1->fill(c.rgb()); btnDownPix1->fill(c.rgb());
@ -509,7 +510,7 @@ void RedmondDeco::paintEvent( QPaintEvent* )
// Fill out the border edges // Fill out the border edges
for (int i = 1; i < borderWidth; i++) for (int i = 1; i < borderWidth; i++)
p.drawRect( x+i, y+i, w-2*i, h-2*i ); p.drawRect( x+i, y+i, x2-2*i, y2-2*i );
// Draw highlights and lowlights // Draw highlights and lowlights
p.setPen(g.color( QPalette::Light )); p.setPen(g.color( QPalette::Light ));
@ -554,15 +555,7 @@ void RedmondDeco::paintEvent( QPaintEvent* )
*titleBuffer = QPixmap(w-2*modBorderWidth, titleHeight); *titleBuffer = QPixmap(w-2*modBorderWidth, titleHeight);
if (titleBuffer->depth() > 16) { if (titleBuffer->depth() > 16) {
KPixmapEffect::gradient(*titleBuffer, c1, c2, gradientFill(titleBuffer, c1, c2, true);
KPixmapEffect::HorizontalGradient);
} else {
// This enables dithering on 15 and 16bit displays, preventing
// some pretty horrible banding effects
QImage image = KImageEffect::gradient(titleBuffer->size(), c1, c2,
KImageEffect::HorizontalGradient);
titleBuffer->convertFromImage(image, Qt::OrderedDither);
} }
QPainter p2( titleBuffer ); QPainter p2( titleBuffer );
@ -697,5 +690,5 @@ extern "C" KDE_EXPORT KDecorationFactory *create_factory()
#include "redmond.moc" #include "redmond.moc"
// vim: ts=4 // vim: ts=4 sw=4
// kate: space-indent off; tab-width 4; // kate: space-indent off; tab-width 4;