| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quickshapes/qquickshapesoftwarerenderer.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | void QQuickShapeSoftwareRenderer::beginSync(int totalCount) | - | ||||||||||||||||||
| 5 | { | - | ||||||||||||||||||
| 6 | if (m_sp.count() != totalCount
| 0-8 | ||||||||||||||||||
| 7 | m_sp.resize(totalCount); | - | ||||||||||||||||||
| 8 | m_accDirty |= DirtyList; | - | ||||||||||||||||||
| 9 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 10 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | void QQuickShapeSoftwareRenderer::setPath(int index, const QQuickPath *path) | - | ||||||||||||||||||
| 13 | { | - | ||||||||||||||||||
| 14 | ShapePathGuiData &d(m_sp[index]); | - | ||||||||||||||||||
| 15 | d.path = path
| 0-12 | ||||||||||||||||||
| 16 | d.dirty |= DirtyPath; | - | ||||||||||||||||||
| 17 | m_accDirty |= DirtyPath; | - | ||||||||||||||||||
| 18 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 19 | - | |||||||||||||||||||
| 20 | void QQuickShapeSoftwareRenderer::setStrokeColor(int index, const QColor &color) | - | ||||||||||||||||||
| 21 | { | - | ||||||||||||||||||
| 22 | ShapePathGuiData &d(m_sp[index]); | - | ||||||||||||||||||
| 23 | d.pen.setColor(color); | - | ||||||||||||||||||
| 24 | d.dirty |= DirtyPen; | - | ||||||||||||||||||
| 25 | m_accDirty |= DirtyPen; | - | ||||||||||||||||||
| 26 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | void QQuickShapeSoftwareRenderer::setStrokeWidth(int index, qreal w) | - | ||||||||||||||||||
| 29 | { | - | ||||||||||||||||||
| 30 | ShapePathGuiData &d(m_sp[index]); | - | ||||||||||||||||||
| 31 | d.strokeWidth = w; | - | ||||||||||||||||||
| 32 | if (w >= 0.0f
| 0-12 | ||||||||||||||||||
| 33 | d.pen.setWidthF(w); executed 12 times by 1 test: d.pen.setWidthF(w);Executed by:
| 12 | ||||||||||||||||||
| 34 | d.dirty |= DirtyPen; | - | ||||||||||||||||||
| 35 | m_accDirty |= DirtyPen; | - | ||||||||||||||||||
| 36 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 37 | - | |||||||||||||||||||
| 38 | void QQuickShapeSoftwareRenderer::setFillColor(int index, const QColor &color) | - | ||||||||||||||||||
| 39 | { | - | ||||||||||||||||||
| 40 | ShapePathGuiData &d(m_sp[index]); | - | ||||||||||||||||||
| 41 | d.fillColor = color; | - | ||||||||||||||||||
| 42 | d.brush.setColor(color); | - | ||||||||||||||||||
| 43 | d.dirty |= DirtyBrush; | - | ||||||||||||||||||
| 44 | m_accDirty |= DirtyBrush; | - | ||||||||||||||||||
| 45 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 46 | - | |||||||||||||||||||
| 47 | void QQuickShapeSoftwareRenderer::setFillRule(int index, QQuickShapePath::FillRule fillRule) | - | ||||||||||||||||||
| 48 | { | - | ||||||||||||||||||
| 49 | ShapePathGuiData &d(m_sp[index]); | - | ||||||||||||||||||
| 50 | d.fillRule = Qt::FillRule(fillRule); | - | ||||||||||||||||||
| 51 | d.dirty |= DirtyFillRule; | - | ||||||||||||||||||
| 52 | m_accDirty |= DirtyFillRule; | - | ||||||||||||||||||
| 53 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 54 | - | |||||||||||||||||||
| 55 | void QQuickShapeSoftwareRenderer::setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) | - | ||||||||||||||||||
| 56 | { | - | ||||||||||||||||||
| 57 | ShapePathGuiData &d(m_sp[index]); | - | ||||||||||||||||||
| 58 | d.pen.setJoinStyle(Qt::PenJoinStyle(joinStyle)); | - | ||||||||||||||||||
| 59 | d.pen.setMiterLimit(miterLimit); | - | ||||||||||||||||||
| 60 | d.dirty |= DirtyPen; | - | ||||||||||||||||||
| 61 | m_accDirty |= DirtyPen; | - | ||||||||||||||||||
| 62 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 63 | - | |||||||||||||||||||
| 64 | void QQuickShapeSoftwareRenderer::setCapStyle(int index, QQuickShapePath::CapStyle capStyle) | - | ||||||||||||||||||
| 65 | { | - | ||||||||||||||||||
| 66 | ShapePathGuiData &d(m_sp[index]); | - | ||||||||||||||||||
| 67 | d.pen.setCapStyle(Qt::PenCapStyle(capStyle)); | - | ||||||||||||||||||
| 68 | d.dirty |= DirtyPen; | - | ||||||||||||||||||
| 69 | m_accDirty |= DirtyPen; | - | ||||||||||||||||||
| 70 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | void QQuickShapeSoftwareRenderer::setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, | - | ||||||||||||||||||
| 73 | qreal dashOffset, const QVector<qreal> &dashPattern) | - | ||||||||||||||||||
| 74 | { | - | ||||||||||||||||||
| 75 | ShapePathGuiData &d(m_sp[index]); | - | ||||||||||||||||||
| 76 | switch (strokeStyle) { | - | ||||||||||||||||||
| 77 | case executed 6 times by 1 test: QQuickShapePath::SolidLine:case QQuickShapePath::SolidLine:Executed by:
executed 6 times by 1 test: case QQuickShapePath::SolidLine:Executed by:
| 6 | ||||||||||||||||||
| 78 | d.pen.setStyle(Qt::SolidLine); | - | ||||||||||||||||||
| 79 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||
| 80 | case executed 6 times by 1 test: QQuickShapePath::DashLine:case QQuickShapePath::DashLine:Executed by:
executed 6 times by 1 test: case QQuickShapePath::DashLine:Executed by:
| 6 | ||||||||||||||||||
| 81 | d.pen.setStyle(Qt::CustomDashLine); | - | ||||||||||||||||||
| 82 | d.pen.setDashPattern(dashPattern); | - | ||||||||||||||||||
| 83 | d.pen.setDashOffset(dashOffset); | - | ||||||||||||||||||
| 84 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||
| 85 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 86 | break; never executed: break; | 0 | ||||||||||||||||||
| 87 | } | - | ||||||||||||||||||
| 88 | d.dirty |= DirtyPen; | - | ||||||||||||||||||
| 89 | m_accDirty |= DirtyPen; | - | ||||||||||||||||||
| 90 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 91 | - | |||||||||||||||||||
| 92 | static inline void setupPainterGradient(QGradient *painterGradient, const QQuickShapeGradient &g) | - | ||||||||||||||||||
| 93 | { | - | ||||||||||||||||||
| 94 | painterGradient->setStops(g.gradientStops()); | - | ||||||||||||||||||
| 95 | switch (g.spread()) { | - | ||||||||||||||||||
| 96 | case executed 8 times by 1 test: QQuickShapeGradient::PadSpread:case QQuickShapeGradient::PadSpread:Executed by:
executed 8 times by 1 test: case QQuickShapeGradient::PadSpread:Executed by:
| 8 | ||||||||||||||||||
| 97 | painterGradient->setSpread(QGradient::PadSpread); | - | ||||||||||||||||||
| 98 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||||||||
| 99 | case never executed: QQuickShapeGradient::RepeatSpread:case QQuickShapeGradient::RepeatSpread:never executed: case QQuickShapeGradient::RepeatSpread: | 0 | ||||||||||||||||||
| 100 | painterGradient->setSpread(QGradient::RepeatSpread); | - | ||||||||||||||||||
| 101 | break; never executed: break; | 0 | ||||||||||||||||||
| 102 | case never executed: QQuickShapeGradient::ReflectSpread:case QQuickShapeGradient::ReflectSpread:never executed: case QQuickShapeGradient::ReflectSpread: | 0 | ||||||||||||||||||
| 103 | painterGradient->setSpread(QGradient::ReflectSpread); | - | ||||||||||||||||||
| 104 | break; never executed: break; | 0 | ||||||||||||||||||
| 105 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 106 | break; never executed: break; | 0 | ||||||||||||||||||
| 107 | } | - | ||||||||||||||||||
| 108 | } | - | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | void QQuickShapeSoftwareRenderer::setFillGradient(int index, QQuickShapeGradient *gradient) | - | ||||||||||||||||||
| 111 | { | - | ||||||||||||||||||
| 112 | ShapePathGuiData &d(m_sp[index]); | - | ||||||||||||||||||
| 113 | if (QQuickShapeLinearGradient *g = qobject_cast<QQuickShapeLinearGradient *>(gradient)
| 4-8 | ||||||||||||||||||
| 114 | QLinearGradient painterGradient(g->x1(), g->y1(), g->x2(), g->y2()); | - | ||||||||||||||||||
| 115 | setupPainterGradient(&painterGradient, *g); | - | ||||||||||||||||||
| 116 | d.brush = QBrush(painterGradient); | - | ||||||||||||||||||
| 117 | } executed 4 times by 1 test: else if (QQuickShapeRadialGradient *g = qobject_cast<QQuickShapeRadialGradient *>(gradient)end of blockExecuted by:
| 2-6 | ||||||||||||||||||
| 118 | QRadialGradient painterGradient(g->centerX(), g->centerY(), g->centerRadius(), | - | ||||||||||||||||||
| 119 | g->focalX(), g->focalY(), g->focalRadius()); | - | ||||||||||||||||||
| 120 | setupPainterGradient(&painterGradient, *g); | - | ||||||||||||||||||
| 121 | d.brush = QBrush(painterGradient); | - | ||||||||||||||||||
| 122 | } executed 2 times by 1 test: else if (QQuickShapeConicalGradient *g = qobject_cast<QQuickShapeConicalGradient *>(gradient)end of blockExecuted by:
| 2-4 | ||||||||||||||||||
| 123 | QConicalGradient painterGradient(g->centerX(), g->centerY(), g->angle()); | - | ||||||||||||||||||
| 124 | setupPainterGradient(&painterGradient, *g); | - | ||||||||||||||||||
| 125 | d.brush = QBrush(painterGradient); | - | ||||||||||||||||||
| 126 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||
| 127 | d.brush = QBrush(d.fillColor); | - | ||||||||||||||||||
| 128 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 129 | d.dirty |= DirtyBrush; | - | ||||||||||||||||||
| 130 | m_accDirty |= DirtyBrush; | - | ||||||||||||||||||
| 131 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | void QQuickShapeSoftwareRenderer::endSync(bool) | - | ||||||||||||||||||
| 134 | { | - | ||||||||||||||||||
| 135 | } | - | ||||||||||||||||||
| 136 | - | |||||||||||||||||||
| 137 | void QQuickShapeSoftwareRenderer::setNode(QQuickShapeSoftwareRenderNode *node) | - | ||||||||||||||||||
| 138 | { | - | ||||||||||||||||||
| 139 | if (m_node != node
| 0-8 | ||||||||||||||||||
| 140 | m_node = node; | - | ||||||||||||||||||
| 141 | m_accDirty |= DirtyList; | - | ||||||||||||||||||
| 142 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 143 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | void QQuickShapeSoftwareRenderer::updateNode() | - | ||||||||||||||||||
| 146 | { | - | ||||||||||||||||||
| 147 | if (!m_accDirty
| 0-8 | ||||||||||||||||||
| 148 | return; never executed: return; | 0 | ||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | const int count = m_sp.count(); | - | ||||||||||||||||||
| 151 | const bool listChanged = m_accDirty & DirtyList; | - | ||||||||||||||||||
| 152 | if (listChanged
| 0-8 | ||||||||||||||||||
| 153 | m_node->m_sp.resize(count); executed 8 times by 1 test: m_node->m_sp.resize(count);Executed by:
| 8 | ||||||||||||||||||
| 154 | - | |||||||||||||||||||
| 155 | m_node->m_boundingRect = QRectF(); | - | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | for (int i = 0; i < count
| 8-12 | ||||||||||||||||||
| 158 | ShapePathGuiData &src(m_sp[i]); | - | ||||||||||||||||||
| 159 | QQuickShapeSoftwareRenderNode::ShapePathRenderData &dst(m_node->m_sp[i]); | - | ||||||||||||||||||
| 160 | - | |||||||||||||||||||
| 161 | if (listChanged
| 0-12 | ||||||||||||||||||
| 162 | dst.path = src.path; | - | ||||||||||||||||||
| 163 | dst.path.setFillRule(src.fillRule); | - | ||||||||||||||||||
| 164 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | if (listChanged
| 0-12 | ||||||||||||||||||
| 167 | dst.path.setFillRule(src.fillRule); executed 12 times by 1 test: dst.path.setFillRule(src.fillRule);Executed by:
| 12 | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | if (listChanged
| 0-12 | ||||||||||||||||||
| 170 | dst.pen = src.pen; | - | ||||||||||||||||||
| 171 | dst.strokeWidth = src.strokeWidth; | - | ||||||||||||||||||
| 172 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | if (listChanged
| 0-12 | ||||||||||||||||||
| 175 | dst.brush = src.brush; executed 12 times by 1 test: dst.brush = src.brush;Executed by:
| 12 | ||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | src.dirty = 0; | - | ||||||||||||||||||
| 178 | - | |||||||||||||||||||
| 179 | QRectF br = dst.path.boundingRect(); | - | ||||||||||||||||||
| 180 | const float sw = qMax(1.0f, dst.strokeWidth); | - | ||||||||||||||||||
| 181 | br.adjust(-sw, -sw, sw, sw); | - | ||||||||||||||||||
| 182 | m_node->m_boundingRect |= br; | - | ||||||||||||||||||
| 183 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | m_node->markDirty(QSGNode::DirtyMaterial); | - | ||||||||||||||||||
| 186 | m_accDirty = 0; | - | ||||||||||||||||||
| 187 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | QQuickShapeSoftwareRenderNode::QQuickShapeSoftwareRenderNode(QQuickShape *item) | - | ||||||||||||||||||
| 190 | : m_item(item) | - | ||||||||||||||||||
| 191 | { | - | ||||||||||||||||||
| 192 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | QQuickShapeSoftwareRenderNode::~QQuickShapeSoftwareRenderNode() | - | ||||||||||||||||||
| 195 | { | - | ||||||||||||||||||
| 196 | releaseResources(); | - | ||||||||||||||||||
| 197 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 198 | - | |||||||||||||||||||
| 199 | void QQuickShapeSoftwareRenderNode::releaseResources() | - | ||||||||||||||||||
| 200 | { | - | ||||||||||||||||||
| 201 | } | - | ||||||||||||||||||
| 202 | - | |||||||||||||||||||
| 203 | void QQuickShapeSoftwareRenderNode::render(const RenderState *state) | - | ||||||||||||||||||
| 204 | { | - | ||||||||||||||||||
| 205 | if (m_sp.isEmpty()
| 0-8 | ||||||||||||||||||
| 206 | return; never executed: return; | 0 | ||||||||||||||||||
| 207 | - | |||||||||||||||||||
| 208 | QSGRendererInterface *rif = m_item->window()->rendererInterface(); | - | ||||||||||||||||||
| 209 | QPainter *p = static_cast<QPainter *>(rif->getResource(m_item->window(), QSGRendererInterface::PainterResource)); | - | ||||||||||||||||||
| 210 | ((p) ? static_cast<void>(0) : qt_assert("p", __FILE__, 251)); | - | ||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | const QRegion *clipRegion = state->clipRegion(); | - | ||||||||||||||||||
| 213 | if (clipRegion
| 0-8 | ||||||||||||||||||
| 214 | p->setClipRegion(*clipRegion, Qt::ReplaceClip); executed 8 times by 1 test: p->setClipRegion(*clipRegion, Qt::ReplaceClip);Executed by:
| 8 | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | p->setTransform(matrix()->toTransform()); | - | ||||||||||||||||||
| 217 | p->setOpacity(inheritedOpacity()); | - | ||||||||||||||||||
| 218 | - | |||||||||||||||||||
| 219 | for (const ShapePathRenderData &d : qAsConst(m_sp)) { | - | ||||||||||||||||||
| 220 | p->setPen(d.strokeWidth >= 0.0f && d.pen.color() != Qt::transparent ? d.pen : Qt::NoPen); | - | ||||||||||||||||||
| 221 | p->setBrush(d.brush.color() != Qt::transparent ? d.brush : Qt::NoBrush); | - | ||||||||||||||||||
| 222 | p->drawPath(d.path); | - | ||||||||||||||||||
| 223 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 224 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | QSGRenderNode::StateFlags QQuickShapeSoftwareRenderNode::changedStates() const | - | ||||||||||||||||||
| 227 | { | - | ||||||||||||||||||
| 228 | return never executed: nullptr;return nullptr;never executed: return nullptr; | 0 | ||||||||||||||||||
| 229 | } | - | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | QSGRenderNode::RenderingFlags QQuickShapeSoftwareRenderNode::flags() const | - | ||||||||||||||||||
| 232 | { | - | ||||||||||||||||||
| 233 | return executed 16 times by 1 test: BoundedRectRendering;return BoundedRectRendering;Executed by:
executed 16 times by 1 test: return BoundedRectRendering;Executed by:
| 16 | ||||||||||||||||||
| 234 | } | - | ||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | QRectF QQuickShapeSoftwareRenderNode::rect() const | - | ||||||||||||||||||
| 237 | { | - | ||||||||||||||||||
| 238 | return executed 8 times by 1 test: m_boundingRect;return m_boundingRect;Executed by:
executed 8 times by 1 test: return m_boundingRect;Executed by:
| 8 | ||||||||||||||||||
| 239 | } | - | ||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |