| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quickshapes/qquickshape.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | const QLoggingCategory &QQSHAPE_LOG_TIME_DIRTY_SYNC() { static const QLoggingCategory category("qt.shape.time.sync"); return executed 91 times by 2 tests: category;return category;Executed by:
executed 91 times by 2 tests: }return category;Executed by:
| 91 | ||||||||||||
| 5 | QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams() | - | ||||||||||||
| 6 | : strokeColor(Qt::white), | - | ||||||||||||
| 7 | strokeWidth(1), | - | ||||||||||||
| 8 | fillColor(Qt::white), | - | ||||||||||||
| 9 | fillRule(QQuickShapePath::OddEvenFill), | - | ||||||||||||
| 10 | joinStyle(QQuickShapePath::BevelJoin), | - | ||||||||||||
| 11 | miterLimit(2), | - | ||||||||||||
| 12 | capStyle(QQuickShapePath::SquareCap), | - | ||||||||||||
| 13 | strokeStyle(QQuickShapePath::SolidLine), | - | ||||||||||||
| 14 | dashOffset(0), | - | ||||||||||||
| 15 | fillGradient(nullptr) | - | ||||||||||||
| 16 | { | - | ||||||||||||
| 17 | dashPattern << 4 << 2; | - | ||||||||||||
| 18 | } executed 1072 times by 2 tests: end of blockExecuted by:
| 1072 | ||||||||||||
| 19 | QQuickShapePathPrivate::QQuickShapePathPrivate() | - | ||||||||||||
| 20 | : dirty(DirtyAll) | - | ||||||||||||
| 21 | { | - | ||||||||||||
| 22 | - | |||||||||||||
| 23 | isShapePath = true; | - | ||||||||||||
| 24 | } executed 1072 times by 2 tests: end of blockExecuted by:
| 1072 | ||||||||||||
| 25 | - | |||||||||||||
| 26 | QQuickShapePath::QQuickShapePath(QObject *parent) | - | ||||||||||||
| 27 | : QQuickPath(*(new QQuickShapePathPrivate), parent) | - | ||||||||||||
| 28 | { | - | ||||||||||||
| 29 | - | |||||||||||||
| 30 | - | |||||||||||||
| 31 | - | |||||||||||||
| 32 | - | |||||||||||||
| 33 | - | |||||||||||||
| 34 | connect(this, &QQuickPath::changed, [this]() { | - | ||||||||||||
| 35 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 36 | d->dirty |= QQuickShapePathPrivate::DirtyPath; | - | ||||||||||||
| 37 | shapePathChanged(); | - | ||||||||||||
| 38 | } executed 1158 times by 2 tests: );end of blockExecuted by:
| 1158 | ||||||||||||
| 39 | } executed 1072 times by 2 tests: end of blockExecuted by:
| 1072 | ||||||||||||
| 40 | - | |||||||||||||
| 41 | QQuickShapePath::~QQuickShapePath() | - | ||||||||||||
| 42 | { | - | ||||||||||||
| 43 | } | - | ||||||||||||
| 44 | QColor QQuickShapePath::strokeColor() const | - | ||||||||||||
| 45 | { | - | ||||||||||||
| 46 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 47 | return executed 1053 times by 2 tests: d->sfp.strokeColor;return d->sfp.strokeColor;Executed by:
executed 1053 times by 2 tests: return d->sfp.strokeColor;Executed by:
| 1053 | ||||||||||||
| 48 | } | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | void QQuickShapePath::setStrokeColor(const QColor &color) | - | ||||||||||||
| 51 | { | - | ||||||||||||
| 52 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 53 | if (d->sfp.strokeColor != color
| 0-410 | ||||||||||||
| 54 | d->sfp.strokeColor = color; | - | ||||||||||||
| 55 | d->dirty |= QQuickShapePathPrivate::DirtyStrokeColor; | - | ||||||||||||
| 56 | strokeColorChanged(); | - | ||||||||||||
| 57 | shapePathChanged(); | - | ||||||||||||
| 58 | } executed 410 times by 2 tests: end of blockExecuted by:
| 410 | ||||||||||||
| 59 | } executed 410 times by 2 tests: end of blockExecuted by:
| 410 | ||||||||||||
| 60 | qreal QQuickShapePath::strokeWidth() const | - | ||||||||||||
| 61 | { | - | ||||||||||||
| 62 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 63 | return executed 1057 times by 2 tests: d->sfp.strokeWidth;return d->sfp.strokeWidth;Executed by:
executed 1057 times by 2 tests: return d->sfp.strokeWidth;Executed by:
| 1057 | ||||||||||||
| 64 | } | - | ||||||||||||
| 65 | - | |||||||||||||
| 66 | void QQuickShapePath::setStrokeWidth(qreal w) | - | ||||||||||||
| 67 | { | - | ||||||||||||
| 68 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 69 | if (d->sfp.strokeWidth != w
| 38-1016 | ||||||||||||
| 70 | d->sfp.strokeWidth = w; | - | ||||||||||||
| 71 | d->dirty |= QQuickShapePathPrivate::DirtyStrokeWidth; | - | ||||||||||||
| 72 | strokeWidthChanged(); | - | ||||||||||||
| 73 | shapePathChanged(); | - | ||||||||||||
| 74 | } executed 1016 times by 2 tests: end of blockExecuted by:
| 1016 | ||||||||||||
| 75 | } executed 1054 times by 2 tests: end of blockExecuted by:
| 1054 | ||||||||||||
| 76 | QColor QQuickShapePath::fillColor() const | - | ||||||||||||
| 77 | { | - | ||||||||||||
| 78 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 79 | return executed 1053 times by 2 tests: d->sfp.fillColor;return d->sfp.fillColor;Executed by:
executed 1053 times by 2 tests: return d->sfp.fillColor;Executed by:
| 1053 | ||||||||||||
| 80 | } | - | ||||||||||||
| 81 | - | |||||||||||||
| 82 | void QQuickShapePath::setFillColor(const QColor &color) | - | ||||||||||||
| 83 | { | - | ||||||||||||
| 84 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 85 | if (d->sfp.fillColor != color
| 224-824 | ||||||||||||
| 86 | d->sfp.fillColor = color; | - | ||||||||||||
| 87 | d->dirty |= QQuickShapePathPrivate::DirtyFillColor; | - | ||||||||||||
| 88 | fillColorChanged(); | - | ||||||||||||
| 89 | shapePathChanged(); | - | ||||||||||||
| 90 | } executed 824 times by 2 tests: end of blockExecuted by:
| 824 | ||||||||||||
| 91 | } executed 1048 times by 2 tests: end of blockExecuted by:
| 1048 | ||||||||||||
| 92 | QQuickShapePath::FillRule QQuickShapePath::fillRule() const | - | ||||||||||||
| 93 | { | - | ||||||||||||
| 94 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 95 | return executed 1057 times by 2 tests: d->sfp.fillRule;return d->sfp.fillRule;Executed by:
executed 1057 times by 2 tests: return d->sfp.fillRule;Executed by:
| 1057 | ||||||||||||
| 96 | } | - | ||||||||||||
| 97 | - | |||||||||||||
| 98 | void QQuickShapePath::setFillRule(FillRule fillRule) | - | ||||||||||||
| 99 | { | - | ||||||||||||
| 100 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 101 | if (d->sfp.fillRule != fillRule
| 0-2 | ||||||||||||
| 102 | d->sfp.fillRule = fillRule; | - | ||||||||||||
| 103 | d->dirty |= QQuickShapePathPrivate::DirtyFillRule; | - | ||||||||||||
| 104 | fillRuleChanged(); | - | ||||||||||||
| 105 | shapePathChanged(); | - | ||||||||||||
| 106 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 107 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 108 | QQuickShapePath::JoinStyle QQuickShapePath::joinStyle() const | - | ||||||||||||
| 109 | { | - | ||||||||||||
| 110 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 111 | return executed 1053 times by 2 tests: d->sfp.joinStyle;return d->sfp.joinStyle;Executed by:
executed 1053 times by 2 tests: return d->sfp.joinStyle;Executed by:
| 1053 | ||||||||||||
| 112 | } | - | ||||||||||||
| 113 | - | |||||||||||||
| 114 | void QQuickShapePath::setJoinStyle(JoinStyle style) | - | ||||||||||||
| 115 | { | - | ||||||||||||
| 116 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 117 | if (d->sfp.joinStyle != style
| 2-4 | ||||||||||||
| 118 | d->sfp.joinStyle = style; | - | ||||||||||||
| 119 | d->dirty |= QQuickShapePathPrivate::DirtyStyle; | - | ||||||||||||
| 120 | joinStyleChanged(); | - | ||||||||||||
| 121 | shapePathChanged(); | - | ||||||||||||
| 122 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 123 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 124 | int QQuickShapePath::miterLimit() const | - | ||||||||||||
| 125 | { | - | ||||||||||||
| 126 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 127 | return executed 1053 times by 2 tests: d->sfp.miterLimit;return d->sfp.miterLimit;Executed by:
executed 1053 times by 2 tests: return d->sfp.miterLimit;Executed by:
| 1053 | ||||||||||||
| 128 | } | - | ||||||||||||
| 129 | - | |||||||||||||
| 130 | void QQuickShapePath::setMiterLimit(int limit) | - | ||||||||||||
| 131 | { | - | ||||||||||||
| 132 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 133 | if (d->sfp.miterLimit != limit
| 0-2 | ||||||||||||
| 134 | d->sfp.miterLimit = limit; | - | ||||||||||||
| 135 | d->dirty |= QQuickShapePathPrivate::DirtyStyle; | - | ||||||||||||
| 136 | miterLimitChanged(); | - | ||||||||||||
| 137 | shapePathChanged(); | - | ||||||||||||
| 138 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 139 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 140 | QQuickShapePath::CapStyle QQuickShapePath::capStyle() const | - | ||||||||||||
| 141 | { | - | ||||||||||||
| 142 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 143 | return executed 1053 times by 2 tests: d->sfp.capStyle;return d->sfp.capStyle;Executed by:
executed 1053 times by 2 tests: return d->sfp.capStyle;Executed by:
| 1053 | ||||||||||||
| 144 | } | - | ||||||||||||
| 145 | - | |||||||||||||
| 146 | void QQuickShapePath::setCapStyle(CapStyle style) | - | ||||||||||||
| 147 | { | - | ||||||||||||
| 148 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 149 | if (d->sfp.capStyle != style
| 0-20 | ||||||||||||
| 150 | d->sfp.capStyle = style; | - | ||||||||||||
| 151 | d->dirty |= QQuickShapePathPrivate::DirtyStyle; | - | ||||||||||||
| 152 | capStyleChanged(); | - | ||||||||||||
| 153 | shapePathChanged(); | - | ||||||||||||
| 154 | } executed 20 times by 2 tests: end of blockExecuted by:
| 20 | ||||||||||||
| 155 | } executed 20 times by 2 tests: end of blockExecuted by:
| 20 | ||||||||||||
| 156 | QQuickShapePath::StrokeStyle QQuickShapePath::strokeStyle() const | - | ||||||||||||
| 157 | { | - | ||||||||||||
| 158 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 159 | return executed 1055 times by 2 tests: d->sfp.strokeStyle;return d->sfp.strokeStyle;Executed by:
executed 1055 times by 2 tests: return d->sfp.strokeStyle;Executed by:
| 1055 | ||||||||||||
| 160 | } | - | ||||||||||||
| 161 | - | |||||||||||||
| 162 | void QQuickShapePath::setStrokeStyle(StrokeStyle style) | - | ||||||||||||
| 163 | { | - | ||||||||||||
| 164 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 165 | if (d->sfp.strokeStyle != style
| 0-38 | ||||||||||||
| 166 | d->sfp.strokeStyle = style; | - | ||||||||||||
| 167 | d->dirty |= QQuickShapePathPrivate::DirtyDash; | - | ||||||||||||
| 168 | strokeStyleChanged(); | - | ||||||||||||
| 169 | shapePathChanged(); | - | ||||||||||||
| 170 | } executed 38 times by 2 tests: end of blockExecuted by:
| 38 | ||||||||||||
| 171 | } executed 38 times by 2 tests: end of blockExecuted by:
| 38 | ||||||||||||
| 172 | qreal QQuickShapePath::dashOffset() const | - | ||||||||||||
| 173 | { | - | ||||||||||||
| 174 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 175 | return executed 1053 times by 2 tests: d->sfp.dashOffset;return d->sfp.dashOffset;Executed by:
executed 1053 times by 2 tests: return d->sfp.dashOffset;Executed by:
| 1053 | ||||||||||||
| 176 | } | - | ||||||||||||
| 177 | - | |||||||||||||
| 178 | void QQuickShapePath::setDashOffset(qreal offset) | - | ||||||||||||
| 179 | { | - | ||||||||||||
| 180 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 181 | if (d->sfp.dashOffset != offset
| 0-2 | ||||||||||||
| 182 | d->sfp.dashOffset = offset; | - | ||||||||||||
| 183 | d->dirty |= QQuickShapePathPrivate::DirtyDash; | - | ||||||||||||
| 184 | dashOffsetChanged(); | - | ||||||||||||
| 185 | shapePathChanged(); | - | ||||||||||||
| 186 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 187 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 188 | QVector<qreal> QQuickShapePath::dashPattern() const | - | ||||||||||||
| 189 | { | - | ||||||||||||
| 190 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 191 | return executed 1053 times by 2 tests: d->sfp.dashPattern;return d->sfp.dashPattern;Executed by:
executed 1053 times by 2 tests: return d->sfp.dashPattern;Executed by:
| 1053 | ||||||||||||
| 192 | } | - | ||||||||||||
| 193 | - | |||||||||||||
| 194 | void QQuickShapePath::setDashPattern(const QVector<qreal> &array) | - | ||||||||||||
| 195 | { | - | ||||||||||||
| 196 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 197 | if (d->sfp.dashPattern != array
| 0-24 | ||||||||||||
| 198 | d->sfp.dashPattern = array; | - | ||||||||||||
| 199 | d->dirty |= QQuickShapePathPrivate::DirtyDash; | - | ||||||||||||
| 200 | dashPatternChanged(); | - | ||||||||||||
| 201 | shapePathChanged(); | - | ||||||||||||
| 202 | } executed 24 times by 2 tests: end of blockExecuted by:
| 24 | ||||||||||||
| 203 | } executed 24 times by 2 tests: end of blockExecuted by:
| 24 | ||||||||||||
| 204 | QQuickShapeGradient *QQuickShapePath::fillGradient() const | - | ||||||||||||
| 205 | { | - | ||||||||||||
| 206 | const QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 207 | return executed 1059 times by 2 tests: d->sfp.fillGradient;return d->sfp.fillGradient;Executed by:
executed 1059 times by 2 tests: return d->sfp.fillGradient;Executed by:
| 1059 | ||||||||||||
| 208 | } | - | ||||||||||||
| 209 | - | |||||||||||||
| 210 | void QQuickShapePath::setFillGradient(QQuickShapeGradient *gradient) | - | ||||||||||||
| 211 | { | - | ||||||||||||
| 212 | QQuickShapePathPrivate * const d = d_func(); | - | ||||||||||||
| 213 | if (d->sfp.fillGradient != gradient
| 0-36 | ||||||||||||
| 214 | if (d->sfp.fillGradient
| 2-34 | ||||||||||||
| 215 | { QQuickShapeGradient *sender = (d->sfp.fillGradient); QQuickShapePath *receiver = (this); const char *signal = (qFlagLocation("2""updated()" "\0" __FILE__ ":" "488")); const char *method = (qFlagLocation("1""_q_fillGradientChanged()" "\0" __FILE__ ":" "488")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 0-2 | ||||||||||||
| 216 | __FILE__ | - | ||||||||||||
| 217 | , | - | ||||||||||||
| 218 | 488 | - | ||||||||||||
| 219 | )); signalIdx = QQuickShapeGradient::staticMetaObject.indexOfSignal(signal+1); } executed 2 times by 1 test: if (methodIdx < 0end of blockExecuted by:
| 0-2 | ||||||||||||
| 220 | __FILE__ | - | ||||||||||||
| 221 | , | - | ||||||||||||
| 222 | 488 | - | ||||||||||||
| 223 | )); if (code == 1
executed 2 times by 1 test: else methodIdx = QQuickShapePath::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickShapePath::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickShapePath::staticMetaObject.indexOfSignal(method+1); | 0-2 | ||||||||||||
| 224 | __FILE__ | - | ||||||||||||
| 225 | , | - | ||||||||||||
| 226 | 488 | - | ||||||||||||
| 227 | )); QMetaObject::disconnect(sender, signalIdx, receiver, methodIdx); } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 228 | ; | - | ||||||||||||
| 229 | d->sfp.fillGradient = gradient; | - | ||||||||||||
| 230 | if (d->sfp.fillGradient
| 2-34 | ||||||||||||
| 231 | { QQuickShapeGradient *sender = (d->sfp.fillGradient); QQuickShapePath *receiver = (this); const char *signal = (qFlagLocation("2""updated()" "\0" __FILE__ ":" "492")); const char *method = (qFlagLocation("1""_q_fillGradientChanged()" "\0" __FILE__ ":" "492")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 4-30 | ||||||||||||
| 232 | __FILE__ | - | ||||||||||||
| 233 | , | - | ||||||||||||
| 234 | 492 | - | ||||||||||||
| 235 | )); signalIdx = QQuickShapeGradient::staticMetaObject.indexOfSignal(signal+1); } executed 4 times by 2 tests: if (methodIdx < 0end of blockExecuted by:
| 4-30 | ||||||||||||
| 236 | __FILE__ | - | ||||||||||||
| 237 | , | - | ||||||||||||
| 238 | 492 | - | ||||||||||||
| 239 | )); if (code == 1
executed 4 times by 2 tests: else methodIdx = QQuickShapePath::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickShapePath::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickShapePath::staticMetaObject.indexOfSignal(method+1); | 0-4 | ||||||||||||
| 240 | __FILE__ | - | ||||||||||||
| 241 | , | - | ||||||||||||
| 242 | 492 | - | ||||||||||||
| 243 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } executed 34 times by 2 tests: end of blockExecuted by:
| 34 | ||||||||||||
| 244 | ; | - | ||||||||||||
| 245 | d->dirty |= QQuickShapePathPrivate::DirtyFillGradient; | - | ||||||||||||
| 246 | shapePathChanged(); | - | ||||||||||||
| 247 | } executed 36 times by 2 tests: end of blockExecuted by:
| 36 | ||||||||||||
| 248 | } executed 36 times by 2 tests: end of blockExecuted by:
| 36 | ||||||||||||
| 249 | - | |||||||||||||
| 250 | void QQuickShapePathPrivate::_q_fillGradientChanged() | - | ||||||||||||
| 251 | { | - | ||||||||||||
| 252 | QQuickShapePath * const q = q_func(); | - | ||||||||||||
| 253 | dirty |= DirtyFillGradient; | - | ||||||||||||
| 254 | q->shapePathChanged(); | - | ||||||||||||
| 255 | } executed 22 times by 2 tests: end of blockExecuted by:
| 22 | ||||||||||||
| 256 | - | |||||||||||||
| 257 | void QQuickShapePath::resetFillGradient() | - | ||||||||||||
| 258 | { | - | ||||||||||||
| 259 | setFillGradient(nullptr); | - | ||||||||||||
| 260 | } never executed: end of block | 0 | ||||||||||||
| 261 | QQuickShapePrivate::QQuickShapePrivate() | - | ||||||||||||
| 262 | : effectRefCount(0) | - | ||||||||||||
| 263 | { | - | ||||||||||||
| 264 | } executed 112 times by 2 tests: end of blockExecuted by:
| 112 | ||||||||||||
| 265 | - | |||||||||||||
| 266 | QQuickShapePrivate::~QQuickShapePrivate() | - | ||||||||||||
| 267 | { | - | ||||||||||||
| 268 | delete renderer; | - | ||||||||||||
| 269 | } executed 112 times by 2 tests: end of blockExecuted by:
| 112 | ||||||||||||
| 270 | - | |||||||||||||
| 271 | void QQuickShapePrivate::_q_shapePathChanged() | - | ||||||||||||
| 272 | { | - | ||||||||||||
| 273 | QQuickShape * const q = q_func(); | - | ||||||||||||
| 274 | spChanged = true; | - | ||||||||||||
| 275 | q->polish(); | - | ||||||||||||
| 276 | } executed 258 times by 2 tests: end of blockExecuted by:
| 258 | ||||||||||||
| 277 | - | |||||||||||||
| 278 | void QQuickShapePrivate::setStatus(QQuickShape::Status newStatus) | - | ||||||||||||
| 279 | { | - | ||||||||||||
| 280 | QQuickShape * const q = q_func(); | - | ||||||||||||
| 281 | if (status != newStatus
| 0-91 | ||||||||||||
| 282 | status = newStatus; | - | ||||||||||||
| 283 | q->statusChanged(); | - | ||||||||||||
| 284 | } executed 91 times by 2 tests: end of blockExecuted by:
| 91 | ||||||||||||
| 285 | } executed 91 times by 2 tests: end of blockExecuted by:
| 91 | ||||||||||||
| 286 | - | |||||||||||||
| 287 | struct QQuickShapeResourceInitializer | - | ||||||||||||
| 288 | { | - | ||||||||||||
| 289 | QQuickShapeResourceInitializer() | - | ||||||||||||
| 290 | { | - | ||||||||||||
| 291 | - | |||||||||||||
| 292 | - | |||||||||||||
| 293 | - | |||||||||||||
| 294 | } | - | ||||||||||||
| 295 | }; | - | ||||||||||||
| 296 | - | |||||||||||||
| 297 | namespace { namespace Q_QGS_initQQuickShapeResources { typedef QQuickShapeResourceInitializer Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 4 times by 2 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 4 times by 2 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 112 times by 2 tests: &holder.value;return &holder.value;Executed by:
executed 112 times by 2 tests: } } } static QGlobalStatic<QQuickShapeResourceInitializer, Q_QGS_initQQuickShapeResources::innerFunction, Q_QGS_initQQuickShapeResources::guard> initQQuickShapeResources;return &holder.value;Executed by:
| 0-112 | ||||||||||||
| 298 | - | |||||||||||||
| 299 | QQuickShape::QQuickShape(QQuickItem *parent) | - | ||||||||||||
| 300 | : QQuickItem(*(new QQuickShapePrivate), parent) | - | ||||||||||||
| 301 | { | - | ||||||||||||
| 302 | initQQuickShapeResources(); | - | ||||||||||||
| 303 | setFlag(ItemHasContents); | - | ||||||||||||
| 304 | } executed 112 times by 2 tests: end of blockExecuted by:
| 112 | ||||||||||||
| 305 | - | |||||||||||||
| 306 | QQuickShape::~QQuickShape() | - | ||||||||||||
| 307 | { | - | ||||||||||||
| 308 | } | - | ||||||||||||
| 309 | QQuickShape::RendererType QQuickShape::rendererType() const | - | ||||||||||||
| 310 | { | - | ||||||||||||
| 311 | const QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 312 | return executed 8 times by 2 tests: d->rendererType;return d->rendererType;Executed by:
executed 8 times by 2 tests: return d->rendererType;Executed by:
| 8 | ||||||||||||
| 313 | } | - | ||||||||||||
| 314 | bool QQuickShape::asynchronous() const | - | ||||||||||||
| 315 | { | - | ||||||||||||
| 316 | const QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 317 | return executed 4 times by 1 test: d->async;return d->async;Executed by:
executed 4 times by 1 test: return d->async;Executed by:
| 4 | ||||||||||||
| 318 | } | - | ||||||||||||
| 319 | - | |||||||||||||
| 320 | void QQuickShape::setAsynchronous(bool async) | - | ||||||||||||
| 321 | { | - | ||||||||||||
| 322 | QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 323 | if (d->async != async
| 0-8 | ||||||||||||
| 324 | d->async = async; | - | ||||||||||||
| 325 | asynchronousChanged(); | - | ||||||||||||
| 326 | if (d->componentComplete
| 4 | ||||||||||||
| 327 | d->_q_shapePathChanged(); executed 4 times by 1 test: d->_q_shapePathChanged();Executed by:
| 4 | ||||||||||||
| 328 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||
| 329 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||
| 330 | bool QQuickShape::vendorExtensionsEnabled() const | - | ||||||||||||
| 331 | { | - | ||||||||||||
| 332 | const QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 333 | return executed 4 times by 1 test: d->enableVendorExts;return d->enableVendorExts;Executed by:
executed 4 times by 1 test: return d->enableVendorExts;Executed by:
| 4 | ||||||||||||
| 334 | } | - | ||||||||||||
| 335 | - | |||||||||||||
| 336 | void QQuickShape::setVendorExtensionsEnabled(bool enable) | - | ||||||||||||
| 337 | { | - | ||||||||||||
| 338 | QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 339 | if (d->enableVendorExts != enable
| 0-12 | ||||||||||||
| 340 | d->enableVendorExts = enable; | - | ||||||||||||
| 341 | vendorExtensionsEnabledChanged(); | - | ||||||||||||
| 342 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||
| 343 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||
| 344 | QQuickShape::Status QQuickShape::status() const | - | ||||||||||||
| 345 | { | - | ||||||||||||
| 346 | const QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 347 | return executed 8 times by 2 tests: d->status;return d->status;Executed by:
executed 8 times by 2 tests: return d->status;Executed by:
| 8 | ||||||||||||
| 348 | } | - | ||||||||||||
| 349 | QQuickShape::ContainsMode QQuickShape::containsMode() const | - | ||||||||||||
| 350 | { | - | ||||||||||||
| 351 | const QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 352 | return never executed: d->containsMode;return d->containsMode;never executed: return d->containsMode; | 0 | ||||||||||||
| 353 | } | - | ||||||||||||
| 354 | - | |||||||||||||
| 355 | void QQuickShape::setContainsMode(QQuickShape::ContainsMode containsMode) | - | ||||||||||||
| 356 | { | - | ||||||||||||
| 357 | QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 358 | if (d->containsMode == containsMode
| 0-8 | ||||||||||||
| 359 | return; never executed: return; | 0 | ||||||||||||
| 360 | - | |||||||||||||
| 361 | d->containsMode = containsMode; | - | ||||||||||||
| 362 | containsModeChanged(); | - | ||||||||||||
| 363 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||
| 364 | - | |||||||||||||
| 365 | bool QQuickShape::contains(const QPointF &point) const | - | ||||||||||||
| 366 | { | - | ||||||||||||
| 367 | const QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 368 | switch (d->containsMode) { | - | ||||||||||||
| 369 | case never executed: BoundingRectContains:case BoundingRectContains:never executed: case BoundingRectContains: | 0 | ||||||||||||
| 370 | return never executed: QQuickItem::contains(point);return QQuickItem::contains(point);never executed: return QQuickItem::contains(point); | 0 | ||||||||||||
| 371 | case never executed: FillContains:case FillContains:never executed: case FillContains: | 0 | ||||||||||||
| 372 | for (QQuickShapePath *path : d->sp) { | - | ||||||||||||
| 373 | if (path->path().contains(point)
| 0 | ||||||||||||
| 374 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||
| 375 | } never executed: end of block | 0 | ||||||||||||
| 376 | } never executed: end of block | 0 | ||||||||||||
| 377 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 378 | } | - | ||||||||||||
| 379 | - | |||||||||||||
| 380 | static void vpe_append(QQmlListProperty<QObject> *property, QObject *obj) | - | ||||||||||||
| 381 | { | - | ||||||||||||
| 382 | QQuickShape *item = static_cast<QQuickShape *>(property->object); | - | ||||||||||||
| 383 | QQuickShapePrivate *d = QQuickShapePrivate::get(item); | - | ||||||||||||
| 384 | QQuickShapePath *path = qobject_cast<QQuickShapePath *>(obj); | - | ||||||||||||
| 385 | if (path
| 16-1072 | ||||||||||||
| 386 | d->sp.append(path); executed 1072 times by 2 tests: d->sp.append(path);Executed by:
| 1072 | ||||||||||||
| 387 | - | |||||||||||||
| 388 | QQuickItemPrivate::data_append(property, obj); | - | ||||||||||||
| 389 | - | |||||||||||||
| 390 | if (path
| 0-1072 | ||||||||||||
| 391 | QObject::connect(path, qFlagLocation("2""shapePathChanged()" "\0" __FILE__ ":" "865"), item, qFlagLocation("1""_q_shapePathChanged()" "\0" __FILE__ ":" "865")); | - | ||||||||||||
| 392 | d->_q_shapePathChanged(); | - | ||||||||||||
| 393 | } never executed: end of block | 0 | ||||||||||||
| 394 | } executed 1088 times by 2 tests: end of blockExecuted by:
| 1088 | ||||||||||||
| 395 | - | |||||||||||||
| 396 | static void vpe_clear(QQmlListProperty<QObject> *property) | - | ||||||||||||
| 397 | { | - | ||||||||||||
| 398 | QQuickShape *item = static_cast<QQuickShape *>(property->object); | - | ||||||||||||
| 399 | QQuickShapePrivate *d = QQuickShapePrivate::get(item); | - | ||||||||||||
| 400 | - | |||||||||||||
| 401 | for (QQuickShapePath *p : d->sp) | - | ||||||||||||
| 402 | QObject::disconnect(p, qFlagLocation("2""shapePathChanged()" "\0" __FILE__ ":" "876"), item, qFlagLocation("1""_q_shapePathChanged()" "\0" __FILE__ ":" "876")); never executed: QObject::disconnect(p, qFlagLocation("2""shapePathChanged()" "\0" __FILE__ ":" "876"), item, qFlagLocation("1""_q_shapePathChanged()" "\0" __FILE__ ":" "876")); | 0 | ||||||||||||
| 403 | - | |||||||||||||
| 404 | d->sp.clear(); | - | ||||||||||||
| 405 | - | |||||||||||||
| 406 | QQuickItemPrivate::data_clear(property); | - | ||||||||||||
| 407 | - | |||||||||||||
| 408 | if (d->componentComplete
| 0 | ||||||||||||
| 409 | d->_q_shapePathChanged(); never executed: d->_q_shapePathChanged(); | 0 | ||||||||||||
| 410 | } never executed: end of block | 0 | ||||||||||||
| 411 | QQmlListProperty<QObject> QQuickShape::data() | - | ||||||||||||
| 412 | { | - | ||||||||||||
| 413 | return executed 118 times by 2 tests: QQmlListProperty<QObject>(this,return QQmlListProperty<QObject>(this, nullptr, vpe_append, QQuickItemPrivate::data_count, QQuickItemPrivate::data_at, vpe_clear);Executed by:
executed 118 times by 2 tests: return QQmlListProperty<QObject>(this, nullptr, vpe_append, QQuickItemPrivate::data_count, QQuickItemPrivate::data_at, vpe_clear);Executed by:
| 118 | ||||||||||||
| 414 | nullptr, executed 118 times by 2 tests: return QQmlListProperty<QObject>(this, nullptr, vpe_append, QQuickItemPrivate::data_count, QQuickItemPrivate::data_at, vpe_clear);Executed by:
| 118 | ||||||||||||
| 415 | vpe_append, executed 118 times by 2 tests: return QQmlListProperty<QObject>(this, nullptr, vpe_append, QQuickItemPrivate::data_count, QQuickItemPrivate::data_at, vpe_clear);Executed by:
| 118 | ||||||||||||
| 416 | QQuickItemPrivate::data_count, executed 118 times by 2 tests: return QQmlListProperty<QObject>(this, nullptr, vpe_append, QQuickItemPrivate::data_count, QQuickItemPrivate::data_at, vpe_clear);Executed by:
| 118 | ||||||||||||
| 417 | QQuickItemPrivate::data_at, executed 118 times by 2 tests: return QQmlListProperty<QObject>(this, nullptr, vpe_append, QQuickItemPrivate::data_count, QQuickItemPrivate::data_at, vpe_clear);Executed by:
| 118 | ||||||||||||
| 418 | vpe_clear); executed 118 times by 2 tests: return QQmlListProperty<QObject>(this, nullptr, vpe_append, QQuickItemPrivate::data_count, QQuickItemPrivate::data_at, vpe_clear);Executed by:
| 118 | ||||||||||||
| 419 | } | - | ||||||||||||
| 420 | - | |||||||||||||
| 421 | void QQuickShape::classBegin() | - | ||||||||||||
| 422 | { | - | ||||||||||||
| 423 | QQuickItem::classBegin(); | - | ||||||||||||
| 424 | } executed 112 times by 2 tests: end of blockExecuted by:
| 112 | ||||||||||||
| 425 | - | |||||||||||||
| 426 | void QQuickShape::componentComplete() | - | ||||||||||||
| 427 | { | - | ||||||||||||
| 428 | QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 429 | - | |||||||||||||
| 430 | QQuickItem::componentComplete(); | - | ||||||||||||
| 431 | - | |||||||||||||
| 432 | for (QQuickShapePath *p : d->sp) | - | ||||||||||||
| 433 | connect(p, qFlagLocation("2""shapePathChanged()" "\0" __FILE__ ":" "918"), this, qFlagLocation("1""_q_shapePathChanged()" "\0" __FILE__ ":" "918")); executed 1072 times by 2 tests: connect(p, qFlagLocation("2""shapePathChanged()" "\0" __FILE__ ":" "918"), this, qFlagLocation("1""_q_shapePathChanged()" "\0" __FILE__ ":" "918"));Executed by:
| 1072 | ||||||||||||
| 434 | - | |||||||||||||
| 435 | d->_q_shapePathChanged(); | - | ||||||||||||
| 436 | } executed 112 times by 2 tests: end of blockExecuted by:
| 112 | ||||||||||||
| 437 | - | |||||||||||||
| 438 | void QQuickShape::updatePolish() | - | ||||||||||||
| 439 | { | - | ||||||||||||
| 440 | QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 441 | - | |||||||||||||
| 442 | const int currentEffectRefCount = d->extra.isAllocated()
| 0-91 | ||||||||||||
| 443 | if (!d->spChanged
| 0-91 | ||||||||||||
| 444 | return; never executed: return; | 0 | ||||||||||||
| 445 | - | |||||||||||||
| 446 | d->spChanged = false; | - | ||||||||||||
| 447 | d->effectRefCount = currentEffectRefCount; | - | ||||||||||||
| 448 | - | |||||||||||||
| 449 | if (!d->renderer
| 0-91 | ||||||||||||
| 450 | d->createRenderer(); | - | ||||||||||||
| 451 | if (!d->renderer
| 0-91 | ||||||||||||
| 452 | return; never executed: return; | 0 | ||||||||||||
| 453 | rendererChanged(); | - | ||||||||||||
| 454 | } executed 91 times by 2 tests: end of blockExecuted by:
| 91 | ||||||||||||
| 455 | - | |||||||||||||
| 456 | - | |||||||||||||
| 457 | - | |||||||||||||
| 458 | - | |||||||||||||
| 459 | if (isVisible()
| 0-91 | ||||||||||||
| 460 | d->sync(); executed 91 times by 2 tests: d->sync();Executed by:
| 91 | ||||||||||||
| 461 | - | |||||||||||||
| 462 | update(); | - | ||||||||||||
| 463 | } executed 91 times by 2 tests: end of blockExecuted by:
| 91 | ||||||||||||
| 464 | - | |||||||||||||
| 465 | void QQuickShape::itemChange(ItemChange change, const ItemChangeData &data) | - | ||||||||||||
| 466 | { | - | ||||||||||||
| 467 | QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 468 | - | |||||||||||||
| 469 | - | |||||||||||||
| 470 | if (change == ItemVisibleHasChanged
| 40-440 | ||||||||||||
| 471 | d->_q_shapePathChanged(); executed 40 times by 1 test: d->_q_shapePathChanged();Executed by:
| 40 | ||||||||||||
| 472 | - | |||||||||||||
| 473 | QQuickItem::itemChange(change, data); | - | ||||||||||||
| 474 | } executed 522 times by 2 tests: end of blockExecuted by:
| 522 | ||||||||||||
| 475 | - | |||||||||||||
| 476 | QSGNode *QQuickShape::updatePaintNode(QSGNode *node, UpdatePaintNodeData *) | - | ||||||||||||
| 477 | { | - | ||||||||||||
| 478 | - | |||||||||||||
| 479 | - | |||||||||||||
| 480 | - | |||||||||||||
| 481 | QQuickShapePrivate * const d = d_func(); | - | ||||||||||||
| 482 | if (d->renderer
| 0-91 | ||||||||||||
| 483 | if (!node
| 0-91 | ||||||||||||
| 484 | node = d->createNode(); executed 91 times by 2 tests: node = d->createNode();Executed by:
| 91 | ||||||||||||
| 485 | d->renderer->updateNode(); | - | ||||||||||||
| 486 | } executed 91 times by 2 tests: end of blockExecuted by:
| 91 | ||||||||||||
| 487 | return executed 91 times by 2 tests: node;return node;Executed by:
executed 91 times by 2 tests: return node;Executed by:
| 91 | ||||||||||||
| 488 | } | - | ||||||||||||
| 489 | - | |||||||||||||
| 490 | - | |||||||||||||
| 491 | void QQuickShapePrivate::createRenderer() | - | ||||||||||||
| 492 | { | - | ||||||||||||
| 493 | QQuickShape * const q = q_func(); | - | ||||||||||||
| 494 | QSGRendererInterface *ri = q->window()->rendererInterface(); | - | ||||||||||||
| 495 | if (!ri
| 0-91 | ||||||||||||
| 496 | return; never executed: return; | 0 | ||||||||||||
| 497 | - | |||||||||||||
| 498 | switch (ri->graphicsApi()) { | - | ||||||||||||
| 499 | - | |||||||||||||
| 500 | case executed 83 times by 1 test: QSGRendererInterface::OpenGL:case QSGRendererInterface::OpenGL:Executed by:
executed 83 times by 1 test: case QSGRendererInterface::OpenGL:Executed by:
| 83 | ||||||||||||
| 501 | if (enableVendorExts
| 0-83 | ||||||||||||
| 502 | rendererType = QQuickShape::NvprRenderer; | - | ||||||||||||
| 503 | renderer = new QQuickShapeNvprRenderer; | - | ||||||||||||
| 504 | } never executed: else {end of block | 0 | ||||||||||||
| 505 | rendererType = QQuickShape::GeometryRenderer; | - | ||||||||||||
| 506 | renderer = new QQuickShapeGenericRenderer(q); | - | ||||||||||||
| 507 | } executed 83 times by 1 test: end of blockExecuted by:
| 83 | ||||||||||||
| 508 | break; executed 83 times by 1 test: break;Executed by:
| 83 | ||||||||||||
| 509 | - | |||||||||||||
| 510 | case executed 8 times by 1 test: QSGRendererInterface::Software:case QSGRendererInterface::Software:Executed by:
executed 8 times by 1 test: case QSGRendererInterface::Software:Executed by:
| 8 | ||||||||||||
| 511 | rendererType = QQuickShape::SoftwareRenderer; | - | ||||||||||||
| 512 | renderer = new QQuickShapeSoftwareRenderer; | - | ||||||||||||
| 513 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||
| 514 | default never executed: :default:never executed: default: | 0 | ||||||||||||
| 515 | QMessageLogger(__FILE__, 1000, __PRETTY_FUNCTION__).warning("No path backend for this graphics API yet"); | - | ||||||||||||
| 516 | break; never executed: break; | 0 | ||||||||||||
| 517 | } | - | ||||||||||||
| 518 | } | - | ||||||||||||
| 519 | - | |||||||||||||
| 520 | - | |||||||||||||
| 521 | QSGNode *QQuickShapePrivate::createNode() | - | ||||||||||||
| 522 | { | - | ||||||||||||
| 523 | QQuickShape * const q = q_func(); | - | ||||||||||||
| 524 | QSGNode *node = nullptr; | - | ||||||||||||
| 525 | if (!q->window()
| 0-91 | ||||||||||||
| 526 | return never executed: node;return node;never executed: return node; | 0 | ||||||||||||
| 527 | QSGRendererInterface *ri = q->window()->rendererInterface(); | - | ||||||||||||
| 528 | if (!ri
| 0-91 | ||||||||||||
| 529 | return never executed: node;return node;never executed: return node; | 0 | ||||||||||||
| 530 | - | |||||||||||||
| 531 | switch (ri->graphicsApi()) { | - | ||||||||||||
| 532 | - | |||||||||||||
| 533 | case executed 83 times by 1 test: QSGRendererInterface::OpenGL:case QSGRendererInterface::OpenGL:Executed by:
executed 83 times by 1 test: case QSGRendererInterface::OpenGL:Executed by:
| 83 | ||||||||||||
| 534 | if (enableVendorExts
| 0-83 | ||||||||||||
| 535 | node = new QQuickShapeNvprRenderNode; | - | ||||||||||||
| 536 | static_cast<QQuickShapeNvprRenderer *>(renderer)->setNode( | - | ||||||||||||
| 537 | static_cast<QQuickShapeNvprRenderNode *>(node)); | - | ||||||||||||
| 538 | } never executed: else {end of block | 0 | ||||||||||||
| 539 | node = new QQuickShapeGenericNode; | - | ||||||||||||
| 540 | static_cast<QQuickShapeGenericRenderer *>(renderer)->setRootNode( | - | ||||||||||||
| 541 | static_cast<QQuickShapeGenericNode *>(node)); | - | ||||||||||||
| 542 | } executed 83 times by 1 test: end of blockExecuted by:
| 83 | ||||||||||||
| 543 | break; executed 83 times by 1 test: break;Executed by:
| 83 | ||||||||||||
| 544 | - | |||||||||||||
| 545 | case executed 8 times by 1 test: QSGRendererInterface::Software:case QSGRendererInterface::Software:Executed by:
executed 8 times by 1 test: case QSGRendererInterface::Software:Executed by:
| 8 | ||||||||||||
| 546 | node = new QQuickShapeSoftwareRenderNode(q); | - | ||||||||||||
| 547 | static_cast<QQuickShapeSoftwareRenderer *>(renderer)->setNode( | - | ||||||||||||
| 548 | static_cast<QQuickShapeSoftwareRenderNode *>(node)); | - | ||||||||||||
| 549 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||
| 550 | default never executed: :default:never executed: default: | 0 | ||||||||||||
| 551 | QMessageLogger(__FILE__, 1036, __PRETTY_FUNCTION__).warning("No path backend for this graphics API yet"); | - | ||||||||||||
| 552 | break; never executed: break; | 0 | ||||||||||||
| 553 | } | - | ||||||||||||
| 554 | - | |||||||||||||
| 555 | return executed 91 times by 2 tests: node;return node;Executed by:
executed 91 times by 2 tests: return node;Executed by:
| 91 | ||||||||||||
| 556 | } | - | ||||||||||||
| 557 | - | |||||||||||||
| 558 | void QQuickShapePrivate::asyncShapeReady(void *data) | - | ||||||||||||
| 559 | { | - | ||||||||||||
| 560 | QQuickShapePrivate *self = static_cast<QQuickShapePrivate *>(data); | - | ||||||||||||
| 561 | self->setStatus(QQuickShape::Ready); | - | ||||||||||||
| 562 | if (self->syncTimingActive
| 0 | ||||||||||||
| 563 | QMessageLogger(__FILE__, 1048, __PRETTY_FUNCTION__).debug("[Shape %p] [%d] [dirty=0x%x] async update took %lld ms", never executed: QMessageLogger(__FILE__, 1048, __PRETTY_FUNCTION__).debug("[Shape %p] [%d] [dirty=0x%x] async update took %lld ms", self->q_func(), self->syncTimeCounter, self->syncTimingTotalDirty, self->syncTimer.elapsed()); | 0 | ||||||||||||
| 564 | self->q_func(), self->syncTimeCounter, self->syncTimingTotalDirty, self->syncTimer.elapsed()); never executed: QMessageLogger(__FILE__, 1048, __PRETTY_FUNCTION__).debug("[Shape %p] [%d] [dirty=0x%x] async update took %lld ms", self->q_func(), self->syncTimeCounter, self->syncTimingTotalDirty, self->syncTimer.elapsed()); | 0 | ||||||||||||
| 565 | } never executed: end of block | 0 | ||||||||||||
| 566 | - | |||||||||||||
| 567 | void QQuickShapePrivate::sync() | - | ||||||||||||
| 568 | { | - | ||||||||||||
| 569 | syncTimingTotalDirty = 0; | - | ||||||||||||
| 570 | syncTimingActive = QQSHAPE_LOG_TIME_DIRTY_SYNC().isDebugEnabled(); | - | ||||||||||||
| 571 | if (syncTimingActive
| 0-91 | ||||||||||||
| 572 | syncTimer.start(); never executed: syncTimer.start(); | 0 | ||||||||||||
| 573 | - | |||||||||||||
| 574 | const bool useAsync = async
| 0-87 | ||||||||||||
| 575 | if (useAsync
| 4-87 | ||||||||||||
| 576 | setStatus(QQuickShape::Processing); | - | ||||||||||||
| 577 | renderer->setAsyncCallback(asyncShapeReady, this); | - | ||||||||||||
| 578 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 579 | - | |||||||||||||
| 580 | const int count = sp.count(); | - | ||||||||||||
| 581 | renderer->beginSync(count); | - | ||||||||||||
| 582 | - | |||||||||||||
| 583 | for (int i = 0; i < count
| 91-1051 | ||||||||||||
| 584 | QQuickShapePath *p = sp[i]; | - | ||||||||||||
| 585 | int &dirty(QQuickShapePathPrivate::get(p)->dirty); | - | ||||||||||||
| 586 | syncTimingTotalDirty |= dirty; | - | ||||||||||||
| 587 | - | |||||||||||||
| 588 | if (dirty & QQuickShapePathPrivate::DirtyPath
| 0-1051 | ||||||||||||
| 589 | renderer->setPath(i, p); executed 1051 times by 2 tests: renderer->setPath(i, p);Executed by:
| 1051 | ||||||||||||
| 590 | if (dirty & QQuickShapePathPrivate::DirtyStrokeColor
| 0-1051 | ||||||||||||
| 591 | renderer->setStrokeColor(i, p->strokeColor()); executed 1051 times by 2 tests: renderer->setStrokeColor(i, p->strokeColor());Executed by:
| 1051 | ||||||||||||
| 592 | if (dirty & QQuickShapePathPrivate::DirtyStrokeWidth
| 0-1051 | ||||||||||||
| 593 | renderer->setStrokeWidth(i, p->strokeWidth()); executed 1051 times by 2 tests: renderer->setStrokeWidth(i, p->strokeWidth());Executed by:
| 1051 | ||||||||||||
| 594 | if (dirty & QQuickShapePathPrivate::DirtyFillColor
| 0-1051 | ||||||||||||
| 595 | renderer->setFillColor(i, p->fillColor()); executed 1051 times by 2 tests: renderer->setFillColor(i, p->fillColor());Executed by:
| 1051 | ||||||||||||
| 596 | if (dirty & QQuickShapePathPrivate::DirtyFillRule
| 0-1051 | ||||||||||||
| 597 | renderer->setFillRule(i, p->fillRule()); executed 1051 times by 2 tests: renderer->setFillRule(i, p->fillRule());Executed by:
| 1051 | ||||||||||||
| 598 | if (dirty & QQuickShapePathPrivate::DirtyStyle
| 0-1051 | ||||||||||||
| 599 | renderer->setJoinStyle(i, p->joinStyle(), p->miterLimit()); | - | ||||||||||||
| 600 | renderer->setCapStyle(i, p->capStyle()); | - | ||||||||||||
| 601 | } executed 1051 times by 2 tests: end of blockExecuted by:
| 1051 | ||||||||||||
| 602 | if (dirty & QQuickShapePathPrivate::DirtyDash
| 0-1051 | ||||||||||||
| 603 | renderer->setStrokeStyle(i, p->strokeStyle(), p->dashOffset(), p->dashPattern()); executed 1051 times by 2 tests: renderer->setStrokeStyle(i, p->strokeStyle(), p->dashOffset(), p->dashPattern());Executed by:
| 1051 | ||||||||||||
| 604 | if (dirty & QQuickShapePathPrivate::DirtyFillGradient
| 0-1051 | ||||||||||||
| 605 | renderer->setFillGradient(i, p->fillGradient()); executed 1051 times by 2 tests: renderer->setFillGradient(i, p->fillGradient());Executed by:
| 1051 | ||||||||||||
| 606 | - | |||||||||||||
| 607 | dirty = 0; | - | ||||||||||||
| 608 | } executed 1051 times by 2 tests: end of blockExecuted by:
| 1051 | ||||||||||||
| 609 | - | |||||||||||||
| 610 | if (syncTimingTotalDirty
| 0-91 | ||||||||||||
| 611 | ++ executed 91 times by 2 tests: syncTimeCounter;++syncTimeCounter;Executed by:
executed 91 times by 2 tests: ++syncTimeCounter;Executed by:
| 91 | ||||||||||||
| 612 | else | - | ||||||||||||
| 613 | syncTimingActive = false; never executed: syncTimingActive = false; | 0 | ||||||||||||
| 614 | - | |||||||||||||
| 615 | renderer->endSync(useAsync); | - | ||||||||||||
| 616 | - | |||||||||||||
| 617 | if (!useAsync
| 4-87 | ||||||||||||
| 618 | setStatus(QQuickShape::Ready); | - | ||||||||||||
| 619 | if (syncTimingActive
| 0-87 | ||||||||||||
| 620 | QMessageLogger(__FILE__, 1105, __PRETTY_FUNCTION__).debug("[Shape %p] [%d] [dirty=0x%x] update took %lld ms", never executed: QMessageLogger(__FILE__, 1105, __PRETTY_FUNCTION__).debug("[Shape %p] [%d] [dirty=0x%x] update took %lld ms", q_func(), syncTimeCounter, syncTimingTotalDirty, syncTimer.elapsed()); | 0 | ||||||||||||
| 621 | q_func(), syncTimeCounter, syncTimingTotalDirty, syncTimer.elapsed()); never executed: QMessageLogger(__FILE__, 1105, __PRETTY_FUNCTION__).debug("[Shape %p] [%d] [dirty=0x%x] update took %lld ms", q_func(), syncTimeCounter, syncTimingTotalDirty, syncTimer.elapsed()); | 0 | ||||||||||||
| 622 | } executed 87 times by 2 tests: end of blockExecuted by:
| 87 | ||||||||||||
| 623 | } executed 91 times by 2 tests: end of blockExecuted by:
| 91 | ||||||||||||
| 624 | QQuickShapeGradient::QQuickShapeGradient(QObject *parent) | - | ||||||||||||
| 625 | : QQuickGradient(parent), | - | ||||||||||||
| 626 | m_spread(PadSpread) | - | ||||||||||||
| 627 | { | - | ||||||||||||
| 628 | } executed 32 times by 2 tests: end of blockExecuted by:
| 32 | ||||||||||||
| 629 | QQuickShapeGradient::SpreadMode QQuickShapeGradient::spread() const | - | ||||||||||||
| 630 | { | - | ||||||||||||
| 631 | return executed 29 times by 2 tests: m_spread;return m_spread;Executed by:
executed 29 times by 2 tests: return m_spread;Executed by:
| 29 | ||||||||||||
| 632 | } | - | ||||||||||||
| 633 | - | |||||||||||||
| 634 | void QQuickShapeGradient::setSpread(SpreadMode mode) | - | ||||||||||||
| 635 | { | - | ||||||||||||
| 636 | if (m_spread != mode
| 0 | ||||||||||||
| 637 | m_spread = mode; | - | ||||||||||||
| 638 | spreadChanged(); | - | ||||||||||||
| 639 | updated(); | - | ||||||||||||
| 640 | } never executed: end of block | 0 | ||||||||||||
| 641 | } never executed: end of block | 0 | ||||||||||||
| 642 | QQuickShapeLinearGradient::QQuickShapeLinearGradient(QObject *parent) | - | ||||||||||||
| 643 | : QQuickShapeGradient(parent) | - | ||||||||||||
| 644 | { | - | ||||||||||||
| 645 | } executed 20 times by 2 tests: end of blockExecuted by:
| 20 | ||||||||||||
| 646 | qreal QQuickShapeLinearGradient::x1() const | - | ||||||||||||
| 647 | { | - | ||||||||||||
| 648 | return executed 18 times by 2 tests: m_start.x();return m_start.x();Executed by:
executed 18 times by 2 tests: return m_start.x();Executed by:
| 18 | ||||||||||||
| 649 | } | - | ||||||||||||
| 650 | - | |||||||||||||
| 651 | void QQuickShapeLinearGradient::setX1(qreal v) | - | ||||||||||||
| 652 | { | - | ||||||||||||
| 653 | if (m_start.x() != v
| 0-10 | ||||||||||||
| 654 | m_start.setX(v); | - | ||||||||||||
| 655 | x1Changed(); | - | ||||||||||||
| 656 | updated(); | - | ||||||||||||
| 657 | } executed 10 times by 2 tests: end of blockExecuted by:
| 10 | ||||||||||||
| 658 | } executed 10 times by 2 tests: end of blockExecuted by:
| 10 | ||||||||||||
| 659 | - | |||||||||||||
| 660 | qreal QQuickShapeLinearGradient::y1() const | - | ||||||||||||
| 661 | { | - | ||||||||||||
| 662 | return executed 16 times by 2 tests: m_start.y();return m_start.y();Executed by:
executed 16 times by 2 tests: return m_start.y();Executed by:
| 16 | ||||||||||||
| 663 | } | - | ||||||||||||
| 664 | - | |||||||||||||
| 665 | void QQuickShapeLinearGradient::setY1(qreal v) | - | ||||||||||||
| 666 | { | - | ||||||||||||
| 667 | if (m_start.y() != v
| 0-14 | ||||||||||||
| 668 | m_start.setY(v); | - | ||||||||||||
| 669 | y1Changed(); | - | ||||||||||||
| 670 | updated(); | - | ||||||||||||
| 671 | } executed 14 times by 2 tests: end of blockExecuted by:
| 14 | ||||||||||||
| 672 | } executed 14 times by 2 tests: end of blockExecuted by:
| 14 | ||||||||||||
| 673 | - | |||||||||||||
| 674 | qreal QQuickShapeLinearGradient::x2() const | - | ||||||||||||
| 675 | { | - | ||||||||||||
| 676 | return executed 16 times by 2 tests: m_end.x();return m_end.x();Executed by:
executed 16 times by 2 tests: return m_end.x();Executed by:
| 16 | ||||||||||||
| 677 | } | - | ||||||||||||
| 678 | - | |||||||||||||
| 679 | void QQuickShapeLinearGradient::setX2(qreal v) | - | ||||||||||||
| 680 | { | - | ||||||||||||
| 681 | if (m_end.x() != v
| 0-12 | ||||||||||||
| 682 | m_end.setX(v); | - | ||||||||||||
| 683 | x2Changed(); | - | ||||||||||||
| 684 | updated(); | - | ||||||||||||
| 685 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||
| 686 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||
| 687 | - | |||||||||||||
| 688 | qreal QQuickShapeLinearGradient::y2() const | - | ||||||||||||
| 689 | { | - | ||||||||||||
| 690 | return executed 16 times by 2 tests: m_end.y();return m_end.y();Executed by:
executed 16 times by 2 tests: return m_end.y();Executed by:
| 16 | ||||||||||||
| 691 | } | - | ||||||||||||
| 692 | - | |||||||||||||
| 693 | void QQuickShapeLinearGradient::setY2(qreal v) | - | ||||||||||||
| 694 | { | - | ||||||||||||
| 695 | if (m_end.y() != v
| 0-20 | ||||||||||||
| 696 | m_end.setY(v); | - | ||||||||||||
| 697 | y2Changed(); | - | ||||||||||||
| 698 | updated(); | - | ||||||||||||
| 699 | } executed 20 times by 2 tests: end of blockExecuted by:
| 20 | ||||||||||||
| 700 | } executed 20 times by 2 tests: end of blockExecuted by:
| 20 | ||||||||||||
| 701 | QQuickShapeRadialGradient::QQuickShapeRadialGradient(QObject *parent) | - | ||||||||||||
| 702 | : QQuickShapeGradient(parent) | - | ||||||||||||
| 703 | { | - | ||||||||||||
| 704 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 705 | qreal QQuickShapeRadialGradient::centerX() const | - | ||||||||||||
| 706 | { | - | ||||||||||||
| 707 | return executed 6 times by 2 tests: m_centerPoint.x();return m_centerPoint.x();Executed by:
executed 6 times by 2 tests: return m_centerPoint.x();Executed by:
| 6 | ||||||||||||
| 708 | } | - | ||||||||||||
| 709 | - | |||||||||||||
| 710 | void QQuickShapeRadialGradient::setCenterX(qreal v) | - | ||||||||||||
| 711 | { | - | ||||||||||||
| 712 | if (m_centerPoint.x() != v
| 0-6 | ||||||||||||
| 713 | m_centerPoint.setX(v); | - | ||||||||||||
| 714 | centerXChanged(); | - | ||||||||||||
| 715 | updated(); | - | ||||||||||||
| 716 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 717 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 718 | - | |||||||||||||
| 719 | qreal QQuickShapeRadialGradient::centerY() const | - | ||||||||||||
| 720 | { | - | ||||||||||||
| 721 | return executed 6 times by 2 tests: m_centerPoint.y();return m_centerPoint.y();Executed by:
executed 6 times by 2 tests: return m_centerPoint.y();Executed by:
| 6 | ||||||||||||
| 722 | } | - | ||||||||||||
| 723 | - | |||||||||||||
| 724 | void QQuickShapeRadialGradient::setCenterY(qreal v) | - | ||||||||||||
| 725 | { | - | ||||||||||||
| 726 | if (m_centerPoint.y() != v
| 0-6 | ||||||||||||
| 727 | m_centerPoint.setY(v); | - | ||||||||||||
| 728 | centerYChanged(); | - | ||||||||||||
| 729 | updated(); | - | ||||||||||||
| 730 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 731 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 732 | qreal QQuickShapeRadialGradient::centerRadius() const | - | ||||||||||||
| 733 | { | - | ||||||||||||
| 734 | return executed 6 times by 2 tests: m_centerRadius;return m_centerRadius;Executed by:
executed 6 times by 2 tests: return m_centerRadius;Executed by:
| 6 | ||||||||||||
| 735 | } | - | ||||||||||||
| 736 | - | |||||||||||||
| 737 | void QQuickShapeRadialGradient::setCenterRadius(qreal v) | - | ||||||||||||
| 738 | { | - | ||||||||||||
| 739 | if (m_centerRadius != v
| 0-6 | ||||||||||||
| 740 | m_centerRadius = v; | - | ||||||||||||
| 741 | centerRadiusChanged(); | - | ||||||||||||
| 742 | updated(); | - | ||||||||||||
| 743 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 744 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 745 | - | |||||||||||||
| 746 | qreal QQuickShapeRadialGradient::focalX() const | - | ||||||||||||
| 747 | { | - | ||||||||||||
| 748 | return executed 6 times by 2 tests: m_focalPoint.x();return m_focalPoint.x();Executed by:
executed 6 times by 2 tests: return m_focalPoint.x();Executed by:
| 6 | ||||||||||||
| 749 | } | - | ||||||||||||
| 750 | - | |||||||||||||
| 751 | void QQuickShapeRadialGradient::setFocalX(qreal v) | - | ||||||||||||
| 752 | { | - | ||||||||||||
| 753 | if (m_focalPoint.x() != v
| 0-6 | ||||||||||||
| 754 | m_focalPoint.setX(v); | - | ||||||||||||
| 755 | focalXChanged(); | - | ||||||||||||
| 756 | updated(); | - | ||||||||||||
| 757 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 758 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 759 | - | |||||||||||||
| 760 | qreal QQuickShapeRadialGradient::focalY() const | - | ||||||||||||
| 761 | { | - | ||||||||||||
| 762 | return executed 6 times by 2 tests: m_focalPoint.y();return m_focalPoint.y();Executed by:
executed 6 times by 2 tests: return m_focalPoint.y();Executed by:
| 6 | ||||||||||||
| 763 | } | - | ||||||||||||
| 764 | - | |||||||||||||
| 765 | void QQuickShapeRadialGradient::setFocalY(qreal v) | - | ||||||||||||
| 766 | { | - | ||||||||||||
| 767 | if (m_focalPoint.y() != v
| 0-6 | ||||||||||||
| 768 | m_focalPoint.setY(v); | - | ||||||||||||
| 769 | focalYChanged(); | - | ||||||||||||
| 770 | updated(); | - | ||||||||||||
| 771 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 772 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 773 | - | |||||||||||||
| 774 | qreal QQuickShapeRadialGradient::focalRadius() const | - | ||||||||||||
| 775 | { | - | ||||||||||||
| 776 | return executed 6 times by 2 tests: m_focalRadius;return m_focalRadius;Executed by:
executed 6 times by 2 tests: return m_focalRadius;Executed by:
| 6 | ||||||||||||
| 777 | } | - | ||||||||||||
| 778 | - | |||||||||||||
| 779 | void QQuickShapeRadialGradient::setFocalRadius(qreal v) | - | ||||||||||||
| 780 | { | - | ||||||||||||
| 781 | if (m_focalRadius != v
| 0-6 | ||||||||||||
| 782 | m_focalRadius = v; | - | ||||||||||||
| 783 | focalRadiusChanged(); | - | ||||||||||||
| 784 | updated(); | - | ||||||||||||
| 785 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 786 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 787 | QQuickShapeConicalGradient::QQuickShapeConicalGradient(QObject *parent) | - | ||||||||||||
| 788 | : QQuickShapeGradient(parent) | - | ||||||||||||
| 789 | { | - | ||||||||||||
| 790 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 791 | qreal QQuickShapeConicalGradient::centerX() const | - | ||||||||||||
| 792 | { | - | ||||||||||||
| 793 | return executed 5 times by 2 tests: m_centerPoint.x();return m_centerPoint.x();Executed by:
executed 5 times by 2 tests: return m_centerPoint.x();Executed by:
| 5 | ||||||||||||
| 794 | } | - | ||||||||||||
| 795 | - | |||||||||||||
| 796 | void QQuickShapeConicalGradient::setCenterX(qreal v) | - | ||||||||||||
| 797 | { | - | ||||||||||||
| 798 | if (m_centerPoint.x() != v
| 0-6 | ||||||||||||
| 799 | m_centerPoint.setX(v); | - | ||||||||||||
| 800 | centerXChanged(); | - | ||||||||||||
| 801 | updated(); | - | ||||||||||||
| 802 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 803 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 804 | - | |||||||||||||
| 805 | qreal QQuickShapeConicalGradient::centerY() const | - | ||||||||||||
| 806 | { | - | ||||||||||||
| 807 | return executed 5 times by 2 tests: m_centerPoint.y();return m_centerPoint.y();Executed by:
executed 5 times by 2 tests: return m_centerPoint.y();Executed by:
| 5 | ||||||||||||
| 808 | } | - | ||||||||||||
| 809 | - | |||||||||||||
| 810 | void QQuickShapeConicalGradient::setCenterY(qreal v) | - | ||||||||||||
| 811 | { | - | ||||||||||||
| 812 | if (m_centerPoint.y() != v
| 0-6 | ||||||||||||
| 813 | m_centerPoint.setY(v); | - | ||||||||||||
| 814 | centerYChanged(); | - | ||||||||||||
| 815 | updated(); | - | ||||||||||||
| 816 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 817 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 818 | qreal QQuickShapeConicalGradient::angle() const | - | ||||||||||||
| 819 | { | - | ||||||||||||
| 820 | return executed 9 times by 2 tests: m_angle;return m_angle;Executed by:
executed 9 times by 2 tests: return m_angle;Executed by:
| 9 | ||||||||||||
| 821 | } | - | ||||||||||||
| 822 | - | |||||||||||||
| 823 | void QQuickShapeConicalGradient::setAngle(qreal v) | - | ||||||||||||
| 824 | { | - | ||||||||||||
| 825 | if (m_angle != v
| 2-4 | ||||||||||||
| 826 | m_angle = v; | - | ||||||||||||
| 827 | angleChanged(); | - | ||||||||||||
| 828 | updated(); | - | ||||||||||||
| 829 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 830 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 831 | - | |||||||||||||
| 832 | - | |||||||||||||
| 833 | - | |||||||||||||
| 834 | - | |||||||||||||
| 835 | class QQuickShapeGradientCacheWrapper | - | ||||||||||||
| 836 | { | - | ||||||||||||
| 837 | public: | - | ||||||||||||
| 838 | QQuickShapeGradientCache *get(QOpenGLContext *context) | - | ||||||||||||
| 839 | { | - | ||||||||||||
| 840 | return executed 15 times by 1 test: m_resource.value<QQuickShapeGradientCache>(context);return m_resource.value<QQuickShapeGradientCache>(context);Executed by:
executed 15 times by 1 test: return m_resource.value<QQuickShapeGradientCache>(context);Executed by:
| 15 | ||||||||||||
| 841 | } | - | ||||||||||||
| 842 | - | |||||||||||||
| 843 | private: | - | ||||||||||||
| 844 | QOpenGLMultiGroupSharedResource m_resource; | - | ||||||||||||
| 845 | }; | - | ||||||||||||
| 846 | - | |||||||||||||
| 847 | QQuickShapeGradientCache *QQuickShapeGradientCache::currentCache() | - | ||||||||||||
| 848 | { | - | ||||||||||||
| 849 | static QQuickShapeGradientCacheWrapper qt_path_gradient_caches; | - | ||||||||||||
| 850 | return executed 15 times by 1 test: qt_path_gradient_caches.get(QOpenGLContext::currentContext());return qt_path_gradient_caches.get(QOpenGLContext::currentContext());Executed by:
executed 15 times by 1 test: return qt_path_gradient_caches.get(QOpenGLContext::currentContext());Executed by:
| 15 | ||||||||||||
| 851 | } | - | ||||||||||||
| 852 | - | |||||||||||||
| 853 | - | |||||||||||||
| 854 | QQuickShapeGradientCache::~QQuickShapeGradientCache() | - | ||||||||||||
| 855 | { | - | ||||||||||||
| 856 | m_cache.clear(); | - | ||||||||||||
| 857 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||
| 858 | - | |||||||||||||
| 859 | void QQuickShapeGradientCache::invalidateResource() | - | ||||||||||||
| 860 | { | - | ||||||||||||
| 861 | m_cache.clear(); | - | ||||||||||||
| 862 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||
| 863 | - | |||||||||||||
| 864 | void QQuickShapeGradientCache::freeResource(QOpenGLContext *) | - | ||||||||||||
| 865 | { | - | ||||||||||||
| 866 | qDeleteAll(m_cache); | - | ||||||||||||
| 867 | m_cache.clear(); | - | ||||||||||||
| 868 | } never executed: end of block | 0 | ||||||||||||
| 869 | - | |||||||||||||
| 870 | static void generateGradientColorTable(const QQuickShapeGradientCache::Key &gradient, | - | ||||||||||||
| 871 | uint *colorTable, int size, float opacity) | - | ||||||||||||
| 872 | { | - | ||||||||||||
| 873 | int pos = 0; | - | ||||||||||||
| 874 | const QGradientStops &s = gradient.stops; | - | ||||||||||||
| 875 | const bool colorInterpolation = true; | - | ||||||||||||
| 876 | - | |||||||||||||
| 877 | uint alpha = qRound(opacity * 256); | - | ||||||||||||
| 878 | uint current_color = ((((s[0].second.rgba() >> 24) * alpha) >> 8) << 24) | (s[0].second.rgba() & 0x00ffffff); | - | ||||||||||||
| 879 | qreal incr = 1.0 / qreal(size); | - | ||||||||||||
| 880 | qreal fpos = 1.5 * incr; | - | ||||||||||||
| 881 | colorTable[pos++] = ARGB2RGBA(qPremultiply(current_color)); | - | ||||||||||||
| 882 | - | |||||||||||||
| 883 | while (fpos <= s.first().first
| 0-15 | ||||||||||||
| 884 | colorTable[pos] = colorTable[pos - 1]; | - | ||||||||||||
| 885 | pos++; | - | ||||||||||||
| 886 | fpos += incr; | - | ||||||||||||
| 887 | } never executed: end of block | 0 | ||||||||||||
| 888 | - | |||||||||||||
| 889 | if (colorInterpolation
| 0-15 | ||||||||||||
| 890 | current_color = qPremultiply(current_color); executed 15 times by 1 test: current_color = qPremultiply(current_color);Executed by:
| 15 | ||||||||||||
| 891 | - | |||||||||||||
| 892 | const int sLast = s.size() - 1; | - | ||||||||||||
| 893 | for (int i = 0; i < sLast
| 15-66 | ||||||||||||
| 894 | qreal delta = 1/(s[i+1].first - s[i].first); | - | ||||||||||||
| 895 | uint next_color = ((((s[i + 1].second.rgba() >> 24) * alpha) >> 8) << 24) | (s[i + 1].second.rgba() & 0x00ffffff); | - | ||||||||||||
| 896 | if (colorInterpolation
| 0-66 | ||||||||||||
| 897 | next_color = qPremultiply(next_color); executed 66 times by 1 test: next_color = qPremultiply(next_color);Executed by:
| 66 | ||||||||||||
| 898 | - | |||||||||||||
| 899 | while (fpos < s[i+1].first
| 0-15345 | ||||||||||||
| 900 | int dist = int(256 * ((fpos - s[i].first) * delta)); | - | ||||||||||||
| 901 | int idist = 256 - dist; | - | ||||||||||||
| 902 | if (colorInterpolation
| 0-15345 | ||||||||||||
| 903 | colorTable[pos] = ARGB2RGBA(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)); executed 15345 times by 1 test: colorTable[pos] = ARGB2RGBA(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist));Executed by:
| 15345 | ||||||||||||
| 904 | else | - | ||||||||||||
| 905 | colorTable[pos] = ARGB2RGBA(qPremultiply(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist))); never executed: colorTable[pos] = ARGB2RGBA(qPremultiply(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist))); | 0 | ||||||||||||
| 906 | ++pos; | - | ||||||||||||
| 907 | fpos += incr; | - | ||||||||||||
| 908 | } executed 15345 times by 1 test: end of blockExecuted by:
| 15345 | ||||||||||||
| 909 | current_color = next_color; | - | ||||||||||||
| 910 | } executed 66 times by 1 test: end of blockExecuted by:
| 66 | ||||||||||||
| 911 | - | |||||||||||||
| 912 | ((s.size() > 0) ? static_cast<void>(0) : qt_assert("s.size() > 0", __FILE__, 1570)); | - | ||||||||||||
| 913 | - | |||||||||||||
| 914 | uint last_color = ARGB2RGBA(qPremultiply(((((s[sLast].second.rgba() >> 24) * alpha) >> 8) << 24) | (s[sLast].second.rgba() & 0x00ffffff))); | - | ||||||||||||
| 915 | for ( ; pos < size
| 0-15 | ||||||||||||
| 916 | colorTable[pos] = last_color; never executed: colorTable[pos] = last_color; | 0 | ||||||||||||
| 917 | - | |||||||||||||
| 918 | colorTable[size-1] = last_color; | - | ||||||||||||
| 919 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||
| 920 | - | |||||||||||||
| 921 | QSGTexture *QQuickShapeGradientCache::get(const Key &grad) | - | ||||||||||||
| 922 | { | - | ||||||||||||
| 923 | QSGPlainTexture *tx = m_cache[grad]; | - | ||||||||||||
| 924 | if (!tx
| 0-15 | ||||||||||||
| 925 | QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); | - | ||||||||||||
| 926 | GLuint id; | - | ||||||||||||
| 927 | f->glGenTextures(1, &id); | - | ||||||||||||
| 928 | f->glBindTexture( | - | ||||||||||||
| 929 | 0x0DE1 | - | ||||||||||||
| 930 | , id); | - | ||||||||||||
| 931 | static const uint W = 1024; | - | ||||||||||||
| 932 | uint buf[W]; | - | ||||||||||||
| 933 | generateGradientColorTable(grad, buf, W, 1.0f); | - | ||||||||||||
| 934 | f->glTexImage2D( | - | ||||||||||||
| 935 | 0x0DE1 | - | ||||||||||||
| 936 | , 0, | - | ||||||||||||
| 937 | 0x1908 | - | ||||||||||||
| 938 | , W, 1, 0, | - | ||||||||||||
| 939 | 0x1908 | - | ||||||||||||
| 940 | , | - | ||||||||||||
| 941 | 0x1401 | - | ||||||||||||
| 942 | , buf); | - | ||||||||||||
| 943 | tx = new QSGPlainTexture; | - | ||||||||||||
| 944 | tx->setTextureId(id); | - | ||||||||||||
| 945 | switch (grad.spread) { | - | ||||||||||||
| 946 | case executed 12 times by 1 test: QQuickShapeGradient::PadSpread:case QQuickShapeGradient::PadSpread:Executed by:
executed 12 times by 1 test: case QQuickShapeGradient::PadSpread:Executed by:
| 12 | ||||||||||||
| 947 | tx->setHorizontalWrapMode(QSGTexture::ClampToEdge); | - | ||||||||||||
| 948 | tx->setVerticalWrapMode(QSGTexture::ClampToEdge); | - | ||||||||||||
| 949 | break; executed 12 times by 1 test: break;Executed by:
| 12 | ||||||||||||
| 950 | case executed 3 times by 1 test: QQuickShapeGradient::RepeatSpread:case QQuickShapeGradient::RepeatSpread:Executed by:
executed 3 times by 1 test: case QQuickShapeGradient::RepeatSpread:Executed by:
| 3 | ||||||||||||
| 951 | tx->setHorizontalWrapMode(QSGTexture::Repeat); | - | ||||||||||||
| 952 | tx->setVerticalWrapMode(QSGTexture::Repeat); | - | ||||||||||||
| 953 | break; executed 3 times by 1 test: break;Executed by:
| 3 | ||||||||||||
| 954 | case never executed: QQuickShapeGradient::ReflectSpread:case QQuickShapeGradient::ReflectSpread:never executed: case QQuickShapeGradient::ReflectSpread: | 0 | ||||||||||||
| 955 | tx->setHorizontalWrapMode(QSGTexture::MirroredRepeat); | - | ||||||||||||
| 956 | tx->setVerticalWrapMode(QSGTexture::MirroredRepeat); | - | ||||||||||||
| 957 | break; never executed: break; | 0 | ||||||||||||
| 958 | default never executed: :default:never executed: default: | 0 | ||||||||||||
| 959 | QMessageLogger(__FILE__, 1607, __PRETTY_FUNCTION__).warning("Unknown gradient spread mode %d", grad.spread); | - | ||||||||||||
| 960 | break; never executed: break; | 0 | ||||||||||||
| 961 | } | - | ||||||||||||
| 962 | tx->setFiltering(QSGTexture::Linear); | - | ||||||||||||
| 963 | m_cache[grad] = tx; | - | ||||||||||||
| 964 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||
| 965 | return executed 15 times by 1 test: tx;return tx;Executed by:
executed 15 times by 1 test: return tx;Executed by:
| 15 | ||||||||||||
| 966 | } | - | ||||||||||||
| 967 | - | |||||||||||||
| 968 | - | |||||||||||||
| 969 | - | |||||||||||||
| 970 | - | |||||||||||||
| 971 | - | |||||||||||||
| Switch to Source code | Preprocessed file |