From caaf77c971ea96b021bb6efe0bd1796ce8ebec6a Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 9 Nov 2009 14:52:45 +0100 Subject: Fixed dropshadow raster implementation since rewrite Reviewed-by: Samuel --- src/gui/image/qpixmapfilter.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index d83ef2c..de8f4e0 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -1089,19 +1089,24 @@ void QPixmapDropShadowFilter::draw(QPainter *p, return; } - QImage tmp = src.isNull() ? px.toImage() : px.copy(src.toAlignedRect()).toImage(); + QImage tmp(px.size(), QImage::Format_ARGB32_Premultiplied); + tmp.fill(0); + QPainter tmpPainter(&tmp); + tmpPainter.setCompositionMode(QPainter::CompositionMode_Source); + tmpPainter.drawPixmap(d->offset, px); + tmpPainter.end(); // blur the alpha channel tmp = blurred(tmp, tmp.rect(), qRound(d->radius), true); // blacken the image... - QPainter tmpPainter(&tmp); + tmpPainter.begin(&tmp); tmpPainter.setCompositionMode(QPainter::CompositionMode_SourceIn); - tmpPainter.fillRect(0, 0, tmp.width(), tmp.height(), d->color); + tmpPainter.fillRect(tmp.rect(), d->color); tmpPainter.end(); // draw the blurred drop shadow... - p->drawImage(pos + d->offset, tmp); + p->drawImage(pos, tmp); // Draw the actual pixmap... p->drawPixmap(pos, px, src); -- cgit v0.12