diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-06-03 13:49:51 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2016-06-22 13:11:14 +0000 |
commit | 65c877f40e965c368fe6e7ed730242461b5824b7 (patch) | |
tree | f23a8b64b5e3530ba5714ce1a0339302e5336ae8 /src/quick/scenegraph/qsgadaptationlayer_p.h | |
parent | 702c4247d74ffb7e4fb1aaca96d70f4591203ba2 (diff) |
Add cross-backend simple rect, texture, and ninepatch nodes
QSGSimpleRectNode is deprecated -> use
QSGRectangleNode via QQuickWindow::createRectangleNode() instead.
QSGSimpleTextureNode is deprecated -> use
QSGImageNode via QQuickWindow::createImageNode() instead.
The OpenGL version of the simple rectangle node is switched over to
the vertex color material instead of flat, to allow for better batching.
Use the same concept for nine patch nodes. The "style" node from Quick Controls 1
is now QSGNinePatchNode in order to provide a proper cross-backend solution which
is already necessary due to the software backend, but now generalize it to apply
to the accelerated backends with proper materials as well. QC can now simply call
createNinePatchNode() without further ado.
Also fixes a bug with the D3D12 texture material not enabling blending
when needed.
When it comes to the internal class names, QSGRectangleNode and
QSGImageNode get the Internal prefix in the adaptation layer in order to
differentiate from the public API. This involves quite a lot of renaming,
but results in a nice and clean public API.
Change-Id: Iddf9f9412377843ea6d652bcf25e68d1d74659ea
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/quick/scenegraph/qsgadaptationlayer_p.h')
-rw-r--r-- | src/quick/scenegraph/qsgadaptationlayer_p.h | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index 179ec3e3fa..bdb8ebb0f1 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -76,11 +76,10 @@ class TextureReference; class QSGDistanceFieldGlyphCacheManager; class QSGDistanceFieldGlyphNode; class QOpenGLContext; -class QSGImageNode; +class QSGInternalImageNode; class QSGPainterNode; -class QSGRectangleNode; +class QSGInternalRectangleNode; class QSGGlyphNode; -class QSGNinePatchNode; class QSGRootNode; class Q_QUICK_PRIVATE_EXPORT QSGNodeVisitorEx @@ -97,16 +96,14 @@ public: virtual void endVisit(QSGGeometryNode *) = 0; virtual bool visit(QSGOpacityNode *) = 0; virtual void endVisit(QSGOpacityNode *) = 0; - virtual bool visit(QSGImageNode *) = 0; - virtual void endVisit(QSGImageNode *) = 0; + virtual bool visit(QSGInternalImageNode *) = 0; + virtual void endVisit(QSGInternalImageNode *) = 0; virtual bool visit(QSGPainterNode *) = 0; virtual void endVisit(QSGPainterNode *) = 0; - virtual bool visit(QSGRectangleNode *) = 0; - virtual void endVisit(QSGRectangleNode *) = 0; + virtual bool visit(QSGInternalRectangleNode *) = 0; + virtual void endVisit(QSGInternalRectangleNode *) = 0; virtual bool visit(QSGGlyphNode *) = 0; virtual void endVisit(QSGGlyphNode *) = 0; - virtual bool visit(QSGNinePatchNode *) = 0; - virtual void endVisit(QSGNinePatchNode *) = 0; virtual bool visit(QSGRootNode *) = 0; virtual void endVisit(QSGRootNode *) = 0; @@ -122,7 +119,7 @@ public: virtual void accept(QSGNodeVisitorEx *) = 0; }; -class Q_QUICK_PRIVATE_EXPORT QSGRectangleNode : public QSGVisitableNode +class Q_QUICK_PRIVATE_EXPORT QSGInternalRectangleNode : public QSGVisitableNode { public: virtual void setRect(const QRectF &rect) = 0; @@ -140,7 +137,7 @@ public: }; -class Q_QUICK_PRIVATE_EXPORT QSGImageNode : public QSGVisitableNode +class Q_QUICK_PRIVATE_EXPORT QSGInternalImageNode : public QSGVisitableNode { public: virtual void setTargetRect(const QRectF &rect) = 0; @@ -186,19 +183,6 @@ public: virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); } }; -class Q_QUICK_PRIVATE_EXPORT QSGNinePatchNode : public QSGVisitableNode -{ -public: - virtual void setTexture(QSGTexture *texture) = 0; - virtual void setBounds(const QRectF &bounds) = 0; - virtual void setDevicePixelRatio(qreal ratio) = 0; - virtual void setPadding(qreal left, qreal top, qreal right, qreal bottom) = 0; - - virtual void update() = 0; - - virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); } -}; - class Q_QUICK_EXPORT QSGLayer : public QSGDynamicTexture { Q_OBJECT |