diff options
Diffstat (limited to 'src/quick/scenegraph/adaptations/software')
12 files changed, 52 insertions, 20 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp index 2e5fdbbe6b..ca620965a8 100644 --- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp @@ -77,11 +77,6 @@ QSGSoftwareRenderableNode *QSGAbstractSoftwareRenderer::renderableNode(QSGNode * return m_nodes.value(node, nullptr); } -const QLinkedList<QSGSoftwareRenderableNode*> &QSGAbstractSoftwareRenderer::renderableNodes() const -{ - return m_renderableNodes; -} - void QSGAbstractSoftwareRenderer::addNodeMapping(QSGNode *node, QSGSoftwareRenderableNode *renderableNode) { m_nodes.insert(node, renderableNode); @@ -238,12 +233,13 @@ void QSGAbstractSoftwareRenderer::setBackgroundColor(const QColor &color) renderableNode(m_background)->markMaterialDirty(); } -void QSGAbstractSoftwareRenderer::setBackgroundRect(const QRect &rect) +void QSGAbstractSoftwareRenderer::setBackgroundRect(const QRect &rect, qreal devicePixelRatio) { - if (m_background->rect().toRect() == rect) + if (m_background->rect().toRect() == rect && m_devicePixelRatio == devicePixelRatio) return; m_background->setRect(rect); - renderableNode(m_background)->markGeometryDirty(); + m_devicePixelRatio = devicePixelRatio; + renderableNode(m_background)->markGeometryDirty(); // Invalidate the whole scene when the background is resized markDirty(); } diff --git a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h index 99204ef25e..e1b477ab97 100644 --- a/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer_p.h @@ -54,7 +54,6 @@ #include <private/qsgrenderer_p.h> #include <QtCore/QHash> -#include <QtCore/QLinkedList> QT_BEGIN_NAMESPACE @@ -83,12 +82,11 @@ protected: QRegion optimizeRenderList(); void setBackgroundColor(const QColor &color); - void setBackgroundRect(const QRect &rect); + void setBackgroundRect(const QRect &rect, qreal devicePixelRatio); QColor backgroundColor(); QRect backgroundRect(); // only known after calling optimizeRenderList() bool isOpaque() const { return m_isOpaque; } - const QLinkedList<QSGSoftwareRenderableNode*> &renderableNodes() const; private: void nodeAdded(QSGNode *node); @@ -99,12 +97,13 @@ private: void nodeOpacityUpdated(QSGNode *node); QHash<QSGNode*, QSGSoftwareRenderableNode*> m_nodes; - QLinkedList<QSGSoftwareRenderableNode*> m_renderableNodes; + QVector<QSGSoftwareRenderableNode*> m_renderableNodes; QSGSimpleRectNode *m_background; QRegion m_dirtyRegion; QRegion m_obscuredRegion; + qreal m_devicePixelRatio = 1; bool m_isOpaque = false; QSGSoftwareRenderableNodeUpdater *m_nodeUpdater; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp index 5b5bf005d8..7b5ee66df6 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp @@ -99,8 +99,9 @@ QSGInternalRectangleNode *QSGSoftwareContext::createInternalRectangleNode() return new QSGSoftwareInternalRectangleNode(); } -QSGInternalImageNode *QSGSoftwareContext::createInternalImageNode() +QSGInternalImageNode *QSGSoftwareContext::createInternalImageNode(QSGRenderContext *renderContext) { + Q_UNUSED(renderContext); return new QSGSoftwareInternalImageNode(); } diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h index 1f14717416..84f468ce33 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext_p.h @@ -89,7 +89,7 @@ public: QSGRenderContext *createRenderContext() override { return new QSGSoftwareRenderContext(this); } QSGInternalRectangleNode *createInternalRectangleNode() override; - QSGInternalImageNode *createInternalImageNode() override; + QSGInternalImageNode *createInternalImageNode(QSGRenderContext *renderContext) override; QSGPainterNode *createPainterNode(QQuickPaintedItem *item) override; QSGGlyphNode *createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode) override; QSGLayer *createLayer(QSGRenderContext *renderContext) override; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp index 70378d2950..683ccb60c2 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp @@ -45,7 +45,8 @@ QT_BEGIN_NAMESPACE QSGSoftwareLayer::QSGSoftwareLayer(QSGRenderContext *renderContext) - : m_item(nullptr) + : QSGLayer(*(new QSGSoftwareLayerPrivate)) + , m_item(nullptr) , m_context(renderContext) , m_renderer(nullptr) , m_device_pixel_ratio(1) @@ -69,6 +70,11 @@ int QSGSoftwareLayer::textureId() const return 0; } +int QSGSoftwareLayerPrivate::comparisonKey() const +{ + return 0; +} + QSize QSGSoftwareLayer::textureSize() const { return m_pixmap.size(); diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer_p.h index 9f5a22e66f..1859e14514 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer_p.h @@ -53,13 +53,16 @@ #include <private/qsgadaptationlayer_p.h> #include <private/qsgcontext_p.h> +#include <private/qsgtexture_p.h> QT_BEGIN_NAMESPACE class QSGSoftwarePixmapRenderer; +class QSGSoftwareLayerPrivate; class QSGSoftwareLayer : public QSGLayer { + Q_DECLARE_PRIVATE(QSGSoftwareLayer) Q_OBJECT public: QSGSoftwareLayer(QSGRenderContext *renderContext); @@ -117,6 +120,13 @@ private: bool m_dirtyTexture; }; +class QSGSoftwareLayerPrivate : public QSGTexturePrivate +{ + Q_DECLARE_PUBLIC(QSGSoftwareLayer) +public: + int comparisonKey() const override; +}; + QT_END_NAMESPACE #endif // QSGSOFTWARELAYER_H diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp index bb4afc8301..4a6d73ec59 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaprenderer.cpp @@ -79,7 +79,7 @@ void QSGSoftwarePixmapRenderer::render(QPaintDevice *target) QElapsedTimer renderTimer; // Setup background item - setBackgroundRect(m_projectionRect.normalized()); + setBackgroundRect(m_projectionRect.normalized(), qreal(1)); setBackgroundColor(clearColor()); renderTimer.start(); diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaptexture.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaptexture.cpp index 16e3a111ae..82a48d80ca 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaptexture.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaptexture.cpp @@ -38,10 +38,12 @@ ****************************************************************************/ #include "qsgsoftwarepixmaptexture_p.h" +#include <private/qsgcontext_p.h> QT_BEGIN_NAMESPACE QSGSoftwarePixmapTexture::QSGSoftwarePixmapTexture(const QImage &image, uint flags) + : QSGTexture(*(new QSGSoftwarePixmapTexturePrivate)) { // Prevent pixmap format conversion to reduce memory consumption // and surprises in calling code. (See QTBUG-47328) @@ -55,11 +57,11 @@ QSGSoftwarePixmapTexture::QSGSoftwarePixmapTexture(const QImage &image, uint fla } QSGSoftwarePixmapTexture::QSGSoftwarePixmapTexture(const QPixmap &pixmap) - : m_pixmap(pixmap) + : QSGTexture(*(new QSGSoftwarePixmapTexturePrivate)), + m_pixmap(pixmap) { } - int QSGSoftwarePixmapTexture::textureId() const { return 0; @@ -85,6 +87,11 @@ void QSGSoftwarePixmapTexture::bind() Q_UNREACHABLE(); } +int QSGSoftwarePixmapTexturePrivate::comparisonKey() const +{ + return 0; +} + QT_END_NAMESPACE #include "moc_qsgsoftwarepixmaptexture_p.cpp" diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaptexture_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaptexture_p.h index 034fa25da9..baa62d93de 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaptexture_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepixmaptexture_p.h @@ -52,12 +52,16 @@ // #include <private/qsgtexture_p.h> +#include <QtGui/QPixmap> QT_BEGIN_NAMESPACE +class QSGSoftwarePixmapTexturePrivate; + class QSGSoftwarePixmapTexture : public QSGTexture { Q_OBJECT + Q_DECLARE_PRIVATE(QSGSoftwarePixmapTexture) public: QSGSoftwarePixmapTexture(const QImage &image, uint flags); QSGSoftwarePixmapTexture(const QPixmap &pixmap); @@ -74,6 +78,13 @@ private: QPixmap m_pixmap; }; +class QSGSoftwarePixmapTexturePrivate : public QSGTexturePrivate +{ + Q_DECLARE_PUBLIC(QSGSoftwarePixmapTexture) +public: + int comparisonKey() const override; +}; + QT_END_NAMESPACE #endif // QSGSOFTWAREPIXMAPTEXTURE_H diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp index 20286a03d5..141d8f3c6d 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp @@ -41,6 +41,7 @@ #include "qsgsoftwarelayer_p.h" #include "qsgsoftwarepixmaptexture_p.h" #include "qsgsoftwareinternalimagenode_p.h" +#include <private/qsgplaintexture_p.h> QT_BEGIN_NAMESPACE diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp index 7fb531cca3..95c7efd4cb 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp @@ -52,7 +52,7 @@ #include <qsgsimplerectnode.h> #include <qsgsimpletexturenode.h> #include <private/qsgrendernode_p.h> -#include <private/qsgtexture_p.h> +#include <private/qsgplaintexture_p.h> #include <qmath.h> diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp index e9ed52d428..df129cbfee 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp @@ -114,7 +114,8 @@ void QSGSoftwareRenderer::render() setBackgroundColor(clearColor()); setBackgroundRect(QRect(0, 0, m_paintDevice->width() / m_paintDevice->devicePixelRatioF(), - m_paintDevice->height() / m_paintDevice->devicePixelRatioF())); + m_paintDevice->height() / m_paintDevice->devicePixelRatioF()), + m_paintDevice->devicePixelRatioF()); // Build Renderlist // The renderlist is created by visiting each node in the tree and when a |