summaryrefslogtreecommitdiffstats
path: root/src/widgets/effects
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-18 11:25:44 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-12-19 21:24:39 +0100
commit23d4c0c34b37d9d6d94fedd2fc7316c34a66f10d (patch)
tree57c9c0f0e86a3cad046f6f9c2aea768f3c4d1142 /src/widgets/effects
parent9d6b4d11424cdcd6c572cdcc50b3b790b6e673c0 (diff)
Remove some uses of QImage::setAlphaChannel
Remove once where it did nothing, and once where using composition mode masking avoids first creating a masking image. Change-Id: Ia4c93eac6ebb11fcdab34d306d943a7f87906b7e Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/widgets/effects')
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 637c9c6aba..1f899c2660 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -1135,8 +1135,12 @@ void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const Q
destImage = std::move(buffer);
}
- if (srcImage.hasAlphaChannel())
- destImage.setAlphaChannel(srcImage.alphaChannel());
+ if (srcImage.hasAlphaChannel()) {
+ Q_ASSERT(destImage.format() == QImage::Format_ARGB32_Premultiplied);
+ QPainter maskPainter(&destImage);
+ maskPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
+ maskPainter.drawImage(0, 0, srcImage);
+ }
painter->drawImage(dest, destImage);
}