| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/coreapi/qsgmaterial.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 QSGMATERIAL_H | - |
| 41 | #define QSGMATERIAL_H | - |
| 42 | - | |
| 43 | #include <QtQuick/qtquickglobal.h> | - |
| 44 | #if QT_CONFIG(opengl) | - |
| 45 | # include <QtGui/qopenglshaderprogram.h> | - |
| 46 | #endif | - |
| 47 | #include <QtGui/QMatrix4x4> | - |
| 48 | #include <QtCore/QRect> | - |
| 49 | - | |
| 50 | QT_BEGIN_NAMESPACE | - |
| 51 | - | |
| 52 | class QSGMaterial; | - |
| 53 | class QSGMaterialShaderPrivate; | - |
| 54 | - | |
| 55 | namespace QSGBatchRenderer { | - |
| 56 | class ShaderManager; | - |
| 57 | } | - |
| 58 | - | |
| 59 | class Q_QUICK_EXPORT QSGMaterialShader | - |
| 60 | { | - |
| 61 | public: | - |
| 62 | class Q_QUICK_EXPORT RenderState { | - |
| 63 | public: | - |
| 64 | enum DirtyState | - |
| 65 | { | - |
| 66 | DirtyMatrix = 0x0001, | - |
| 67 | DirtyOpacity = 0x0002, | - |
| 68 | DirtyCachedMaterialData = 0x0004, | - |
| 69 | DirtyAll = 0xFFFF | - |
| 70 | }; | - |
| 71 | Q_DECLARE_FLAGS(DirtyStates, DirtyState) | - |
| 72 | - | |
| 73 | inline DirtyStates dirtyStates() const { return m_dirty; } never executed: return m_dirty; | 0 |
| 74 | - | |
| 75 | inline bool isMatrixDirty() const { return m_dirty & DirtyMatrix; } executed 120239 times by 71 tests: return m_dirty & DirtyMatrix;Executed by:
| 120239 |
| 76 | inline bool isOpacityDirty() const { return m_dirty & DirtyOpacity; } executed 81130 times by 67 tests: return m_dirty & DirtyOpacity;Executed by:
| 81130 |
| 77 | bool isCachedMaterialDataDirty() const { return m_dirty & DirtyCachedMaterialData; } never executed: return m_dirty & DirtyCachedMaterialData; | 0 |
| 78 | - | |
| 79 | float opacity() const; | - |
| 80 | QMatrix4x4 combinedMatrix() const; | - |
| 81 | QMatrix4x4 modelViewMatrix() const; | - |
| 82 | QMatrix4x4 projectionMatrix() const; | - |
| 83 | QRect viewportRect() const; | - |
| 84 | QRect deviceRect() const; | - |
| 85 | float determinant() const; | - |
| 86 | float devicePixelRatio() const; | - |
| 87 | #if QT_CONFIG(opengl) | - |
| 88 | QOpenGLContext *context() const; | - |
| 89 | #endif | - |
| 90 | private: | - |
| 91 | friend class QSGRenderer; | - |
| 92 | DirtyStates m_dirty; | - |
| 93 | const void *m_data; | - |
| 94 | }; | - |
| 95 | - | |
| 96 | QSGMaterialShader(); | - |
| 97 | virtual ~QSGMaterialShader(); | - |
| 98 | - | |
| 99 | virtual void activate(); | - |
| 100 | virtual void deactivate(); | - |
| 101 | // First time a material is used, oldMaterial is null. | - |
| 102 | virtual void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); | - |
| 103 | virtual char const *const *attributeNames() const = 0; // Array must end with null. | - |
| 104 | #if QT_CONFIG(opengl) | - |
| 105 | inline QOpenGLShaderProgram *program() { return &m_program; } executed 356192 times by 71 tests: return &m_program;Executed by:
| 356192 |
| 106 | #endif | - |
| 107 | protected: | - |
| 108 | Q_DECLARE_PRIVATE(QSGMaterialShader) executed 11936 times by 71 tests: return reinterpret_cast<QSGMaterialShaderPrivate *>(qGetPtrHelper(d_ptr));Executed by:
executed 8806 times by 71 tests: return reinterpret_cast<const QSGMaterialShaderPrivate *>(qGetPtrHelper(d_ptr));Executed by:
| 8806-11936 |
| 109 | QSGMaterialShader(QSGMaterialShaderPrivate &dd); | - |
| 110 | - | |
| 111 | friend class QSGDefaultRenderContext; | - |
| 112 | friend class QSGBatchRenderer::ShaderManager; | - |
| 113 | #if QT_CONFIG(opengl) | - |
| 114 | void setShaderSourceFile(QOpenGLShader::ShaderType type, const QString &sourceFile); | - |
| 115 | void setShaderSourceFiles(QOpenGLShader::ShaderType type, const QStringList &sourceFiles); | - |
| 116 | - | |
| 117 | virtual void compile(); | - |
| 118 | #endif | - |
| 119 | virtual void initialize() { } | - |
| 120 | #if QT_CONFIG(opengl) | - |
| 121 | virtual const char *vertexShader() const; | - |
| 122 | virtual const char *fragmentShader() const; | - |
| 123 | #endif | - |
| 124 | private: | - |
| 125 | #if QT_CONFIG(opengl) | - |
| 126 | QOpenGLShaderProgram m_program; | - |
| 127 | #endif | - |
| 128 | QScopedPointer<QSGMaterialShaderPrivate> d_ptr; | - |
| 129 | }; | - |
| 130 | - | |
| 131 | struct QSGMaterialType { }; | - |
| 132 | - | |
| 133 | class Q_QUICK_EXPORT QSGMaterial | - |
| 134 | { | - |
| 135 | public: | - |
| 136 | enum Flag { | - |
| 137 | Blending = 0x0001, | - |
| 138 | RequiresDeterminant = 0x0002, // Allow precalculated translation and 2D rotation | - |
| 139 | RequiresFullMatrixExceptTranslate = 0x0004 | RequiresDeterminant, // Allow precalculated translation | - |
| 140 | RequiresFullMatrix = 0x0008 | RequiresFullMatrixExceptTranslate, | - |
| 141 | - | |
| 142 | CustomCompileStep = 0x0010 | - |
| 143 | }; | - |
| 144 | Q_DECLARE_FLAGS(Flags, Flag) | - |
| 145 | - | |
| 146 | QSGMaterial(); | - |
| 147 | virtual ~QSGMaterial(); | - |
| 148 | - | |
| 149 | virtual QSGMaterialType *type() const = 0; | - |
| 150 | virtual QSGMaterialShader *createShader() const = 0; | - |
| 151 | virtual int compare(const QSGMaterial *other) const; | - |
| 152 | - | |
| 153 | QSGMaterial::Flags flags() const { return m_flags; } executed 2006535 times by 72 tests: return m_flags;Executed by:
| 2006535 |
| 154 | void setFlag(Flags flags, bool on = true); | - |
| 155 | - | |
| 156 | private: | - |
| 157 | Flags m_flags; | - |
| 158 | void *m_reserved; | - |
| 159 | Q_DISABLE_COPY(QSGMaterial) | - |
| 160 | }; | - |
| 161 | - | |
| 162 | Q_DECLARE_OPERATORS_FOR_FLAGS(QSGMaterial::Flags) | - |
| 163 | Q_DECLARE_OPERATORS_FOR_FLAGS(QSGMaterialShader::RenderState::DirtyStates) | - |
| 164 | - | |
| 165 | QT_END_NAMESPACE | - |
| 166 | - | |
| 167 | #endif | - |
| Source code | Switch to Preprocessed file |