aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp6
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h3
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp3
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp20
4 files changed, 22 insertions, 10 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
index 02cf8209d1..30088846a6 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp
@@ -193,6 +193,12 @@ QRegion QSGAbstractSoftwareRenderer::optimizeRenderList()
}
}
+ if (m_obscuredRegion.contains(m_background->rect().toAlignedRect())) {
+ m_isOpaque = true;
+ } else {
+ m_isOpaque = false;
+ }
+
// Empty dirtyRegion (for second pass)
m_dirtyRegion = QRegion();
m_obscuredRegion = QRegion();
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
index 04a17ea377..c68a933384 100644
--- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
+++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h
@@ -86,6 +86,8 @@ protected:
void setBackgroundSize(const QSize &size);
QColor backgroundColor();
QSize backgroundSize();
+ // only known after calling optimizeRenderList()
+ bool isOpaque() const { return m_isOpaque; }
private:
void nodeAdded(QSGNode *node);
@@ -102,6 +104,7 @@ private:
QRegion m_dirtyRegion;
QRegion m_obscuredRegion;
+ bool m_isOpaque;
QSGSoftwareRenderableNodeUpdater *m_nodeUpdater;
};
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp
index bd5d8f72c0..9d30c43f87 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp
@@ -229,9 +229,6 @@ void QSGSoftwareLayer::grab()
if (m_pixmap.size() != m_size) {
m_pixmap = QPixmap(m_size);
m_pixmap.setDevicePixelRatio(m_device_pixel_ratio);
- // This fill here is wasteful, but necessary because it is the only way
- // to force a QImage based pixmap to have an alpha channel.
- m_pixmap.fill(Qt::transparent);
}
// Render texture.
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp
index f8c1a3d90b..7824e53622 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();