summaryrefslogtreecommitdiffstats
path: root/src/core/delegated_frame_node.cpp
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-07-07 18:05:06 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-08-01 15:33:12 +0200
commit8bfc63d456c4524cadae0efb685234c80729775e (patch)
tree17616a998b02ae558979d8751e72d60edeaca247 /src/core/delegated_frame_node.cpp
parent3ef45d0329858a60a8b96363fcf9d7fe9b6d8311 (diff)
Don't use the private QQuickDefaultClipNode and QSGRectangleNode
Use QSGSimpleRectNode and a custom QSGClipNode instead, which provide the same funtionalities without using private API. Change-Id: Ia62ddc9cf86240dbf85f69c088599b7ca8792e7c Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'src/core/delegated_frame_node.cpp')
-rw-r--r--src/core/delegated_frame_node.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index c390b07b8..546f7395e 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -67,10 +67,9 @@
#include "cc/quads/tile_draw_quad.h"
#include "cc/quads/yuv_video_draw_quad.h"
#include <QOpenGLFramebufferObject>
+#include <QSGSimpleRectNode>
#include <QSGSimpleTextureNode>
#include <QSGTexture>
-#include <QtQuick/private/qquickclipnode_p.h>
-#include <QtQuick/private/qsgadaptationlayer_p.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <QtQuick/private/qsgrenderer_p.h>
#include <QtQuick/private/qsgtexture_p.h>
@@ -143,6 +142,14 @@ private:
#endif
};
+class RectClipNode : public QSGClipNode
+{
+public:
+ RectClipNode(const QRectF &);
+private:
+ QSGGeometry m_geometry;
+};
+
static inline QSharedPointer<RenderPassTexture> findRenderPassTexture(const cc::RenderPass::Id &id, const QList<QSharedPointer<RenderPassTexture> > &list)
{
Q_FOREACH (const QSharedPointer<RenderPassTexture> &texture, list)
@@ -183,8 +190,7 @@ static QSGNode *buildLayerChain(QSGNode *chainParent, const cc::SharedQuadState
{
QSGNode *layerChain = chainParent;
if (layerState->is_clipped) {
- QQuickDefaultClipNode *clipNode = new QQuickDefaultClipNode(toQt(layerState->clip_rect));
- clipNode->update();
+ RectClipNode *clipNode = new RectClipNode(toQt(layerState->clip_rect));
layerChain->appendChildNode(clipNode);
layerChain = clipNode;
}
@@ -374,6 +380,15 @@ void MailboxTexture::fetchTexture(gpu::gles2::MailboxManager *mailboxManager)
}
}
+RectClipNode::RectClipNode(const QRectF &rect)
+ : m_geometry(QSGGeometry::defaultAttributes_Point2D(), 4)
+{
+ QSGGeometry::updateRectGeometry(&m_geometry, rect);
+ setGeometry(&m_geometry);
+ setClipRect(rect);
+ setIsRectangular(true);
+}
+
DelegatedFrameNode::DelegatedFrameNode(QSGRenderContext *sgRenderContext)
: m_sgRenderContext(sgRenderContext)
, m_numPendingSyncPoints(0)
@@ -497,11 +512,10 @@ void DelegatedFrameNode::commit(DelegatedFrameNodeData* data, cc::ReturnedResour
switch (quad->material) {
case cc::DrawQuad::CHECKERBOARD: {
const cc::CheckerboardDrawQuad *cbquad = cc::CheckerboardDrawQuad::MaterialCast(quad);
- QSGRectangleNode *rectangleNode = m_sgRenderContext->sceneGraphContext()->createRectangleNode();
+ QSGSimpleRectNode *rectangleNode = new QSGSimpleRectNode;
rectangleNode->setRect(toQt(quad->rect));
rectangleNode->setColor(toQt(cbquad->color));
- rectangleNode->update();
currentLayerChain->appendChildNode(rectangleNode);
break;
} case cc::DrawQuad::RENDER_PASS: {
@@ -541,7 +555,7 @@ void DelegatedFrameNode::commit(DelegatedFrameNodeData* data, cc::ReturnedResour
break;
} case cc::DrawQuad::SOLID_COLOR: {
const cc::SolidColorDrawQuad *scquad = cc::SolidColorDrawQuad::MaterialCast(quad);
- QSGRectangleNode *rectangleNode = m_sgRenderContext->sceneGraphContext()->createRectangleNode();
+ QSGSimpleRectNode *rectangleNode = new QSGSimpleRectNode;
// Qt only supports MSAA and this flag shouldn't be needed.
// If we ever want to use QSGRectangleNode::setAntialiasing for this we should
@@ -550,7 +564,6 @@ void DelegatedFrameNode::commit(DelegatedFrameNodeData* data, cc::ReturnedResour
rectangleNode->setRect(toQt(quad->rect));
rectangleNode->setColor(toQt(scquad->color));
- rectangleNode->update();
currentLayerChain->appendChildNode(rectangleNode);
break;
} case cc::DrawQuad::TILED_CONTENT: {