summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/painting/qpainter.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index c923b3b22a..4ff334a6d6 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -112,11 +112,14 @@ extern bool qHasPixmapTexture(const QBrush &);
static inline bool is_brush_transparent(const QBrush &brush) {
Qt::BrushStyle s = brush.style();
- bool brushBitmap = qHasPixmapTexture(brush)
- ? brush.texture().isQBitmap()
- : (brush.textureImage().depth() == 1);
- return ((s >= Qt::Dense1Pattern && s <= Qt::DiagCrossPattern)
- || (s == Qt::TexturePattern && brushBitmap));
+ if (s != Qt::TexturePattern)
+ return s >= Qt::Dense1Pattern && s <= Qt::DiagCrossPattern;
+ if (qHasPixmapTexture(brush))
+ return brush.texture().isQBitmap() || brush.texture().hasAlphaChannel();
+ else {
+ const QImage texture = brush.textureImage();
+ return texture.hasAlphaChannel() || (texture.depth() == 1 && texture.colorCount() == 0);
+ }
}
static inline bool is_pen_transparent(const QPen &pen) {