| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/util/qsgtexturematerial.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | inline static bool isPowerOfTwo(int x) | - | ||||||||||||
| 8 | { | - | ||||||||||||
| 9 | - | |||||||||||||
| 10 | return never executed: x == (x & -x);return x == (x & -x);never executed: return x == (x & -x); | 0 | ||||||||||||
| 11 | } | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | - | |||||||||||||
| 14 | QSGMaterialType QSGOpaqueTextureMaterialShader::type; | - | ||||||||||||
| 15 | - | |||||||||||||
| 16 | QSGOpaqueTextureMaterialShader::QSGOpaqueTextureMaterialShader() | - | ||||||||||||
| 17 | { | - | ||||||||||||
| 18 | - | |||||||||||||
| 19 | setShaderSourceFile(QOpenGLShader::Vertex, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/opaquetexture.vert")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/opaquetexture.vert" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 203 times by 12 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 203 times by 12 tests: }()));return qstring_literal_temp;Executed by:
| 203 | ||||||||||||
| 20 | setShaderSourceFile(QOpenGLShader::Fragment, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/opaquetexture.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/opaquetexture.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 203 times by 12 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 203 times by 12 tests: }()));return qstring_literal_temp;Executed by:
| 203 | ||||||||||||
| 21 | - | |||||||||||||
| 22 | } executed 203 times by 12 tests: end of blockExecuted by:
| 203 | ||||||||||||
| 23 | - | |||||||||||||
| 24 | char const *const *QSGOpaqueTextureMaterialShader::attributeNames() const | - | ||||||||||||
| 25 | { | - | ||||||||||||
| 26 | static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", nullptr }; | - | ||||||||||||
| 27 | return executed 24511 times by 12 tests: attr;return attr;Executed by:
executed 24511 times by 12 tests: return attr;Executed by:
| 24511 | ||||||||||||
| 28 | } | - | ||||||||||||
| 29 | - | |||||||||||||
| 30 | void QSGOpaqueTextureMaterialShader::initialize() | - | ||||||||||||
| 31 | { | - | ||||||||||||
| 32 | - | |||||||||||||
| 33 | m_matrix_id = program()->uniformLocation("qt_Matrix"); | - | ||||||||||||
| 34 | - | |||||||||||||
| 35 | } executed 203 times by 12 tests: end of blockExecuted by:
| 203 | ||||||||||||
| 36 | - | |||||||||||||
| 37 | void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) | - | ||||||||||||
| 38 | { | - | ||||||||||||
| 39 | ((oldEffect == nullptr || newEffect->type() == oldEffect->type()) ? static_cast<void>(0) : qt_assert("oldEffect == nullptr || newEffect->type() == oldEffect->type()", __FILE__, 82)); | - | ||||||||||||
| 40 | QSGOpaqueTextureMaterial *tx = static_cast<QSGOpaqueTextureMaterial *>(newEffect); | - | ||||||||||||
| 41 | QSGOpaqueTextureMaterial *oldTx = static_cast<QSGOpaqueTextureMaterial *>(oldEffect); | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | QSGTexture *t = tx->texture(); | - | ||||||||||||
| 44 | - | |||||||||||||
| 45 | - | |||||||||||||
| 46 | if (!qsg_safeguard_texture(t)
| 0-20802 | ||||||||||||
| 47 | return; never executed: return; | 0 | ||||||||||||
| 48 | - | |||||||||||||
| 49 | - | |||||||||||||
| 50 | t->setFiltering(tx->filtering()); | - | ||||||||||||
| 51 | - | |||||||||||||
| 52 | t->setHorizontalWrapMode(tx->horizontalWrapMode()); | - | ||||||||||||
| 53 | t->setVerticalWrapMode(tx->verticalWrapMode()); | - | ||||||||||||
| 54 | - | |||||||||||||
| 55 | bool npotSupported = const_cast<QOpenGLContext *>(state.context()) | - | ||||||||||||
| 56 | ->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat); | - | ||||||||||||
| 57 | if (!npotSupported
| 0-20802 | ||||||||||||
| 58 | QSize size = t->textureSize(); | - | ||||||||||||
| 59 | const bool isNpot = !isPowerOfTwo(size.width())
| 0 | ||||||||||||
| 60 | if (isNpot
| 0 | ||||||||||||
| 61 | t->setHorizontalWrapMode(QSGTexture::ClampToEdge); | - | ||||||||||||
| 62 | t->setVerticalWrapMode(QSGTexture::ClampToEdge); | - | ||||||||||||
| 63 | } never executed: end of block | 0 | ||||||||||||
| 64 | } never executed: end of block | 0 | ||||||||||||
| 65 | - | |||||||||||||
| 66 | - | |||||||||||||
| 67 | - | |||||||||||||
| 68 | t->setMipmapFiltering(tx->mipmapFiltering()); | - | ||||||||||||
| 69 | t->setAnisotropyLevel(tx->anisotropyLevel()); | - | ||||||||||||
| 70 | - | |||||||||||||
| 71 | if (oldTx == nullptr
| 260-19049 | ||||||||||||
| 72 | t->bind(); executed 2013 times by 12 tests: t->bind();Executed by:
| 2013 | ||||||||||||
| 73 | else | - | ||||||||||||
| 74 | t->updateBindOptions(); executed 18789 times by 3 tests: t->updateBindOptions();Executed by:
| 18789 | ||||||||||||
| 75 | - | |||||||||||||
| 76 | if (state.isMatrixDirty()
| 0-20802 | ||||||||||||
| 77 | program()->setUniformValue(m_matrix_id, state.combinedMatrix()); executed 20802 times by 12 tests: program()->setUniformValue(m_matrix_id, state.combinedMatrix());Executed by:
| 20802 | ||||||||||||
| 78 | - | |||||||||||||
| 79 | } executed 20802 times by 12 tests: end of blockExecuted by:
| 20802 | ||||||||||||
| 80 | QSGOpaqueTextureMaterial::QSGOpaqueTextureMaterial() | - | ||||||||||||
| 81 | : m_texture(nullptr) | - | ||||||||||||
| 82 | , m_filtering(QSGTexture::Nearest) | - | ||||||||||||
| 83 | , m_mipmap_filtering(QSGTexture::None) | - | ||||||||||||
| 84 | , m_horizontal_wrap(QSGTexture::ClampToEdge) | - | ||||||||||||
| 85 | , m_vertical_wrap(QSGTexture::ClampToEdge) | - | ||||||||||||
| 86 | , m_anisotropy_level(QSGTexture::AnisotropyNone) | - | ||||||||||||
| 87 | { | - | ||||||||||||
| 88 | } executed 15635 times by 13 tests: end of blockExecuted by:
| 15635 | ||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | - | |||||||||||||
| 92 | - | |||||||||||||
| 93 | - | |||||||||||||
| 94 | QSGMaterialType *QSGOpaqueTextureMaterial::type() const | - | ||||||||||||
| 95 | { | - | ||||||||||||
| 96 | return executed 95881 times by 12 tests: &QSGOpaqueTextureMaterialShader::type;return &QSGOpaqueTextureMaterialShader::type;Executed by:
executed 95881 times by 12 tests: return &QSGOpaqueTextureMaterialShader::type;Executed by:
| 95881 | ||||||||||||
| 97 | } | - | ||||||||||||
| 98 | - | |||||||||||||
| 99 | - | |||||||||||||
| 100 | - | |||||||||||||
| 101 | - | |||||||||||||
| 102 | QSGMaterialShader *QSGOpaqueTextureMaterial::createShader() const | - | ||||||||||||
| 103 | { | - | ||||||||||||
| 104 | return executed 187 times by 12 tests: new QSGOpaqueTextureMaterialShader;return new QSGOpaqueTextureMaterialShader;Executed by:
executed 187 times by 12 tests: return new QSGOpaqueTextureMaterialShader;Executed by:
| 187 | ||||||||||||
| 105 | } | - | ||||||||||||
| 106 | void QSGOpaqueTextureMaterial::setTexture(QSGTexture *texture) | - | ||||||||||||
| 107 | { | - | ||||||||||||
| 108 | m_texture = texture; | - | ||||||||||||
| 109 | setFlag(Blending, m_texture ? m_texture->hasAlphaChannel() : false); | - | ||||||||||||
| 110 | } executed 10610 times by 13 tests: end of blockExecuted by:
| 10610 | ||||||||||||
| 111 | int QSGOpaqueTextureMaterial::compare(const QSGMaterial *o) const | - | ||||||||||||
| 112 | { | - | ||||||||||||
| 113 | ((o && type() == o->type()) ? static_cast<void>(0) : qt_assert("o && type() == o->type()", __FILE__, 324)); | - | ||||||||||||
| 114 | const QSGOpaqueTextureMaterial *other = static_cast<const QSGOpaqueTextureMaterial *>(o); | - | ||||||||||||
| 115 | if (int diff = m_texture->textureId() - other->texture()->textureId()
| 270-24420 | ||||||||||||
| 116 | return executed 270 times by 4 tests: diff;return diff;Executed by:
executed 270 times by 4 tests: return diff;Executed by:
| 270 | ||||||||||||
| 117 | return executed 24420 times by 3 tests: int(m_filtering) - int(other->m_filtering);return int(m_filtering) - int(other->m_filtering);Executed by:
executed 24420 times by 3 tests: return int(m_filtering) - int(other->m_filtering);Executed by:
| 24420 | ||||||||||||
| 118 | } | - | ||||||||||||
| 119 | QSGMaterialType QSGTextureMaterialShader::type; | - | ||||||||||||
| 120 | - | |||||||||||||
| 121 | - | |||||||||||||
| 122 | - | |||||||||||||
| 123 | - | |||||||||||||
| 124 | - | |||||||||||||
| 125 | - | |||||||||||||
| 126 | - | |||||||||||||
| 127 | QSGMaterialType *QSGTextureMaterial::type() const | - | ||||||||||||
| 128 | { | - | ||||||||||||
| 129 | return executed 98909 times by 5 tests: &QSGTextureMaterialShader::type;return &QSGTextureMaterialShader::type;Executed by:
executed 98909 times by 5 tests: return &QSGTextureMaterialShader::type;Executed by:
| 98909 | ||||||||||||
| 130 | } | - | ||||||||||||
| 131 | - | |||||||||||||
| 132 | - | |||||||||||||
| 133 | - | |||||||||||||
| 134 | - | |||||||||||||
| 135 | - | |||||||||||||
| 136 | - | |||||||||||||
| 137 | - | |||||||||||||
| 138 | QSGMaterialShader *QSGTextureMaterial::createShader() const | - | ||||||||||||
| 139 | { | - | ||||||||||||
| 140 | return executed 16 times by 5 tests: new QSGTextureMaterialShader;return new QSGTextureMaterialShader;Executed by:
executed 16 times by 5 tests: return new QSGTextureMaterialShader;Executed by:
| 16 | ||||||||||||
| 141 | } | - | ||||||||||||
| 142 | - | |||||||||||||
| 143 | QSGTextureMaterialShader::QSGTextureMaterialShader() | - | ||||||||||||
| 144 | : QSGOpaqueTextureMaterialShader() | - | ||||||||||||
| 145 | { | - | ||||||||||||
| 146 | - | |||||||||||||
| 147 | setShaderSourceFile(QOpenGLShader::Fragment, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/texture.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/texture.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 16 times by 5 tests: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 16 times by 5 tests: }()));return qstring_literal_temp;Executed by:
| 16 | ||||||||||||
| 148 | - | |||||||||||||
| 149 | } executed 16 times by 5 tests: end of blockExecuted by:
| 16 | ||||||||||||
| 150 | - | |||||||||||||
| 151 | void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) | - | ||||||||||||
| 152 | { | - | ||||||||||||
| 153 | ((oldEffect == nullptr || newEffect->type() == oldEffect->type()) ? static_cast<void>(0) : qt_assert("oldEffect == nullptr || newEffect->type() == oldEffect->type()", __FILE__, 400)); | - | ||||||||||||
| 154 | - | |||||||||||||
| 155 | if (state.isOpacityDirty()
| 181-18968 | ||||||||||||
| 156 | program()->setUniformValue(m_opacity_id, state.opacity()); executed 18968 times by 5 tests: program()->setUniformValue(m_opacity_id, state.opacity());Executed by:
| 18968 | ||||||||||||
| 157 | - | |||||||||||||
| 158 | QSGOpaqueTextureMaterialShader::updateState(state, newEffect, oldEffect); | - | ||||||||||||
| 159 | } executed 19149 times by 5 tests: end of blockExecuted by:
| 19149 | ||||||||||||
| 160 | - | |||||||||||||
| 161 | void QSGTextureMaterialShader::initialize() | - | ||||||||||||
| 162 | { | - | ||||||||||||
| 163 | QSGOpaqueTextureMaterialShader::initialize(); | - | ||||||||||||
| 164 | - | |||||||||||||
| 165 | m_opacity_id = program()->uniformLocation("opacity"); | - | ||||||||||||
| 166 | - | |||||||||||||
| 167 | } executed 16 times by 5 tests: end of blockExecuted by:
| 16 | ||||||||||||
| 168 | - | |||||||||||||
| 169 | - | |||||||||||||
| Switch to Source code | Preprocessed file |