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/coreapi | |
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/coreapi')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.cpp | 21 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.h | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode.cpp | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 7ec72a6e10..239557d527 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -726,6 +726,27 @@ void QSGGeometry::updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect, v[3].ty = textureRect.bottom(); } +/*! + Updates the geometry \a g with the coordinates in \a rect. + + The function assumes the geometry object contains a single triangle strip + of QSGGeometry::ColoredPoint2D vertices + */ +void QSGGeometry::updateColoredRectGeometry(QSGGeometry *g, const QRectF &rect) +{ + ColoredPoint2D *v = g->vertexDataAsColoredPoint2D(); + v[0].x = rect.left(); + v[0].y = rect.top(); + + v[1].x = rect.left(); + v[1].y = rect.bottom(); + + v[2].x = rect.right(); + v[2].y = rect.top(); + + v[3].x = rect.right(); + v[3].y = rect.bottom(); +} /*! diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h index 1f54b7d81b..ae7b2f494c 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.h +++ b/src/quick/scenegraph/coreapi/qsggeometry.h @@ -182,6 +182,7 @@ public: static void updateRectGeometry(QSGGeometry *g, const QRectF &rect); static void updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect, const QRectF &sourceRect); + static void updateColoredRectGeometry(QSGGeometry *g, const QRectF &rect); void setIndexDataPattern(DataPattern p); DataPattern indexDataPattern() const { return DataPattern(m_index_usage_pattern); } diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 92f783d500..c0967bcb09 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -1466,8 +1466,6 @@ void QSGNodeVisitor::visitChildren(QSGNode *n) visitNode(c); } - - #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const QSGGeometryNode *n) { |