| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | class SmoothTextureMaterialShader : public QSGTextureMaterialShader | - | ||||||||||||
| 5 | { | - | ||||||||||||
| 6 | public: | - | ||||||||||||
| 7 | SmoothTextureMaterialShader(); | - | ||||||||||||
| 8 | - | |||||||||||||
| 9 | void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; | - | ||||||||||||
| 10 | char const *const *attributeNames() const override; | - | ||||||||||||
| 11 | - | |||||||||||||
| 12 | protected: | - | ||||||||||||
| 13 | void initialize() override; | - | ||||||||||||
| 14 | - | |||||||||||||
| 15 | int m_pixelSizeLoc; | - | ||||||||||||
| 16 | }; | - | ||||||||||||
| 17 | - | |||||||||||||
| 18 | - | |||||||||||||
| 19 | QSGSmoothTextureMaterial::QSGSmoothTextureMaterial() | - | ||||||||||||
| 20 | { | - | ||||||||||||
| 21 | setFlag(RequiresFullMatrixExceptTranslate, true); | - | ||||||||||||
| 22 | setFlag(Blending, true); | - | ||||||||||||
| 23 | } executed 5189 times by 10 tests: end of blockExecuted by:
| 5189 | ||||||||||||
| 24 | - | |||||||||||||
| 25 | void QSGSmoothTextureMaterial::setTexture(QSGTexture *texture) | - | ||||||||||||
| 26 | { | - | ||||||||||||
| 27 | m_texture = texture; | - | ||||||||||||
| 28 | } executed 5245 times by 10 tests: end of blockExecuted by:
| 5245 | ||||||||||||
| 29 | - | |||||||||||||
| 30 | QSGMaterialType *QSGSmoothTextureMaterial::type() const | - | ||||||||||||
| 31 | { | - | ||||||||||||
| 32 | static QSGMaterialType type; | - | ||||||||||||
| 33 | return never executed: &type;return &type;never executed: return &type; | 0 | ||||||||||||
| 34 | } | - | ||||||||||||
| 35 | - | |||||||||||||
| 36 | QSGMaterialShader *QSGSmoothTextureMaterial::createShader() const | - | ||||||||||||
| 37 | { | - | ||||||||||||
| 38 | return never executed: new SmoothTextureMaterialShader;return new SmoothTextureMaterialShader;never executed: return new SmoothTextureMaterialShader; | 0 | ||||||||||||
| 39 | } | - | ||||||||||||
| 40 | - | |||||||||||||
| 41 | SmoothTextureMaterialShader::SmoothTextureMaterialShader() | - | ||||||||||||
| 42 | { | - | ||||||||||||
| 43 | setShaderSourceFile(QOpenGLShader::Vertex, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/smoothtexture.vert")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/smoothtexture.vert" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||
| 44 | setShaderSourceFile(QOpenGLShader::Fragment, ([]() noexcept -> QString { enum { Size = sizeof(u"" ":/qt-project.org/scenegraph/shaders/smoothtexture.frag")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/scenegraph/shaders/smoothtexture.frag" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||
| 45 | } never executed: end of block | 0 | ||||||||||||
| 46 | - | |||||||||||||
| 47 | void SmoothTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) | - | ||||||||||||
| 48 | { | - | ||||||||||||
| 49 | if (oldEffect == nullptr
| 0 | ||||||||||||
| 50 | - | |||||||||||||
| 51 | QRect r = state.viewportRect(); | - | ||||||||||||
| 52 | program()->setUniformValue(m_pixelSizeLoc, 2.0f / r.width(), 2.0f / r.height()); | - | ||||||||||||
| 53 | } never executed: end of block | 0 | ||||||||||||
| 54 | QSGTextureMaterialShader::updateState(state, newEffect, oldEffect); | - | ||||||||||||
| 55 | } never executed: end of block | 0 | ||||||||||||
| 56 | - | |||||||||||||
| 57 | char const *const *SmoothTextureMaterialShader::attributeNames() const | - | ||||||||||||
| 58 | { | - | ||||||||||||
| 59 | static char const *const attributes[] = { | - | ||||||||||||
| 60 | "vertex", | - | ||||||||||||
| 61 | "multiTexCoord", | - | ||||||||||||
| 62 | "vertexOffset", | - | ||||||||||||
| 63 | "texCoordOffset", | - | ||||||||||||
| 64 | nullptr | - | ||||||||||||
| 65 | }; | - | ||||||||||||
| 66 | return never executed: attributes;return attributes;never executed: return attributes; | 0 | ||||||||||||
| 67 | } | - | ||||||||||||
| 68 | - | |||||||||||||
| 69 | void SmoothTextureMaterialShader::initialize() | - | ||||||||||||
| 70 | { | - | ||||||||||||
| 71 | m_pixelSizeLoc = program()->uniformLocation("pixelSize"); | - | ||||||||||||
| 72 | QSGTextureMaterialShader::initialize(); | - | ||||||||||||
| 73 | } never executed: end of block | 0 | ||||||||||||
| 74 | - | |||||||||||||
| 75 | QSGDefaultInternalImageNode::QSGDefaultInternalImageNode() | - | ||||||||||||
| 76 | { | - | ||||||||||||
| 77 | setMaterial(&m_materialO); | - | ||||||||||||
| 78 | setOpaqueMaterial(&m_material); | - | ||||||||||||
| 79 | } executed 5189 times by 10 tests: end of blockExecuted by:
| 5189 | ||||||||||||
| 80 | - | |||||||||||||
| 81 | void QSGDefaultInternalImageNode::setFiltering(QSGTexture::Filtering filtering) | - | ||||||||||||
| 82 | { | - | ||||||||||||
| 83 | if (m_material.filtering() == filtering
| 184-5121 | ||||||||||||
| 84 | return; executed 184 times by 5 tests: return;Executed by:
| 184 | ||||||||||||
| 85 | - | |||||||||||||
| 86 | m_material.setFiltering(filtering); | - | ||||||||||||
| 87 | m_materialO.setFiltering(filtering); | - | ||||||||||||
| 88 | m_smoothMaterial.setFiltering(filtering); | - | ||||||||||||
| 89 | markDirty(DirtyMaterial); | - | ||||||||||||
| 90 | } executed 5121 times by 10 tests: end of blockExecuted by:
| 5121 | ||||||||||||
| 91 | - | |||||||||||||
| 92 | void QSGDefaultInternalImageNode::setMipmapFiltering(QSGTexture::Filtering filtering) | - | ||||||||||||
| 93 | { | - | ||||||||||||
| 94 | if (m_material.mipmapFiltering() == filtering
| 6-5269 | ||||||||||||
| 95 | return; executed 5269 times by 9 tests: return;Executed by:
| 5269 | ||||||||||||
| 96 | - | |||||||||||||
| 97 | m_material.setMipmapFiltering(filtering); | - | ||||||||||||
| 98 | m_materialO.setMipmapFiltering(filtering); | - | ||||||||||||
| 99 | m_smoothMaterial.setMipmapFiltering(filtering); | - | ||||||||||||
| 100 | markDirty(DirtyMaterial); | - | ||||||||||||
| 101 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 102 | - | |||||||||||||
| 103 | void QSGDefaultInternalImageNode::setVerticalWrapMode(QSGTexture::WrapMode wrapMode) | - | ||||||||||||
| 104 | { | - | ||||||||||||
| 105 | if (m_material.verticalWrapMode() == wrapMode
| 6-5269 | ||||||||||||
| 106 | return; executed 5269 times by 9 tests: return;Executed by:
| 5269 | ||||||||||||
| 107 | - | |||||||||||||
| 108 | m_material.setVerticalWrapMode(wrapMode); | - | ||||||||||||
| 109 | m_materialO.setVerticalWrapMode(wrapMode); | - | ||||||||||||
| 110 | m_smoothMaterial.setVerticalWrapMode(wrapMode); | - | ||||||||||||
| 111 | markDirty(DirtyMaterial); | - | ||||||||||||
| 112 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||
| 113 | - | |||||||||||||
| 114 | void QSGDefaultInternalImageNode::setHorizontalWrapMode(QSGTexture::WrapMode wrapMode) | - | ||||||||||||
| 115 | { | - | ||||||||||||
| 116 | if (m_material.horizontalWrapMode() == wrapMode
| 8-5267 | ||||||||||||
| 117 | return; executed 5267 times by 9 tests: return;Executed by:
| 5267 | ||||||||||||
| 118 | - | |||||||||||||
| 119 | m_material.setHorizontalWrapMode(wrapMode); | - | ||||||||||||
| 120 | m_materialO.setHorizontalWrapMode(wrapMode); | - | ||||||||||||
| 121 | m_smoothMaterial.setHorizontalWrapMode(wrapMode); | - | ||||||||||||
| 122 | markDirty(DirtyMaterial); | - | ||||||||||||
| 123 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||
| 124 | - | |||||||||||||
| 125 | void QSGDefaultInternalImageNode::updateMaterialAntialiasing() | - | ||||||||||||
| 126 | { | - | ||||||||||||
| 127 | if (m_antialiasing
| 0 | ||||||||||||
| 128 | setMaterial(&m_smoothMaterial); | - | ||||||||||||
| 129 | setOpaqueMaterial(nullptr); | - | ||||||||||||
| 130 | } never executed: else {end of block | 0 | ||||||||||||
| 131 | setMaterial(&m_materialO); | - | ||||||||||||
| 132 | setOpaqueMaterial(&m_material); | - | ||||||||||||
| 133 | } never executed: end of block | 0 | ||||||||||||
| 134 | } | - | ||||||||||||
| 135 | - | |||||||||||||
| 136 | void QSGDefaultInternalImageNode::setMaterialTexture(QSGTexture *texture) | - | ||||||||||||
| 137 | { | - | ||||||||||||
| 138 | m_material.setTexture(texture); | - | ||||||||||||
| 139 | m_materialO.setTexture(texture); | - | ||||||||||||
| 140 | m_smoothMaterial.setTexture(texture); | - | ||||||||||||
| 141 | } executed 5245 times by 10 tests: end of blockExecuted by:
| 5245 | ||||||||||||
| 142 | - | |||||||||||||
| 143 | QSGTexture *QSGDefaultInternalImageNode::materialTexture() const | - | ||||||||||||
| 144 | { | - | ||||||||||||
| 145 | return executed 16148 times by 10 tests: m_material.texture();return m_material.texture();Executed by:
executed 16148 times by 10 tests: return m_material.texture();Executed by:
| 16148 | ||||||||||||
| 146 | } | - | ||||||||||||
| 147 | - | |||||||||||||
| 148 | bool QSGDefaultInternalImageNode::updateMaterialBlending() | - | ||||||||||||
| 149 | { | - | ||||||||||||
| 150 | const bool alpha = m_material.flags() & QSGMaterial::Blending; | - | ||||||||||||
| 151 | if (materialTexture()
| 0-5371 | ||||||||||||
| 152 | m_material.setFlag(QSGMaterial::Blending, !alpha); | - | ||||||||||||
| 153 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||
| 154 | } | - | ||||||||||||
| 155 | return executed 5371 times by 10 tests: false;return false;Executed by:
executed 5371 times by 10 tests: return false;Executed by:
| 5371 | ||||||||||||
| 156 | } | - | ||||||||||||
| 157 | - | |||||||||||||
| 158 | inline static bool isPowerOfTwo(int x) | - | ||||||||||||
| 159 | { | - | ||||||||||||
| 160 | - | |||||||||||||
| 161 | return never executed: x == (x & -x);return x == (x & -x);never executed: return x == (x & -x); | 0 | ||||||||||||
| 162 | } | - | ||||||||||||
| 163 | - | |||||||||||||
| 164 | bool QSGDefaultInternalImageNode::supportsWrap(const QSize &size) const | - | ||||||||||||
| 165 | { | - | ||||||||||||
| 166 | bool wrapSupported = true; | - | ||||||||||||
| 167 | - | |||||||||||||
| 168 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | - | ||||||||||||
| 169 | - | |||||||||||||
| 170 | if (ctx->isOpenGLES()
| 0-10 | ||||||||||||
| 171 | - | |||||||||||||
| 172 | { | - | ||||||||||||
| 173 | bool npotSupported = ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat); | - | ||||||||||||
| 174 | const bool isNpot = !isPowerOfTwo(size.width())
| 0 | ||||||||||||
| 175 | wrapSupported = npotSupported
| 0 | ||||||||||||
| 176 | } never executed: end of block | 0 | ||||||||||||
| 177 | - | |||||||||||||
| 178 | return executed 10 times by 1 test: wrapSupported;return wrapSupported;Executed by:
executed 10 times by 1 test: return wrapSupported;Executed by:
| 10 | ||||||||||||
| 179 | } | - | ||||||||||||
| 180 | - | |||||||||||||
| 181 | - | |||||||||||||
| Switch to Source code | Preprocessed file |