| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/util/qsgdefaultpainternode.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | QSGPainterTexture::QSGPainterTexture() | - | ||||||||||||||||||||||||
| 9 | : QSGPlainTexture() | - | ||||||||||||||||||||||||
| 10 | { | - | ||||||||||||||||||||||||
| 11 | m_retain_image = true; | - | ||||||||||||||||||||||||
| 12 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | void QSGPainterTexture::bind() | - | ||||||||||||||||||||||||
| 15 | { | - | ||||||||||||||||||||||||
| 16 | if (m_dirty_rect.isNull()
| 0-50 | ||||||||||||||||||||||||
| 17 | QSGPlainTexture::bind(); | - | ||||||||||||||||||||||||
| 18 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 19 | } | - | ||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||
| 21 | setImage(m_image); | - | ||||||||||||||||||||||||
| 22 | QSGPlainTexture::bind(); | - | ||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||
| 24 | m_dirty_rect = QRect(); | - | ||||||||||||||||||||||||
| 25 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | QSGDefaultPainterNode::QSGDefaultPainterNode(QQuickPaintedItem *item) | - | ||||||||||||||||||||||||
| 28 | : QSGPainterNode() | - | ||||||||||||||||||||||||
| 29 | , m_preferredRenderTarget(QQuickPaintedItem::Image) | - | ||||||||||||||||||||||||
| 30 | , m_actualRenderTarget(QQuickPaintedItem::Image) | - | ||||||||||||||||||||||||
| 31 | , m_item(item) | - | ||||||||||||||||||||||||
| 32 | , m_fbo(nullptr) | - | ||||||||||||||||||||||||
| 33 | , m_multisampledFbo(nullptr) | - | ||||||||||||||||||||||||
| 34 | , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) | - | ||||||||||||||||||||||||
| 35 | , m_texture(nullptr) | - | ||||||||||||||||||||||||
| 36 | , m_gl_device(nullptr) | - | ||||||||||||||||||||||||
| 37 | , m_fillColor(Qt::transparent) | - | ||||||||||||||||||||||||
| 38 | , m_contentsScale(1.0) | - | ||||||||||||||||||||||||
| 39 | , m_dirtyContents(false) | - | ||||||||||||||||||||||||
| 40 | , m_opaquePainting(false) | - | ||||||||||||||||||||||||
| 41 | , m_linear_filtering(false) | - | ||||||||||||||||||||||||
| 42 | , m_mipmapping(false) | - | ||||||||||||||||||||||||
| 43 | , m_smoothPainting(false) | - | ||||||||||||||||||||||||
| 44 | , m_extensionsChecked(false) | - | ||||||||||||||||||||||||
| 45 | , m_multisamplingSupported(false) | - | ||||||||||||||||||||||||
| 46 | , m_fastFBOResizing(false) | - | ||||||||||||||||||||||||
| 47 | , m_dirtyGeometry(false) | - | ||||||||||||||||||||||||
| 48 | , m_dirtyRenderTarget(false) | - | ||||||||||||||||||||||||
| 49 | , m_dirtyTexture(false) | - | ||||||||||||||||||||||||
| 50 | { | - | ||||||||||||||||||||||||
| 51 | m_context = static_cast<QSGDefaultRenderContext *>(static_cast<QQuickPaintedItemPrivate *>(QObjectPrivate::get(item))->sceneGraphRenderContext()); | - | ||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||
| 53 | setMaterial(&m_materialO); | - | ||||||||||||||||||||||||
| 54 | setOpaqueMaterial(&m_material); | - | ||||||||||||||||||||||||
| 55 | setGeometry(&m_geometry); | - | ||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | qsgnode_set_description(this, QString::fromLatin1("QQuickPaintedItem(%1):%2").arg(QString::fromLatin1(item->metaObject()->className())).arg(item->objectName())); | - | ||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | QSGDefaultPainterNode::~QSGDefaultPainterNode() | - | ||||||||||||||||||||||||
| 63 | { | - | ||||||||||||||||||||||||
| 64 | delete m_texture; | - | ||||||||||||||||||||||||
| 65 | delete m_fbo; | - | ||||||||||||||||||||||||
| 66 | delete m_multisampledFbo; | - | ||||||||||||||||||||||||
| 67 | delete m_gl_device; | - | ||||||||||||||||||||||||
| 68 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | void QSGDefaultPainterNode::paint() | - | ||||||||||||||||||||||||
| 71 | { | - | ||||||||||||||||||||||||
| 72 | QRect dirtyRect = m_dirtyRect.isNull()
| 4-46 | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | QPainter painter; | - | ||||||||||||||||||||||||
| 75 | if (m_actualRenderTarget == QQuickPaintedItem::Image
| 0-50 | ||||||||||||||||||||||||
| 76 | if (m_image.isNull()
| 0-50 | ||||||||||||||||||||||||
| 77 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 78 | painter.begin(&m_image); | - | ||||||||||||||||||||||||
| 79 | } executed 50 times by 1 test: else {end of blockExecuted by:
| 50 | ||||||||||||||||||||||||
| 80 | if (!m_gl_device
| 0 | ||||||||||||||||||||||||
| 81 | m_gl_device = new QOpenGLPaintDevice(m_fboSize); | - | ||||||||||||||||||||||||
| 82 | m_gl_device->setPaintFlipped(true); | - | ||||||||||||||||||||||||
| 83 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | if (m_multisampledFbo
| 0 | ||||||||||||||||||||||||
| 86 | m_multisampledFbo->bind(); never executed: m_multisampledFbo->bind(); | 0 | ||||||||||||||||||||||||
| 87 | else | - | ||||||||||||||||||||||||
| 88 | m_fbo->bind(); never executed: m_fbo->bind(); | 0 | ||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | painter.begin(m_gl_device); | - | ||||||||||||||||||||||||
| 91 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | if (m_smoothPainting
| 2-48 | ||||||||||||||||||||||||
| 94 | painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||
| 95 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | QRect clipRect; | - | ||||||||||||||||||||||||
| 98 | QRect dirtyTextureRect; | - | ||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | if (m_contentsScale == 1
| 10-40 | ||||||||||||||||||||||||
| 101 | qreal scaleX = m_textureSize.width() / (qreal) m_size.width(); | - | ||||||||||||||||||||||||
| 102 | qreal scaleY = m_textureSize.height() / (qreal) m_size.height(); | - | ||||||||||||||||||||||||
| 103 | painter.scale(scaleX, scaleY); | - | ||||||||||||||||||||||||
| 104 | clipRect = dirtyRect; | - | ||||||||||||||||||||||||
| 105 | dirtyTextureRect = QRectF(dirtyRect.x() * scaleX, | - | ||||||||||||||||||||||||
| 106 | dirtyRect.y() * scaleY, | - | ||||||||||||||||||||||||
| 107 | dirtyRect.width() * scaleX, | - | ||||||||||||||||||||||||
| 108 | dirtyRect.height() * scaleY).toAlignedRect(); | - | ||||||||||||||||||||||||
| 109 | } executed 40 times by 1 test: else {end of blockExecuted by:
| 40 | ||||||||||||||||||||||||
| 110 | painter.scale(m_contentsScale, m_contentsScale); | - | ||||||||||||||||||||||||
| 111 | QRect sclip(qFloor(dirtyRect.x()/m_contentsScale), | - | ||||||||||||||||||||||||
| 112 | qFloor(dirtyRect.y()/m_contentsScale), | - | ||||||||||||||||||||||||
| 113 | qCeil(dirtyRect.width()/m_contentsScale+dirtyRect.x()/m_contentsScale-qFloor(dirtyRect.x()/m_contentsScale)), | - | ||||||||||||||||||||||||
| 114 | qCeil(dirtyRect.height()/m_contentsScale+dirtyRect.y()/m_contentsScale-qFloor(dirtyRect.y()/m_contentsScale))); | - | ||||||||||||||||||||||||
| 115 | clipRect = sclip; | - | ||||||||||||||||||||||||
| 116 | dirtyTextureRect = dirtyRect; | - | ||||||||||||||||||||||||
| 117 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | if (!m_dirtyRect.isNull()
| 4-46 | ||||||||||||||||||||||||
| 121 | painter.setClipRect(clipRect); | - | ||||||||||||||||||||||||
| 122 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | painter.setCompositionMode(QPainter::CompositionMode_Source); | - | ||||||||||||||||||||||||
| 125 | painter.fillRect(clipRect, m_fillColor); | - | ||||||||||||||||||||||||
| 126 | painter.setCompositionMode(QPainter::CompositionMode_SourceOver); | - | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | m_item->paint(&painter); | - | ||||||||||||||||||||||||
| 129 | painter.end(); | - | ||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | if (m_actualRenderTarget == QQuickPaintedItem::Image
| 0-50 | ||||||||||||||||||||||||
| 132 | m_texture->setImage(m_image); | - | ||||||||||||||||||||||||
| 133 | m_texture->setDirtyRect(dirtyTextureRect); | - | ||||||||||||||||||||||||
| 134 | } executed 50 times by 1 test: else if (m_multisampledFboend of blockExecuted by:
| 0-50 | ||||||||||||||||||||||||
| 135 | QOpenGLFramebufferObject::blitFramebuffer(m_fbo, dirtyTextureRect, m_multisampledFbo, dirtyTextureRect); | - | ||||||||||||||||||||||||
| 136 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | if (m_multisampledFbo
| 0-50 | ||||||||||||||||||||||||
| 139 | m_multisampledFbo->release(); never executed: m_multisampledFbo->release(); | 0 | ||||||||||||||||||||||||
| 140 | else if (m_fbo
| 0-50 | ||||||||||||||||||||||||
| 141 | m_fbo->release(); never executed: m_fbo->release(); | 0 | ||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | m_dirtyRect = QRect(); | - | ||||||||||||||||||||||||
| 144 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | void QSGDefaultPainterNode::update() | - | ||||||||||||||||||||||||
| 147 | { | - | ||||||||||||||||||||||||
| 148 | if (m_dirtyRenderTarget
| 24-26 | ||||||||||||||||||||||||
| 149 | updateRenderTarget(); executed 26 times by 1 test: updateRenderTarget();Executed by:
| 26 | ||||||||||||||||||||||||
| 150 | if (m_dirtyGeometry
| 22-28 | ||||||||||||||||||||||||
| 151 | updateGeometry(); executed 22 times by 1 test: updateGeometry();Executed by:
| 22 | ||||||||||||||||||||||||
| 152 | if (m_dirtyTexture
| 20-30 | ||||||||||||||||||||||||
| 153 | updateTexture(); executed 30 times by 1 test: updateTexture();Executed by:
| 30 | ||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||
| 155 | if (m_dirtyContents
| 0-50 | ||||||||||||||||||||||||
| 156 | paint(); executed 50 times by 1 test: paint();Executed by:
| 50 | ||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||
| 158 | m_dirtyGeometry = false; | - | ||||||||||||||||||||||||
| 159 | m_dirtyRenderTarget = false; | - | ||||||||||||||||||||||||
| 160 | m_dirtyTexture = false; | - | ||||||||||||||||||||||||
| 161 | m_dirtyContents = false; | - | ||||||||||||||||||||||||
| 162 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | void QSGDefaultPainterNode::updateTexture() | - | ||||||||||||||||||||||||
| 165 | { | - | ||||||||||||||||||||||||
| 166 | m_texture->setHasAlphaChannel(!m_opaquePainting); | - | ||||||||||||||||||||||||
| 167 | m_material.setTexture(m_texture); | - | ||||||||||||||||||||||||
| 168 | m_materialO.setTexture(m_texture); | - | ||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||
| 170 | markDirty(DirtyMaterial); | - | ||||||||||||||||||||||||
| 171 | } executed 30 times by 1 test: end of blockExecuted by:
| 30 | ||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | void QSGDefaultPainterNode::updateGeometry() | - | ||||||||||||||||||||||||
| 174 | { | - | ||||||||||||||||||||||||
| 175 | QRectF source; | - | ||||||||||||||||||||||||
| 176 | if (m_actualRenderTarget == QQuickPaintedItem::Image
| 0-22 | ||||||||||||||||||||||||
| 177 | source = QRectF(0, 0, 1, 1); executed 22 times by 1 test: source = QRectF(0, 0, 1, 1);Executed by:
| 22 | ||||||||||||||||||||||||
| 178 | else | - | ||||||||||||||||||||||||
| 179 | source = QRectF(0, 0, qreal(m_textureSize.width()) / m_fboSize.width(), qreal(m_textureSize.height()) / m_fboSize.height()); never executed: source = QRectF(0, 0, qreal(m_textureSize.width()) / m_fboSize.width(), qreal(m_textureSize.height()) / m_fboSize.height()); | 0 | ||||||||||||||||||||||||
| 180 | QRectF dest(0, 0, m_size.width(), m_size.height()); | - | ||||||||||||||||||||||||
| 181 | if (m_actualRenderTarget == QQuickPaintedItem::InvertedYFramebufferObject
| 0-22 | ||||||||||||||||||||||||
| 182 | dest = QRectF(QPointF(0, m_size.height()), QPointF(m_size.width(), 0)); never executed: dest = QRectF(QPointF(0, m_size.height()), QPointF(m_size.width(), 0)); | 0 | ||||||||||||||||||||||||
| 183 | QSGGeometry::updateTexturedRectGeometry(&m_geometry, | - | ||||||||||||||||||||||||
| 184 | dest, | - | ||||||||||||||||||||||||
| 185 | source); | - | ||||||||||||||||||||||||
| 186 | markDirty(DirtyGeometry); | - | ||||||||||||||||||||||||
| 187 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | void QSGDefaultPainterNode::updateRenderTarget() | - | ||||||||||||||||||||||||
| 190 | { | - | ||||||||||||||||||||||||
| 191 | if (!m_extensionsChecked
| 10-16 | ||||||||||||||||||||||||
| 192 | QOpenGLExtensions *e = static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions()); | - | ||||||||||||||||||||||||
| 193 | m_multisamplingSupported = e->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)
| 0-16 | ||||||||||||||||||||||||
| 194 | && e->hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit)
| 0-16 | ||||||||||||||||||||||||
| 195 | m_extensionsChecked = true; | - | ||||||||||||||||||||||||
| 196 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | m_dirtyContents = true; | - | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | QQuickPaintedItem::RenderTarget oldTarget = m_actualRenderTarget; | - | ||||||||||||||||||||||||
| 201 | if (m_preferredRenderTarget == QQuickPaintedItem::Image
| 0-26 | ||||||||||||||||||||||||
| 202 | m_actualRenderTarget = QQuickPaintedItem::Image; | - | ||||||||||||||||||||||||
| 203 | } executed 26 times by 1 test: else {end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 204 | if (!m_multisamplingSupported
| 0 | ||||||||||||||||||||||||
| 205 | m_actualRenderTarget = QQuickPaintedItem::Image; never executed: m_actualRenderTarget = QQuickPaintedItem::Image; | 0 | ||||||||||||||||||||||||
| 206 | else | - | ||||||||||||||||||||||||
| 207 | m_actualRenderTarget = m_preferredRenderTarget; never executed: m_actualRenderTarget = m_preferredRenderTarget; | 0 | ||||||||||||||||||||||||
| 208 | } | - | ||||||||||||||||||||||||
| 209 | if (oldTarget != m_actualRenderTarget
| 0-26 | ||||||||||||||||||||||||
| 210 | m_image = QImage(); | - | ||||||||||||||||||||||||
| 211 | delete m_fbo; | - | ||||||||||||||||||||||||
| 212 | delete m_multisampledFbo; | - | ||||||||||||||||||||||||
| 213 | delete m_gl_device; | - | ||||||||||||||||||||||||
| 214 | m_fbo = m_multisampledFbo = nullptr; | - | ||||||||||||||||||||||||
| 215 | m_gl_device = nullptr; | - | ||||||||||||||||||||||||
| 216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | if (m_actualRenderTarget == QQuickPaintedItem::FramebufferObject
| 0-26 | ||||||||||||||||||||||||
| 219 | m_actualRenderTarget == QQuickPaintedItem::InvertedYFramebufferObject
| 0-26 | ||||||||||||||||||||||||
| 220 | const QOpenGLContext *ctx = m_context->openglContext(); | - | ||||||||||||||||||||||||
| 221 | if (m_fbo
| 0 | ||||||||||||||||||||||||
| 222 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | if (m_fboSize.isEmpty()
| 0 | ||||||||||||||||||||||||
| 225 | updateFBOSize(); never executed: updateFBOSize(); | 0 | ||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||
| 227 | delete m_fbo; | - | ||||||||||||||||||||||||
| 228 | delete m_multisampledFbo; | - | ||||||||||||||||||||||||
| 229 | m_fbo = m_multisampledFbo = nullptr; | - | ||||||||||||||||||||||||
| 230 | if (m_gl_device
| 0 | ||||||||||||||||||||||||
| 231 | m_gl_device->setSize(m_fboSize); never executed: m_gl_device->setSize(m_fboSize); | 0 | ||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||
| 233 | if (m_smoothPainting
| 0 | ||||||||||||||||||||||||
| 234 | { | - | ||||||||||||||||||||||||
| 235 | QOpenGLFramebufferObjectFormat format; | - | ||||||||||||||||||||||||
| 236 | format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); | - | ||||||||||||||||||||||||
| 237 | format.setSamples(8); | - | ||||||||||||||||||||||||
| 238 | m_multisampledFbo = new QOpenGLFramebufferObject(m_fboSize, format); | - | ||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||
| 240 | { | - | ||||||||||||||||||||||||
| 241 | QOpenGLFramebufferObjectFormat format; | - | ||||||||||||||||||||||||
| 242 | format.setAttachment(QOpenGLFramebufferObject::NoAttachment); | - | ||||||||||||||||||||||||
| 243 | m_fbo = new QOpenGLFramebufferObject(m_fboSize, format); | - | ||||||||||||||||||||||||
| 244 | } | - | ||||||||||||||||||||||||
| 245 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 246 | QOpenGLFramebufferObjectFormat format; | - | ||||||||||||||||||||||||
| 247 | format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); | - | ||||||||||||||||||||||||
| 248 | m_fbo = new QOpenGLFramebufferObject(m_fboSize, format); | - | ||||||||||||||||||||||||
| 249 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 250 | } else { | - | ||||||||||||||||||||||||
| 251 | if (!m_image.isNull()
| 4-16 | ||||||||||||||||||||||||
| 252 | return; executed 4 times by 1 test: return;Executed by:
| 4 | ||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||
| 254 | m_image = QImage(m_textureSize, QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||
| 255 | m_image.fill(Qt::transparent); | - | ||||||||||||||||||||||||
| 256 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | QSGPainterTexture *texture = new QSGPainterTexture; | - | ||||||||||||||||||||||||
| 259 | if (m_actualRenderTarget == QQuickPaintedItem::Image
| 0-22 | ||||||||||||||||||||||||
| 260 | texture->setOwnsTexture(true); | - | ||||||||||||||||||||||||
| 261 | texture->setTextureSize(m_textureSize); | - | ||||||||||||||||||||||||
| 262 | } executed 22 times by 1 test: else {end of blockExecuted by:
| 22 | ||||||||||||||||||||||||
| 263 | texture->setTextureId(m_fbo->texture()); | - | ||||||||||||||||||||||||
| 264 | texture->setOwnsTexture(false); | - | ||||||||||||||||||||||||
| 265 | texture->setTextureSize(m_fboSize); | - | ||||||||||||||||||||||||
| 266 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||
| 268 | if (m_texture
| 6-16 | ||||||||||||||||||||||||
| 269 | delete m_texture; executed 6 times by 1 test: delete m_texture;Executed by:
| 6 | ||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | m_texture = texture; | - | ||||||||||||||||||||||||
| 272 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||
| 274 | void QSGDefaultPainterNode::updateFBOSize() | - | ||||||||||||||||||||||||
| 275 | { | - | ||||||||||||||||||||||||
| 276 | int fboWidth; | - | ||||||||||||||||||||||||
| 277 | int fboHeight; | - | ||||||||||||||||||||||||
| 278 | if (m_fastFBOResizing
| 2-24 | ||||||||||||||||||||||||
| 279 | fboWidth = qMax(64U, qNextPowerOfTwo(m_textureSize.width() - 1)); | - | ||||||||||||||||||||||||
| 280 | fboHeight = qMax(64U, qNextPowerOfTwo(m_textureSize.height() - 1)); | - | ||||||||||||||||||||||||
| 281 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 282 | QSize minimumFBOSize = m_context->sceneGraphContext()->minimumFBOSize(); | - | ||||||||||||||||||||||||
| 283 | fboWidth = qMax(minimumFBOSize.width(), m_textureSize.width()); | - | ||||||||||||||||||||||||
| 284 | fboHeight = qMax(minimumFBOSize.height(), m_textureSize.height()); | - | ||||||||||||||||||||||||
| 285 | } executed 24 times by 1 test: end of blockExecuted by:
| 24 | ||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | m_fboSize = QSize(fboWidth, fboHeight); | - | ||||||||||||||||||||||||
| 288 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||
| 290 | void QSGDefaultPainterNode::setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) | - | ||||||||||||||||||||||||
| 291 | { | - | ||||||||||||||||||||||||
| 292 | if (m_preferredRenderTarget == target
| 0-50 | ||||||||||||||||||||||||
| 293 | return; executed 50 times by 1 test: return;Executed by:
| 50 | ||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | m_preferredRenderTarget = target; | - | ||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | m_dirtyRenderTarget = true; | - | ||||||||||||||||||||||||
| 298 | m_dirtyGeometry = true; | - | ||||||||||||||||||||||||
| 299 | m_dirtyTexture = true; | - | ||||||||||||||||||||||||
| 300 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||
| 302 | void QSGDefaultPainterNode::setSize(const QSize &size) | - | ||||||||||||||||||||||||
| 303 | { | - | ||||||||||||||||||||||||
| 304 | if (size == m_size
| 22-28 | ||||||||||||||||||||||||
| 305 | return; executed 28 times by 1 test: return;Executed by:
| 28 | ||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||
| 307 | m_size = size; | - | ||||||||||||||||||||||||
| 308 | m_dirtyGeometry = true; | - | ||||||||||||||||||||||||
| 309 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||
| 311 | void QSGDefaultPainterNode::setTextureSize(const QSize &size) | - | ||||||||||||||||||||||||
| 312 | { | - | ||||||||||||||||||||||||
| 313 | if (size == m_textureSize
| 22-28 | ||||||||||||||||||||||||
| 314 | return; executed 28 times by 1 test: return;Executed by:
| 28 | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | m_textureSize = size; | - | ||||||||||||||||||||||||
| 317 | updateFBOSize(); | - | ||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | if (m_fbo
| 0-22 | ||||||||||||||||||||||||
| 320 | m_dirtyRenderTarget = m_fbo->size() != m_fboSize
never executed: m_dirtyRenderTarget = m_fbo->size() != m_fboSize || m_dirtyRenderTarget; | 0 | ||||||||||||||||||||||||
| 321 | else | - | ||||||||||||||||||||||||
| 322 | m_dirtyRenderTarget = true; executed 22 times by 1 test: m_dirtyRenderTarget = true;Executed by:
| 22 | ||||||||||||||||||||||||
| 323 | m_dirtyGeometry = true; | - | ||||||||||||||||||||||||
| 324 | m_dirtyTexture = true; | - | ||||||||||||||||||||||||
| 325 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||
| 327 | void QSGDefaultPainterNode::setDirty(const QRect &dirtyRect) | - | ||||||||||||||||||||||||
| 328 | { | - | ||||||||||||||||||||||||
| 329 | m_dirtyContents = true; | - | ||||||||||||||||||||||||
| 330 | m_dirtyRect = dirtyRect; | - | ||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||
| 332 | if (m_mipmapping
| 2-48 | ||||||||||||||||||||||||
| 333 | m_dirtyTexture = true; executed 2 times by 1 test: m_dirtyTexture = true;Executed by:
| 2 | ||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | markDirty(DirtyMaterial); | - | ||||||||||||||||||||||||
| 336 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | void QSGDefaultPainterNode::setOpaquePainting(bool opaque) | - | ||||||||||||||||||||||||
| 339 | { | - | ||||||||||||||||||||||||
| 340 | if (opaque == m_opaquePainting
| 4-46 | ||||||||||||||||||||||||
| 341 | return; executed 46 times by 1 test: return;Executed by:
| 46 | ||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | m_opaquePainting = opaque; | - | ||||||||||||||||||||||||
| 344 | m_dirtyTexture = true; | - | ||||||||||||||||||||||||
| 345 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | void QSGDefaultPainterNode::setLinearFiltering(bool linearFiltering) | - | ||||||||||||||||||||||||
| 348 | { | - | ||||||||||||||||||||||||
| 349 | if (linearFiltering == m_linear_filtering
| 16-34 | ||||||||||||||||||||||||
| 350 | return; executed 34 times by 1 test: return;Executed by:
| 34 | ||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||
| 352 | m_linear_filtering = linearFiltering; | - | ||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | m_material.setFiltering(linearFiltering ? QSGTexture::Linear : QSGTexture::Nearest); | - | ||||||||||||||||||||||||
| 355 | m_materialO.setFiltering(linearFiltering ? QSGTexture::Linear : QSGTexture::Nearest); | - | ||||||||||||||||||||||||
| 356 | markDirty(DirtyMaterial); | - | ||||||||||||||||||||||||
| 357 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | void QSGDefaultPainterNode::setMipmapping(bool mipmapping) | - | ||||||||||||||||||||||||
| 360 | { | - | ||||||||||||||||||||||||
| 361 | if (mipmapping == m_mipmapping
| 4-46 | ||||||||||||||||||||||||
| 362 | return; executed 46 times by 1 test: return;Executed by:
| 46 | ||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | m_mipmapping = mipmapping; | - | ||||||||||||||||||||||||
| 365 | m_material.setMipmapFiltering(mipmapping ? QSGTexture::Linear : QSGTexture::None); | - | ||||||||||||||||||||||||
| 366 | m_materialO.setMipmapFiltering(mipmapping ? QSGTexture::Linear : QSGTexture::None); | - | ||||||||||||||||||||||||
| 367 | m_dirtyTexture = true; | - | ||||||||||||||||||||||||
| 368 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 369 | - | |||||||||||||||||||||||||
| 370 | void QSGDefaultPainterNode::setSmoothPainting(bool s) | - | ||||||||||||||||||||||||
| 371 | { | - | ||||||||||||||||||||||||
| 372 | if (s == m_smoothPainting
| 4-46 | ||||||||||||||||||||||||
| 373 | return; executed 46 times by 1 test: return;Executed by:
| 46 | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | m_smoothPainting = s; | - | ||||||||||||||||||||||||
| 376 | m_dirtyRenderTarget = true; | - | ||||||||||||||||||||||||
| 377 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 | void QSGDefaultPainterNode::setFillColor(const QColor &c) | - | ||||||||||||||||||||||||
| 380 | { | - | ||||||||||||||||||||||||
| 381 | if (c == m_fillColor
| 4-46 | ||||||||||||||||||||||||
| 382 | return; executed 46 times by 1 test: return;Executed by:
| 46 | ||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | m_fillColor = c; | - | ||||||||||||||||||||||||
| 385 | markDirty(DirtyMaterial); | - | ||||||||||||||||||||||||
| 386 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||
| 388 | void QSGDefaultPainterNode::setContentsScale(qreal s) | - | ||||||||||||||||||||||||
| 389 | { | - | ||||||||||||||||||||||||
| 390 | if (s == m_contentsScale
| 8-42 | ||||||||||||||||||||||||
| 391 | return; executed 42 times by 1 test: return;Executed by:
| 42 | ||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | m_contentsScale = s; | - | ||||||||||||||||||||||||
| 394 | markDirty(DirtyMaterial); | - | ||||||||||||||||||||||||
| 395 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 396 | - | |||||||||||||||||||||||||
| 397 | void QSGDefaultPainterNode::setFastFBOResizing(bool fastResizing) | - | ||||||||||||||||||||||||
| 398 | { | - | ||||||||||||||||||||||||
| 399 | if (m_fastFBOResizing == fastResizing
| 4-46 | ||||||||||||||||||||||||
| 400 | return; executed 46 times by 1 test: return;Executed by:
| 46 | ||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | m_fastFBOResizing = fastResizing; | - | ||||||||||||||||||||||||
| 403 | updateFBOSize(); | - | ||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||
| 405 | if ((m_preferredRenderTarget == QQuickPaintedItem::FramebufferObject
| 0-4 | ||||||||||||||||||||||||
| 406 | || m_preferredRenderTarget == QQuickPaintedItem::InvertedYFramebufferObject
| 0-4 | ||||||||||||||||||||||||
| 407 | && (!m_fbo
| 0 | ||||||||||||||||||||||||
| 408 | m_dirtyRenderTarget = true; | - | ||||||||||||||||||||||||
| 409 | m_dirtyGeometry = true; | - | ||||||||||||||||||||||||
| 410 | m_dirtyTexture = true; | - | ||||||||||||||||||||||||
| 411 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 412 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||
| 414 | QImage QSGDefaultPainterNode::toImage() const | - | ||||||||||||||||||||||||
| 415 | { | - | ||||||||||||||||||||||||
| 416 | if (m_actualRenderTarget == QQuickPaintedItem::Image
| 0 | ||||||||||||||||||||||||
| 417 | return never executed: m_image;return m_image;never executed: return m_image; | 0 | ||||||||||||||||||||||||
| 418 | else | - | ||||||||||||||||||||||||
| 419 | return never executed: m_fbo->toImage();return m_fbo->toImage();never executed: return m_fbo->toImage(); | 0 | ||||||||||||||||||||||||
| 420 | } | - | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |