summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qpixmap_s60.cpp12
-rw-r--r--src/gui/image/qpixmap_s60_p.h2
-rw-r--r--src/gui/image/qpixmap_x11.cpp5
-rw-r--r--src/gui/image/qpixmapfilter.cpp17
4 files changed, 25 insertions, 11 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 9d783dd..17baa50 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -349,7 +349,8 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
bitmapDevice(0),
bitmapGc(0),
pengine(0),
- bytes(0)
+ bytes(0),
+ formatLocked(false)
{
}
@@ -425,11 +426,12 @@ void QS60PixmapData::release()
}
/*!
- * Takes ownership of bitmap
+ * Takes ownership of bitmap. Used by window surface
*/
void QS60PixmapData::fromSymbianBitmap(CFbsBitmap* bitmap)
{
cfbsBitmap = bitmap;
+ formatLocked = true;
if(!initSymbianBitmapContext()) {
qWarning("Could not create CBitmapContext");
@@ -693,8 +695,10 @@ void QS60PixmapData::beginDataAccess()
bytes = newBytes;
TDisplayMode mode = cfbsBitmap->DisplayMode();
QImage::Format format = qt_TDisplayMode2Format(mode);
- //on S60 3.1, premultiplied alpha pixels are stored in a bitmap with 16MA type
- if (format == QImage::Format_ARGB32)
+ // On S60 3.1, premultiplied alpha pixels are stored in a bitmap with 16MA type.
+ // S60 window surface needs backing store pixmap for transparent window in ARGB32 format.
+ // In that case formatLocked is true.
+ if (!formatLocked && format == QImage::Format_ARGB32)
format = QImage::Format_ARGB32_Premultiplied; // pixel data is actually in premultiplied format
QVector<QRgb> savedColorTable;
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index b23961a..b1b5824 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -118,6 +118,8 @@ private:
QPaintEngine *pengine;
uchar* bytes;
+ bool formatLocked;
+
friend class QPixmap;
friend class QS60WindowSurface;
friend class QS60PaintEngine;
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 3f297df..7008fbd 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -416,6 +416,11 @@ void QX11PixmapData::fromImage(const QImage &img,
d = img.depth();
is_null = (w <= 0 || h <= 0);
+ if (is_null) {
+ w = h = 0;
+ return;
+ }
+
if (defaultScreen >= 0 && defaultScreen != xinfo.screen()) {
QX11InfoData* xd = xinfo.getX11Data(true);
xd->screen = defaultScreen;
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index c0b840a..3723500 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -1064,9 +1064,7 @@ void QPixmapDropShadowFilter::setOffset(const QPointF &offset)
QRectF QPixmapDropShadowFilter::boundingRectFor(const QRectF &rect) const
{
Q_D(const QPixmapDropShadowFilter);
- qreal delta = d->radius + 1;
- return rect.adjusted(-2, -2, 2, 2).united(
- rect.translated(d->offset).adjusted(-delta, -delta, delta, delta));
+ return rect.united(rect.translated(d->offset).adjusted(-d->radius, -d->radius, d->radius, d->radius));
}
/*!
@@ -1089,19 +1087,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);