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:
Ryan Cumming 2002-07-04 02:43:54 +00:00
parent a25d76c410
commit ffff5455b4

View file

@ -18,6 +18,7 @@
#include <qdrawutil.h>
#include <qdatetime.h>
#include <kpixmapeffect.h>
#include <kimageeffect.h>
#include <kdrawutil.h>
#include <klocale.h>
#include <qbitmap.h>
@ -591,8 +592,20 @@ void GalliumClient::paintEvent( QPaintEvent* )
KPixmap* titleBuffer = new KPixmap;
titleBuffer->resize(w-8, titleHeight);
KPixmapEffect::gradient(*titleBuffer, c1, c2,
KPixmapEffect::HorizontalGradient);
if (titleBuffer->depth() > 16)
{
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 );