summaryrefslogtreecommitdiffstats
path: root/src/widgets
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
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')
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp5
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp8
2 files changed, 8 insertions, 5 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 914c845565..d658f7fe0c 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -948,9 +948,8 @@ QVariant QFileSystemModel::headerData(int section, Qt::Orientation orientation,
if (section == 0) {
// ### TODO oh man this is ugly and doesn't even work all the way!
// it is still 2 pixels off
- QImage pixmap(16, 1, QImage::Format_Mono);
- pixmap.fill(0);
- pixmap.setAlphaChannel(pixmap.createAlphaMask());
+ QImage pixmap(16, 1, QImage::Format_ARGB32_Premultiplied);
+ pixmap.fill(Qt::transparent);
return pixmap;
}
break;
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);
}