aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-06 18:12:53 +0100
committerLiang Qi <liang.qi@qt.io>2017-11-06 18:12:53 +0100
commit853b4b08d54f70d04d371d707e50760ffecf2f77 (patch)
tree2220ac8be8ae9bb5b25cf560eec3dc973c09b8e8 /src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp
parent047bdf90db4d00d0462b9faf2044070be4a0e682 (diff)
parent87999238141588987b3cef6cd68ff62a7e3e8daa (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10v5.10.0-beta4
Diffstat (limited to 'src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp')
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp
index ad6cf39425..186fd92fb7 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp
@@ -82,13 +82,6 @@ void QSGSoftwarePixmapRenderer::render(QPaintDevice *target)
setBackgroundSize(QSize(target->width(), target->height()));
setBackgroundColor(clearColor());
- QPainter painter(target);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.setWindow(m_projectionRect);
- auto rc = static_cast<QSGSoftwareRenderContext *>(context());
- QPainter *prevPainter = rc->m_activePainter;
- rc->m_activePainter = &painter;
-
renderTimer.start();
buildRenderList();
qint64 buildRenderListTime = renderTimer.restart();
@@ -101,6 +94,19 @@ void QSGSoftwarePixmapRenderer::render(QPaintDevice *target)
optimizeRenderList();
qint64 optimizeRenderListTime = renderTimer.restart();
+ if (!isOpaque() && target->devType() == QInternal::Pixmap) {
+ // This fill here is wasteful, but necessary because it is the only way
+ // to force a QImage based pixmap to have an alpha channel.
+ static_cast<QPixmap *>(target)->fill(Qt::transparent);
+ }
+
+ QPainter painter(target);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.setWindow(m_projectionRect);
+ auto rc = static_cast<QSGSoftwareRenderContext *>(context());
+ QPainter *prevPainter = rc->m_activePainter;
+ rc->m_activePainter = &painter;
+
QRegion paintedRegion = renderNodes(&painter);
qint64 renderTime = renderTimer.elapsed();