Dither the titlebar graident on 15 and 16bpp displays. Thanks to gallium for the Qt::OrderedDither tip.
svn path=/trunk/kdebase/kwin/; revision=164671
This commit is contained in:
parent
a25d76c410
commit
ffff5455b4
1 changed files with 15 additions and 2 deletions
|
@ -18,6 +18,7 @@
|
||||||
#include <qdrawutil.h>
|
#include <qdrawutil.h>
|
||||||
#include <qdatetime.h>
|
#include <qdatetime.h>
|
||||||
#include <kpixmapeffect.h>
|
#include <kpixmapeffect.h>
|
||||||
|
#include <kimageeffect.h>
|
||||||
#include <kdrawutil.h>
|
#include <kdrawutil.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
#include <qbitmap.h>
|
#include <qbitmap.h>
|
||||||
|
@ -591,8 +592,20 @@ void GalliumClient::paintEvent( QPaintEvent* )
|
||||||
KPixmap* titleBuffer = new KPixmap;
|
KPixmap* titleBuffer = new KPixmap;
|
||||||
titleBuffer->resize(w-8, titleHeight);
|
titleBuffer->resize(w-8, titleHeight);
|
||||||
|
|
||||||
KPixmapEffect::gradient(*titleBuffer, c1, c2,
|
if (titleBuffer->depth() > 16)
|
||||||
KPixmapEffect::HorizontalGradient);
|
{
|
||||||
|
KPixmapEffect::gradient(*titleBuffer, c1, c2,
|
||||||
|
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, this );
|
QPainter p2( titleBuffer, this );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue