| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/util/qsgsimpletexturenode.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | class QSGSimpleTextureNodePrivate : public QSGGeometryNodePrivate | - | ||||||||||||
| 5 | { | - | ||||||||||||
| 6 | public: | - | ||||||||||||
| 7 | QSGSimpleTextureNodePrivate() | - | ||||||||||||
| 8 | : texCoordMode(QSGSimpleTextureNode::NoTransform) | - | ||||||||||||
| 9 | , isAtlasTexture(false) | - | ||||||||||||
| 10 | , ownsTexture(false) | - | ||||||||||||
| 11 | {} executed 18 times by 2 tests: end of blockExecuted by:
| 18 | ||||||||||||
| 12 | - | |||||||||||||
| 13 | QRectF sourceRect; | - | ||||||||||||
| 14 | QSGSimpleTextureNode::TextureCoordinatesTransformMode texCoordMode; | - | ||||||||||||
| 15 | uint isAtlasTexture : 1; | - | ||||||||||||
| 16 | uint ownsTexture : 1; | - | ||||||||||||
| 17 | }; | - | ||||||||||||
| 18 | - | |||||||||||||
| 19 | static void qsgsimpletexturenode_update(QSGGeometry *g, | - | ||||||||||||
| 20 | QSGTexture *texture, | - | ||||||||||||
| 21 | const QRectF &rect, | - | ||||||||||||
| 22 | QRectF sourceRect, | - | ||||||||||||
| 23 | QSGSimpleTextureNode::TextureCoordinatesTransformMode texCoordMode) | - | ||||||||||||
| 24 | { | - | ||||||||||||
| 25 | if (!texture
| 0-56 | ||||||||||||
| 26 | return; never executed: return; | 0 | ||||||||||||
| 27 | - | |||||||||||||
| 28 | if (!sourceRect.width()
| 0-52 | ||||||||||||
| 29 | QSize ts = texture->textureSize(); | - | ||||||||||||
| 30 | sourceRect = QRectF(0, 0, ts.width(), ts.height()); | - | ||||||||||||
| 31 | } executed 52 times by 2 tests: end of blockExecuted by:
| 52 | ||||||||||||
| 32 | - | |||||||||||||
| 33 | - | |||||||||||||
| 34 | if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorHorizontally)
| 0-56 | ||||||||||||
| 35 | float tmp = sourceRect.left(); | - | ||||||||||||
| 36 | sourceRect.setLeft(sourceRect.right()); | - | ||||||||||||
| 37 | sourceRect.setRight(tmp); | - | ||||||||||||
| 38 | } never executed: end of block | 0 | ||||||||||||
| 39 | if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorVertically)
| 0-56 | ||||||||||||
| 40 | float tmp = sourceRect.top(); | - | ||||||||||||
| 41 | sourceRect.setTop(sourceRect.bottom()); | - | ||||||||||||
| 42 | sourceRect.setBottom(tmp); | - | ||||||||||||
| 43 | } never executed: end of block | 0 | ||||||||||||
| 44 | - | |||||||||||||
| 45 | QSGGeometry::updateTexturedRectGeometry(g, rect, texture->convertToNormalizedSourceRect(sourceRect)); | - | ||||||||||||
| 46 | } executed 56 times by 2 tests: end of blockExecuted by:
| 56 | ||||||||||||
| 47 | QSGSimpleTextureNode::QSGSimpleTextureNode() | - | ||||||||||||
| 48 | : QSGGeometryNode(*new QSGSimpleTextureNodePrivate) | - | ||||||||||||
| 49 | , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) | - | ||||||||||||
| 50 | { | - | ||||||||||||
| 51 | setGeometry(&m_geometry); | - | ||||||||||||
| 52 | setMaterial(&m_material); | - | ||||||||||||
| 53 | setOpaqueMaterial(&m_opaque_material); | - | ||||||||||||
| 54 | m_material.setMipmapFiltering(QSGTexture::None); | - | ||||||||||||
| 55 | m_opaque_material.setMipmapFiltering(QSGTexture::None); | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | qsgnode_set_description(this, QLatin1String("simpletexture")); | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | } executed 18 times by 2 tests: end of blockExecuted by:
| 18 | ||||||||||||
| 60 | - | |||||||||||||
| 61 | - | |||||||||||||
| 62 | - | |||||||||||||
| 63 | - | |||||||||||||
| 64 | QSGSimpleTextureNode::~QSGSimpleTextureNode() | - | ||||||||||||
| 65 | { | - | ||||||||||||
| 66 | QSGSimpleTextureNodePrivate * const d = d_func(); | - | ||||||||||||
| 67 | if (d->ownsTexture
| 4-14 | ||||||||||||
| 68 | delete m_material.texture(); executed 4 times by 1 test: delete m_material.texture();Executed by:
| 4 | ||||||||||||
| 69 | } executed 18 times by 2 tests: end of blockExecuted by:
| 18 | ||||||||||||
| 70 | - | |||||||||||||
| 71 | - | |||||||||||||
| 72 | - | |||||||||||||
| 73 | - | |||||||||||||
| 74 | - | |||||||||||||
| 75 | - | |||||||||||||
| 76 | - | |||||||||||||
| 77 | void QSGSimpleTextureNode::setFiltering(QSGTexture::Filtering filtering) | - | ||||||||||||
| 78 | { | - | ||||||||||||
| 79 | if (m_material.filtering() == filtering
| 10 | ||||||||||||
| 80 | return; executed 10 times by 1 test: return;Executed by:
| 10 | ||||||||||||
| 81 | - | |||||||||||||
| 82 | m_material.setFiltering(filtering); | - | ||||||||||||
| 83 | m_opaque_material.setFiltering(filtering); | - | ||||||||||||
| 84 | markDirty(DirtyMaterial); | - | ||||||||||||
| 85 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||
| 86 | - | |||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | QSGTexture::Filtering QSGSimpleTextureNode::filtering() const | - | ||||||||||||
| 92 | { | - | ||||||||||||
| 93 | return never executed: m_material.filtering();return m_material.filtering();never executed: return m_material.filtering(); | 0 | ||||||||||||
| 94 | } | - | ||||||||||||
| 95 | - | |||||||||||||
| 96 | - | |||||||||||||
| 97 | - | |||||||||||||
| 98 | - | |||||||||||||
| 99 | - | |||||||||||||
| 100 | void QSGSimpleTextureNode::setRect(const QRectF &r) | - | ||||||||||||
| 101 | { | - | ||||||||||||
| 102 | if (m_rect == r
| 2-22 | ||||||||||||
| 103 | return; executed 2 times by 1 test: return;Executed by:
| 2 | ||||||||||||
| 104 | m_rect = r; | - | ||||||||||||
| 105 | QSGSimpleTextureNodePrivate * const d = d_func(); | - | ||||||||||||
| 106 | qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode); | - | ||||||||||||
| 107 | markDirty(DirtyGeometry); | - | ||||||||||||
| 108 | } executed 22 times by 2 tests: end of blockExecuted by:
| 22 | ||||||||||||
| 109 | QRectF QSGSimpleTextureNode::rect() const | - | ||||||||||||
| 110 | { | - | ||||||||||||
| 111 | return never executed: m_rect;return m_rect;never executed: return m_rect; | 0 | ||||||||||||
| 112 | } | - | ||||||||||||
| 113 | - | |||||||||||||
| 114 | - | |||||||||||||
| 115 | - | |||||||||||||
| 116 | - | |||||||||||||
| 117 | - | |||||||||||||
| 118 | - | |||||||||||||
| 119 | void QSGSimpleTextureNode::setSourceRect(const QRectF &r) | - | ||||||||||||
| 120 | { | - | ||||||||||||
| 121 | QSGSimpleTextureNodePrivate * const d = d_func(); | - | ||||||||||||
| 122 | if (d->sourceRect == r
| 0-4 | ||||||||||||
| 123 | return; never executed: return; | 0 | ||||||||||||
| 124 | d->sourceRect = r; | - | ||||||||||||
| 125 | qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode); | - | ||||||||||||
| 126 | markDirty(DirtyGeometry); | - | ||||||||||||
| 127 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 128 | QRectF QSGSimpleTextureNode::sourceRect() const | - | ||||||||||||
| 129 | { | - | ||||||||||||
| 130 | const QSGSimpleTextureNodePrivate * const d = d_func(); | - | ||||||||||||
| 131 | return never executed: d->sourceRect;return d->sourceRect;never executed: return d->sourceRect; | 0 | ||||||||||||
| 132 | } | - | ||||||||||||
| 133 | void QSGSimpleTextureNode::setTexture(QSGTexture *texture) | - | ||||||||||||
| 134 | { | - | ||||||||||||
| 135 | ((texture) ? static_cast<void>(0) : qt_assert("texture", __FILE__, 237)); | - | ||||||||||||
| 136 | QSGSimpleTextureNodePrivate * const d = d_func(); | - | ||||||||||||
| 137 | if (d->ownsTexture
| 6-24 | ||||||||||||
| 138 | delete m_material.texture(); executed 6 times by 1 test: delete m_material.texture();Executed by:
| 6 | ||||||||||||
| 139 | m_material.setTexture(texture); | - | ||||||||||||
| 140 | m_opaque_material.setTexture(texture); | - | ||||||||||||
| 141 | qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->sourceRect, d->texCoordMode); | - | ||||||||||||
| 142 | - | |||||||||||||
| 143 | DirtyState dirty = DirtyMaterial; | - | ||||||||||||
| 144 | - | |||||||||||||
| 145 | - | |||||||||||||
| 146 | - | |||||||||||||
| 147 | bool wasAtlas = d->isAtlasTexture; | - | ||||||||||||
| 148 | d->isAtlasTexture = texture->isAtlasTexture(); | - | ||||||||||||
| 149 | if (wasAtlas
| 0-30 | ||||||||||||
| 150 | dirty |= DirtyGeometry; never executed: dirty |= DirtyGeometry; | 0 | ||||||||||||
| 151 | markDirty(dirty); | - | ||||||||||||
| 152 | } executed 30 times by 2 tests: end of blockExecuted by:
| 30 | ||||||||||||
| 153 | - | |||||||||||||
| 154 | - | |||||||||||||
| 155 | - | |||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | - | |||||||||||||
| 159 | QSGTexture *QSGSimpleTextureNode::texture() const | - | ||||||||||||
| 160 | { | - | ||||||||||||
| 161 | return executed 46 times by 2 tests: m_material.texture();return m_material.texture();Executed by:
executed 46 times by 2 tests: return m_material.texture();Executed by:
| 46 | ||||||||||||
| 162 | } | - | ||||||||||||
| 163 | void QSGSimpleTextureNode::setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode) | - | ||||||||||||
| 164 | { | - | ||||||||||||
| 165 | QSGSimpleTextureNodePrivate * const d = d_func(); | - | ||||||||||||
| 166 | if (d->texCoordMode == mode
| 0-20 | ||||||||||||
| 167 | return; executed 20 times by 1 test: return;Executed by:
| 20 | ||||||||||||
| 168 | d->texCoordMode = mode; | - | ||||||||||||
| 169 | qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode); | - | ||||||||||||
| 170 | markDirty(DirtyMaterial); | - | ||||||||||||
| 171 | } never executed: end of block | 0 | ||||||||||||
| 172 | - | |||||||||||||
| 173 | - | |||||||||||||
| 174 | - | |||||||||||||
| 175 | - | |||||||||||||
| 176 | - | |||||||||||||
| 177 | - | |||||||||||||
| 178 | QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode::textureCoordinatesTransform() const | - | ||||||||||||
| 179 | { | - | ||||||||||||
| 180 | const QSGSimpleTextureNodePrivate * const d = d_func(); | - | ||||||||||||
| 181 | return never executed: d->texCoordMode;return d->texCoordMode;never executed: return d->texCoordMode; | 0 | ||||||||||||
| 182 | } | - | ||||||||||||
| 183 | void QSGSimpleTextureNode::setOwnsTexture(bool owns) | - | ||||||||||||
| 184 | { | - | ||||||||||||
| 185 | QSGSimpleTextureNodePrivate * const d = d_func(); | - | ||||||||||||
| 186 | d->ownsTexture = owns; | - | ||||||||||||
| 187 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 188 | - | |||||||||||||
| 189 | - | |||||||||||||
| 190 | - | |||||||||||||
| 191 | - | |||||||||||||
| 192 | - | |||||||||||||
| 193 | - | |||||||||||||
| 194 | bool QSGSimpleTextureNode::ownsTexture() const | - | ||||||||||||
| 195 | { | - | ||||||||||||
| 196 | const QSGSimpleTextureNodePrivate * const d = d_func(); | - | ||||||||||||
| 197 | return executed 6 times by 1 test: d->ownsTexture;return d->ownsTexture;Executed by:
executed 6 times by 1 test: return d->ownsTexture;Executed by:
| 6 | ||||||||||||
| 198 | } | - | ||||||||||||
| 199 | - | |||||||||||||
| 200 | - | |||||||||||||
| Switch to Source code | Preprocessed file |