| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/coreapi/qsgnode.h | 
| Source code | Switch to Preprocessed file | 
| Line | Source | Count | 
|---|---|---|
| 1 | /**************************************************************************** | - | 
| 2 | ** | - | 
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | 
| 4 | ** Contact: https://www.qt.io/licensing/ | - | 
| 5 | ** | - | 
| 6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - | 
| 7 | ** | - | 
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | 
| 9 | ** Commercial License Usage | - | 
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | 
| 11 | ** accordance with the commercial license agreement provided with the | - | 
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | 
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | 
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | 
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | 
| 16 | ** | - | 
| 17 | ** GNU Lesser General Public License Usage | - | 
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | 
| 19 | ** General Public License version 3 as published by the Free Software | - | 
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | 
| 21 | ** packaging of this file. Please review the following information to | - | 
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | 
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | 
| 24 | ** | - | 
| 25 | ** GNU General Public License Usage | - | 
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | 
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | 
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | 
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | 
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | 
| 31 | ** included in the packaging of this file. Please review the following | - | 
| 32 | ** information to ensure the GNU General Public License requirements will | - | 
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | 
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | 
| 35 | ** | - | 
| 36 | ** $QT_END_LICENSE$ | - | 
| 37 | ** | - | 
| 38 | ****************************************************************************/ | - | 
| 39 | - | |
| 40 | #ifndef QSGNODE_H | - | 
| 41 | #define QSGNODE_H | - | 
| 42 | - | |
| 43 | #include <QtQuick/qsggeometry.h> | - | 
| 44 | #include <QtGui/QMatrix4x4> | - | 
| 45 | - | |
| 46 | #include <float.h> | - | 
| 47 | - | |
| 48 | QT_BEGIN_NAMESPACE | - | 
| 49 | - | |
| 50 | #ifndef QT_NO_DEBUG | - | 
| 51 | #define QSG_RUNTIME_DESCRIPTION | - | 
| 52 | #endif | - | 
| 53 | - | |
| 54 | class QSGAbstractRenderer; | - | 
| 55 | class QSGRenderer; | - | 
| 56 | - | |
| 57 | class QSGNode; | - | 
| 58 | class QSGRootNode; | - | 
| 59 | class QSGGeometryNode; | - | 
| 60 | class QSGTransformNode; | - | 
| 61 | class QSGClipNode; | - | 
| 62 | class QSGNodePrivate; | - | 
| 63 | class QSGBasicGeometryNodePrivate; | - | 
| 64 | class QSGGeometryNodePrivate; | - | 
| 65 | - | |
| 66 | namespace QSGBatchRenderer { | - | 
| 67 | class Renderer; | - | 
| 68 | class Updater; | - | 
| 69 | } | - | 
| 70 | - | |
| 71 | class Q_QUICK_EXPORT QSGNode | - | 
| 72 | { | - | 
| 73 | public: | - | 
| 74 | enum NodeType { | - | 
| 75 | BasicNodeType, | - | 
| 76 | GeometryNodeType, | - | 
| 77 | TransformNodeType, | - | 
| 78 | ClipNodeType, | - | 
| 79 | OpacityNodeType, | - | 
| 80 | RootNodeType, | - | 
| 81 | RenderNodeType | - | 
| 82 | }; | - | 
| 83 | - | |
| 84 | enum Flag { | - | 
| 85 | // Lower 16 bites reserved for general node | - | 
| 86 | OwnedByParent = 0x0001, | - | 
| 87 | UsePreprocess = 0x0002, | - | 
| 88 | - | |
| 89 | // 0x00ff0000 bits reserved for node subclasses | - | 
| 90 | - | |
| 91 | // QSGBasicGeometryNode | - | 
| 92 | OwnsGeometry = 0x00010000, | - | 
| 93 | OwnsMaterial = 0x00020000, | - | 
| 94 | OwnsOpaqueMaterial = 0x00040000, | - | 
| 95 | - | |
| 96 | // Uppermost 8 bits are reserved for internal use. | - | 
| 97 | IsVisitableNode = 0x01000000 | - | 
| 98 | #ifdef Q_CLANG_QDOC | - | 
| 99 | InternalReserved = 0x01000000 | - | 
| 100 | #endif | - | 
| 101 | }; | - | 
| 102 | Q_DECLARE_FLAGS(Flags, Flag) | - | 
| 103 | - | |
| 104 | enum DirtyStateBit { | - | 
| 105 | DirtySubtreeBlocked = 0x0080, | - | 
| 106 | DirtyMatrix = 0x0100, | - | 
| 107 | DirtyNodeAdded = 0x0400, | - | 
| 108 | DirtyNodeRemoved = 0x0800, | - | 
| 109 | DirtyGeometry = 0x1000, | - | 
| 110 | DirtyMaterial = 0x2000, | - | 
| 111 | DirtyOpacity = 0x4000, | - | 
| 112 | - | |
| 113 | DirtyForceUpdate = 0x8000, | - | 
| 114 | - | |
| 115 | DirtyUsePreprocess = UsePreprocess, | - | 
| 116 | - | |
| 117 | DirtyPropagationMask = DirtyMatrix | - | 
| 118 | | DirtyNodeAdded | - | 
| 119 | | DirtyOpacity | - | 
| 120 | | DirtyForceUpdate | - | 
| 121 | - | |
| 122 | }; | - | 
| 123 | Q_DECLARE_FLAGS(DirtyState, DirtyStateBit) | - | 
| 124 | - | |
| 125 | QSGNode(); | - | 
| 126 | virtual ~QSGNode(); | - | 
| 127 | - | |
| 128 | QSGNode *parent() const { return m_parent; } executed 10368063 times by 78 tests:  return m_parent;Executed by: 
 | 10368063 | 
| 129 | - | |
| 130 | void removeChildNode(QSGNode *node); | - | 
| 131 | void removeAllChildNodes(); | - | 
| 132 | void prependChildNode(QSGNode *node); | - | 
| 133 | void appendChildNode(QSGNode *node); | - | 
| 134 | void insertChildNodeBefore(QSGNode *node, QSGNode *before); | - | 
| 135 | void insertChildNodeAfter(QSGNode *node, QSGNode *after); | - | 
| 136 | void reparentChildNodesTo(QSGNode *newParent); | - | 
| 137 | - | |
| 138 | int childCount() const; | - | 
| 139 | QSGNode *childAtIndex(int i) const; | - | 
| 140 | QSGNode *firstChild() const { return m_firstChild; } executed 7323620 times by 78 tests:  return m_firstChild;Executed by: 
 | 7323620 | 
| 141 | QSGNode *lastChild() const { return m_lastChild; } never executed:  return m_lastChild; | 0 | 
| 142 | QSGNode *nextSibling() const { return m_nextSibling; } executed 6012046 times by 78 tests:  return m_nextSibling;Executed by: 
 | 6012046 | 
| 143 | QSGNode* previousSibling() const { return m_previousSibling; } never executed:  return m_previousSibling; | 0 | 
| 144 | - | |
| 145 | inline NodeType type() const { return m_type; } executed 30605450 times by 78 tests:  return m_type;Executed by: 
 | 30605450 | 
| 146 | - | |
| 147 | QT_DEPRECATED void clearDirty() { } | - | 
| 148 | void markDirty(DirtyState bits); | - | 
| 149 | QT_DEPRECATED DirtyState dirtyState() const { return nullptr; } never executed:  return nullptr; | 0 | 
| 150 | - | |
| 151 | virtual bool isSubtreeBlocked() const; | - | 
| 152 | - | |
| 153 | Flags flags() const { return m_nodeFlags; } executed 5836810 times by 78 tests:  return m_nodeFlags;Executed by: 
 | 5836810 | 
| 154 | void setFlag(Flag, bool = true); | - | 
| 155 | void setFlags(Flags, bool = true); | - | 
| 156 | - | |
| 157 | virtual void preprocess() { } | - | 
| 158 | - | |
| 159 | protected: | - | 
| 160 | QSGNode(NodeType type); | - | 
| 161 | QSGNode(QSGNodePrivate &dd, NodeType type); | - | 
| 162 | - | |
| 163 | private: | - | 
| 164 | friend class QSGRootNode; | - | 
| 165 | friend class QSGBatchRenderer::Renderer; | - | 
| 166 | friend class QSGRenderer; | - | 
| 167 | - | |
| 168 | void init(); | - | 
| 169 | void destroy(); | - | 
| 170 | - | |
| 171 | QSGNode *m_parent = nullptr; | - | 
| 172 | NodeType m_type = BasicNodeType; | - | 
| 173 | QSGNode *m_firstChild = nullptr; | - | 
| 174 | QSGNode *m_lastChild = nullptr; | - | 
| 175 | QSGNode *m_nextSibling = nullptr; | - | 
| 176 | QSGNode *m_previousSibling = nullptr; | - | 
| 177 | int m_subtreeRenderableCount = 0; | - | 
| 178 | - | |
| 179 | Flags m_nodeFlags; | - | 
| 180 | DirtyState m_dirtyState; // Obsolete, remove in Qt 6 | - | 
| 181 | - | |
| 182 | protected: | - | 
| 183 | friend class QSGNodePrivate; | - | 
| 184 | - | |
| 185 | QScopedPointer<QSGNodePrivate> d_ptr; | - | 
| 186 | }; | - | 
| 187 | - | |
| 188 | void Q_QUICK_EXPORT qsgnode_set_description(QSGNode *node, const QString &description); | - | 
| 189 | - | |
| 190 | class Q_QUICK_EXPORT QSGBasicGeometryNode : public QSGNode | - | 
| 191 | { | - | 
| 192 | public: | - | 
| 193 | ~QSGBasicGeometryNode() override; | - | 
| 194 | - | |
| 195 | void setGeometry(QSGGeometry *geometry); | - | 
| 196 | const QSGGeometry *geometry() const { return m_geometry; } executed 16 times by 1 test:  return m_geometry;Executed by: 
 | 16 | 
| 197 | QSGGeometry *geometry() { return m_geometry; } executed 26160887 times by 73 tests:  return m_geometry;Executed by: 
 | 26160887 | 
| 198 | - | |
| 199 | const QMatrix4x4 *matrix() const { return m_matrix; } executed 4396617 times by 72 tests:  return m_matrix;Executed by: 
 | 4396617 | 
| 200 | const QSGClipNode *clipList() const { return m_clip_list; } executed 6212378 times by 72 tests:  return m_clip_list;Executed by: 
 | 6212378 | 
| 201 | - | |
| 202 | void setRendererMatrix(const QMatrix4x4 *m) { m_matrix = m; } executed 1099819 times by 73 tests:  end of blockExecuted by: 
 | 1099819 | 
| 203 | void setRendererClipList(const QSGClipNode *c) { m_clip_list = c; } executed 1099819 times by 73 tests:  end of blockExecuted by: 
 | 1099819 | 
| 204 | - | |
| 205 | protected: | - | 
| 206 | QSGBasicGeometryNode(NodeType type); | - | 
| 207 | QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type); | - | 
| 208 | - | |
| 209 | private: | - | 
| 210 | friend class QSGNodeUpdater; | - | 
| 211 | - | |
| 212 | QSGGeometry *m_geometry; | - | 
| 213 | - | |
| 214 | int m_reserved_start_index; | - | 
| 215 | int m_reserved_end_index; | - | 
| 216 | - | |
| 217 | const QMatrix4x4 *m_matrix; | - | 
| 218 | const QSGClipNode *m_clip_list; | - | 
| 219 | }; | - | 
| 220 | - | |
| 221 | class QSGMaterial; | - | 
| 222 | - | |
| 223 | class Q_QUICK_EXPORT QSGGeometryNode : public QSGBasicGeometryNode | - | 
| 224 | { | - | 
| 225 | public: | - | 
| 226 | QSGGeometryNode(); | - | 
| 227 | ~QSGGeometryNode() override; | - | 
| 228 | - | |
| 229 | void setMaterial(QSGMaterial *material); | - | 
| 230 | QSGMaterial *material() const { return m_material; } executed 1147754 times by 72 tests:  return m_material;Executed by: 
 | 1147754 | 
| 231 | - | |
| 232 | void setOpaqueMaterial(QSGMaterial *material); | - | 
| 233 | QSGMaterial *opaqueMaterial() const { return m_opaque_material; } executed 551567 times by 72 tests:  return m_opaque_material;Executed by: 
 | 551567 | 
| 234 | - | |
| 235 | QSGMaterial *activeMaterial() const; | - | 
| 236 | - | |
| 237 | void setRenderOrder(int order); | - | 
| 238 | int renderOrder() const { return m_render_order; } never executed:  return m_render_order; | 0 | 
| 239 | - | |
| 240 | void setInheritedOpacity(qreal opacity); | - | 
| 241 | qreal inheritedOpacity() const { return m_opacity; } executed 7509650 times by 72 tests:  return m_opacity;Executed by: 
 | 7509650 | 
| 242 | - | |
| 243 | protected: | - | 
| 244 | QSGGeometryNode(QSGGeometryNodePrivate &dd); | - | 
| 245 | - | |
| 246 | private: | - | 
| 247 | friend class QSGNodeUpdater; | - | 
| 248 | - | |
| 249 | int m_render_order = 0; | - | 
| 250 | QSGMaterial *m_material = nullptr; | - | 
| 251 | QSGMaterial *m_opaque_material = nullptr; | - | 
| 252 | - | |
| 253 | qreal m_opacity = 1; | - | 
| 254 | }; | - | 
| 255 | - | |
| 256 | class Q_QUICK_EXPORT QSGClipNode : public QSGBasicGeometryNode | - | 
| 257 | { | - | 
| 258 | public: | - | 
| 259 | QSGClipNode(); | - | 
| 260 | ~QSGClipNode() override; | - | 
| 261 | - | |
| 262 | void setIsRectangular(bool rectHint); | - | 
| 263 | bool isRectangular() const { return m_is_rectangular; } executed 948 times by 8 tests:  return m_is_rectangular;Executed by: 
 | 948 | 
| 264 | - | |
| 265 | void setClipRect(const QRectF &); | - | 
| 266 | QRectF clipRect() const { return m_clip_rect; } executed 932 times by 8 tests:  return m_clip_rect;Executed by: 
 | 932 | 
| 267 | - | |
| 268 | private: | - | 
| 269 | uint m_is_rectangular : 1; | - | 
| 270 | uint m_reserved : 31; | - | 
| 271 | - | |
| 272 | QRectF m_clip_rect; | - | 
| 273 | }; | - | 
| 274 | - | |
| 275 | - | |
| 276 | class Q_QUICK_EXPORT QSGTransformNode : public QSGNode | - | 
| 277 | { | - | 
| 278 | public: | - | 
| 279 | QSGTransformNode(); | - | 
| 280 | ~QSGTransformNode() override; | - | 
| 281 | - | |
| 282 | void setMatrix(const QMatrix4x4 &matrix); | - | 
| 283 | const QMatrix4x4 &matrix() const { return m_matrix; } executed 2297285 times by 77 tests:  return m_matrix;Executed by: 
 | 2297285 | 
| 284 | - | |
| 285 | void setCombinedMatrix(const QMatrix4x4 &matrix); | - | 
| 286 | const QMatrix4x4 &combinedMatrix() const { return m_combined_matrix; } executed 720536 times by 44 tests:  return m_combined_matrix;Executed by: 
 | 720536 | 
| 287 | - | |
| 288 | private: | - | 
| 289 | QMatrix4x4 m_matrix; | - | 
| 290 | QMatrix4x4 m_combined_matrix; | - | 
| 291 | }; | - | 
| 292 | - | |
| 293 | - | |
| 294 | class Q_QUICK_EXPORT QSGRootNode : public QSGNode | - | 
| 295 | { | - | 
| 296 | public: | - | 
| 297 | QSGRootNode(); | - | 
| 298 | ~QSGRootNode() override; | - | 
| 299 | - | |
| 300 | private: | - | 
| 301 | void notifyNodeChange(QSGNode *node, DirtyState state); | - | 
| 302 | - | |
| 303 | friend class QSGAbstractRenderer; | - | 
| 304 | friend class QSGNode; | - | 
| 305 | friend class QSGGeometryNode; | - | 
| 306 | - | |
| 307 | QList<QSGAbstractRenderer *> m_renderers; | - | 
| 308 | }; | - | 
| 309 | - | |
| 310 | - | |
| 311 | class Q_QUICK_EXPORT QSGOpacityNode : public QSGNode | - | 
| 312 | { | - | 
| 313 | public: | - | 
| 314 | QSGOpacityNode(); | - | 
| 315 | ~QSGOpacityNode() override; | - | 
| 316 | - | |
| 317 | void setOpacity(qreal opacity); | - | 
| 318 | qreal opacity() const { return m_opacity; } executed 83095 times by 19 tests:  return m_opacity;Executed by: 
 | 83095 | 
| 319 | - | |
| 320 | void setCombinedOpacity(qreal opacity); | - | 
| 321 | qreal combinedOpacity() const { return m_combined_opacity; } executed 14 times by 1 test:  return m_combined_opacity;Executed by: 
 | 14 | 
| 322 | - | |
| 323 | bool isSubtreeBlocked() const override; | - | 
| 324 | - | |
| 325 | private: | - | 
| 326 | qreal m_opacity = 1; | - | 
| 327 | qreal m_combined_opacity = 1; | - | 
| 328 | }; | - | 
| 329 | - | |
| 330 | class Q_QUICK_EXPORT QSGNodeVisitor { | - | 
| 331 | public: | - | 
| 332 | virtual ~QSGNodeVisitor(); | - | 
| 333 | - | |
| 334 | protected: | - | 
| 335 | virtual void enterTransformNode(QSGTransformNode *) {} | - | 
| 336 | virtual void leaveTransformNode(QSGTransformNode *) {} | - | 
| 337 | virtual void enterClipNode(QSGClipNode *) {} | - | 
| 338 | virtual void leaveClipNode(QSGClipNode *) {} | - | 
| 339 | virtual void enterGeometryNode(QSGGeometryNode *) {} | - | 
| 340 | virtual void leaveGeometryNode(QSGGeometryNode *) {} | - | 
| 341 | virtual void enterOpacityNode(QSGOpacityNode *) {} | - | 
| 342 | virtual void leaveOpacityNode(QSGOpacityNode *) {} | - | 
| 343 | virtual void visitNode(QSGNode *n); | - | 
| 344 | virtual void visitChildren(QSGNode *n); | - | 
| 345 | }; | - | 
| 346 | - | |
| 347 | #ifndef QT_NO_DEBUG_STREAM | - | 
| 348 | Q_QUICK_EXPORT QDebug operator<<(QDebug, const QSGNode *n); | - | 
| 349 | Q_QUICK_EXPORT QDebug operator<<(QDebug, const QSGGeometryNode *n); | - | 
| 350 | Q_QUICK_EXPORT QDebug operator<<(QDebug, const QSGTransformNode *n); | - | 
| 351 | Q_QUICK_EXPORT QDebug operator<<(QDebug, const QSGOpacityNode *n); | - | 
| 352 | Q_QUICK_EXPORT QDebug operator<<(QDebug, const QSGRootNode *n); | - | 
| 353 | - | |
| 354 | #endif | - | 
| 355 | - | |
| 356 | Q_DECLARE_OPERATORS_FOR_FLAGS(QSGNode::DirtyState) | - | 
| 357 | Q_DECLARE_OPERATORS_FOR_FLAGS(QSGNode::Flags) | - | 
| 358 | - | |
| 359 | QT_END_NAMESPACE | - | 
| 360 | - | |
| 361 | #endif // QSGNODE_H | - | 
| Source code | Switch to Preprocessed file |