diff options
author | Liang Qi <liang.qi@qt.io> | 2017-11-06 18:12:53 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-11-06 18:12:53 +0100 |
commit | 853b4b08d54f70d04d371d707e50760ffecf2f77 (patch) | |
tree | 2220ac8be8ae9bb5b25cf560eec3dc973c09b8e8 /src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp | |
parent | 047bdf90db4d00d0462b9faf2044070be4a0e682 (diff) | |
parent | 87999238141588987b3cef6cd68ff62a7e3e8daa (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10v5.10.0-beta4
Change-Id: I8ede7e36592cd21f3e4a0a9b30dbe26bb40fe69b
Diffstat (limited to 'src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp')
-rw-r--r-- | src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp | 20 |
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(); |