aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2013-04-16 11:25:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-16 15:33:17 +0200
commita6ccf8b484596091b9a38ac37dac43c456cdc730 (patch)
tree6948e87eb8711878d6230b015a23611cbe9904a5 /src
parent3dbbcc09e98d768a5b7b6c0a498f8aefd9e25b9e (diff)
Make QSGNode and friends extensible via a d-pointer
Convert the private void *m_reserved to a d_ptr so as to make QSGNode inherited classes extensible without breaking binary compatibility. QSGNode and subclasses do not create a private instance by default. This is required by a follow-up commit where a new member needs to be added to QSGSimpleTextureNode. Protected ctors have been added to the superclasses of QSGSimpleTextureNode in the usual fashion. Change-Id: I30c5f5d057654145d87f18c34c5d13a6ff5f7b11 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp46
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.h11
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode_p.h76
-rw-r--r--src/quick/scenegraph/scenegraph.pri1
4 files changed, 133 insertions, 1 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index 6a22e0e7f9..8bf9ae8e76 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qsgnode.h"
+#include "qsgnode_p.h"
#include "qsgrenderer_p.h"
#include "qsgnodeupdater_p.h"
#include "qsgmaterial.h"
@@ -267,6 +268,26 @@ QSGNode::QSGNode(NodeType type)
}
/*!
+ * Constructs a new node with the given node type.
+ *
+ * \internal
+ */
+QSGNode::QSGNode(QSGNodePrivate &dd, NodeType type)
+ : m_parent(0)
+ , m_type(type)
+ , m_firstChild(0)
+ , m_lastChild(0)
+ , m_nextSibling(0)
+ , m_previousSibling(0)
+ , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0)
+ , m_nodeFlags(OwnedByParent)
+ , m_dirtyState(0)
+ , d_ptr(&dd)
+{
+ init();
+}
+
+/*!
* \internal
*/
void QSGNode::init()
@@ -678,6 +699,18 @@ QSGBasicGeometryNode::QSGBasicGeometryNode(NodeType type)
/*!
+ \internal
+ */
+QSGBasicGeometryNode::QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type)
+ : QSGNode(dd, type)
+ , m_geometry(0)
+ , m_matrix(0)
+ , m_clip_list(0)
+{
+}
+
+
+/*!
Deletes this QSGBasicGeometryNode.
If the node has the flag QSGNode::OwnsGeometry set, it will also delete the
@@ -808,6 +841,19 @@ QSGGeometryNode::QSGGeometryNode()
/*!
+ \internal
+ */
+QSGGeometryNode::QSGGeometryNode(QSGGeometryNodePrivate &dd)
+ : QSGBasicGeometryNode(dd, GeometryNodeType)
+ , m_render_order(0)
+ , m_material(0)
+ , m_opaque_material(0)
+ , m_opacity(1)
+{
+}
+
+
+/*!
Deletes this geometry node.
The flags QSGNode::OwnsMaterial, QSGNode::OwnsOpaqueMaterial and
diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h
index 3fa2f7fc04..d83e6bcc81 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.h
+++ b/src/quick/scenegraph/coreapi/qsgnode.h
@@ -58,6 +58,9 @@ class QSGRootNode;
class QSGGeometryNode;
class QSGTransformNode;
class QSGClipNode;
+class QSGNodePrivate;
+class QSGBasicGeometryNodePrivate;
+class QSGGeometryNodePrivate;
class Q_QUICK_EXPORT QSGNode
{
@@ -149,6 +152,7 @@ public:
protected:
QSGNode(NodeType type);
+ QSGNode(QSGNodePrivate &dd, NodeType type);
private:
friend class QSGRootNode;
@@ -167,7 +171,8 @@ private:
Flags m_nodeFlags;
DirtyState m_dirtyState;
- void *m_reserved;
+protected:
+ QScopedPointer<QSGNodePrivate> d_ptr;
};
class Q_QUICK_EXPORT QSGBasicGeometryNode : public QSGNode
@@ -184,6 +189,7 @@ public:
protected:
QSGBasicGeometryNode(NodeType type);
+ QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type);
private:
friend class QSGNodeUpdater;
@@ -218,6 +224,9 @@ public:
void setInheritedOpacity(qreal opacity);
qreal inheritedOpacity() const { return m_opacity; }
+protected:
+ QSGGeometryNode(QSGGeometryNodePrivate &dd);
+
private:
friend class QSGNodeUpdater;
diff --git a/src/quick/scenegraph/coreapi/qsgnode_p.h b/src/quick/scenegraph/coreapi/qsgnode_p.h
new file mode 100644
index 0000000000..b0d8088af2
--- /dev/null
+++ b/src/quick/scenegraph/coreapi/qsgnode_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSGNODE_P_H
+#define QSGNODE_P_H
+
+#include <qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSGNodePrivate
+{
+public:
+ QSGNodePrivate() {}
+ virtual ~QSGNodePrivate() {}
+};
+
+
+class QSGBasicGeometryNodePrivate : public QSGNodePrivate
+{
+public:
+ QSGBasicGeometryNodePrivate()
+ : QSGNodePrivate()
+ {}
+};
+
+
+class QSGGeometryNodePrivate: public QSGBasicGeometryNodePrivate
+{
+public:
+ QSGGeometryNodePrivate()
+ : QSGBasicGeometryNodePrivate()
+ {}
+};
+
+QT_END_NAMESPACE
+
+#endif // QSGNODE_P_H
diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri
index 8c87e23ac9..ebf886dace 100644
--- a/src/quick/scenegraph/scenegraph.pri
+++ b/src/quick/scenegraph/scenegraph.pri
@@ -6,6 +6,7 @@ HEADERS += \
$$PWD/coreapi/qsggeometry.h \
$$PWD/coreapi/qsgmaterial.h \
$$PWD/coreapi/qsgnode.h \
+ $$PWD/coreapi/qsgnode_p.h \
$$PWD/coreapi/qsgnodeupdater_p.h \
$$PWD/coreapi/qsgrenderer_p.h \
$$PWD/coreapi/qsgrendernode_p.h \