| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | typedef QPenPrivate QPenData; | - |
| 6 | inline QPenPrivate::QPenPrivate(const QBrush &_brush, qreal _width, Qt::PenStyle penStyle, | - |
| 7 | Qt::PenCapStyle _capStyle, Qt::PenJoinStyle _joinStyle, bool _defaultWidth) | - |
| 8 | : ref(1), dashOffset(0), miterLimit(2), | - |
| 9 | cosmetic(false), defaultWidth(_defaultWidth) | - |
| 10 | { | - |
| 11 | width = _width; | - |
| 12 | brush = _brush; | - |
| 13 | style = penStyle; | - |
| 14 | capStyle = _capStyle; | - |
| 15 | joinStyle = _joinStyle; | - |
| 16 | } executed: }Execution Count:113879 | 113879 |
| 17 | | - |
| 18 | static const Qt::PenCapStyle qpen_default_cap = Qt::SquareCap; | - |
| 19 | static const Qt::PenJoinStyle qpen_default_join = Qt::BevelJoin; | - |
| 20 | | - |
| 21 | class QPenDataHolder | - |
| 22 | { | - |
| 23 | public: | - |
| 24 | QPenData *pen; | - |
| 25 | QPenDataHolder(const QBrush &brush, qreal width, Qt::PenStyle penStyle, | - |
| 26 | Qt::PenCapStyle penCapStyle, Qt::PenJoinStyle _joinStyle) | - |
| 27 | : pen(new QPenData(brush, width, penStyle, penCapStyle, _joinStyle)) | - |
| 28 | { } executed: }Execution Count:188 | 188 |
| 29 | ~QPenDataHolder() | - |
| 30 | { | - |
| 31 | if (!pen->ref.deref()) evaluated: !pen->ref.deref()| yes Evaluation Count:183 | yes Evaluation Count:5 |
| 5-183 |
| 32 | delete pen; executed: delete pen;Execution Count:183 | 183 |
| 33 | pen = 0; | - |
| 34 | } executed: }Execution Count:188 | 188 |
| 35 | }; | - |
| 36 | | - |
| 37 | static QPenDataHolder *defaultPenInstance() { static QGlobalStatic<QPenDataHolder > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QPenDataHolder *x = new QPenDataHolder (Qt::black, 1, Qt::SolidLine, qpen_default_cap, qpen_default_join); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QPenDataHolder > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:97 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:97 | yes Evaluation Count:61964 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:97 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:62061 | 0-62061 |
| 38 | | - |
| 39 | static QPenDataHolder *nullPenInstance() { static QGlobalStatic<QPenDataHolder > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QPenDataHolder *x = new QPenDataHolder (Qt::black, 1, Qt::NoPen, qpen_default_cap, qpen_default_join); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QPenDataHolder > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:91 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:91 | yes Evaluation Count:34212 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:91 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:34303 | 0-34303 |
| 40 | | - |
| 41 | | - |
| 42 | | - |
| 43 | | - |
| 44 | | - |
| 45 | | - |
| 46 | QPen::QPen() | - |
| 47 | { | - |
| 48 | d = defaultPenInstance()->pen; | - |
| 49 | d->ref.ref(); | - |
| 50 | } executed: }Execution Count:62061 | 62061 |
| 51 | | - |
| 52 | | - |
| 53 | | - |
| 54 | | - |
| 55 | | - |
| 56 | | - |
| 57 | | - |
| 58 | QPen::QPen(Qt::PenStyle style) | - |
| 59 | { | - |
| 60 | if (style == Qt::NoPen) { evaluated: style == Qt::NoPen| yes Evaluation Count:34303 | yes Evaluation Count:2 |
| 2-34303 |
| 61 | d = nullPenInstance()->pen; | - |
| 62 | d->ref.ref(); | - |
| 63 | } else { executed: }Execution Count:34303 | 34303 |
| 64 | d = new QPenData(Qt::black, 1, style, qpen_default_cap, qpen_default_join); | - |
| 65 | } executed: }Execution Count:2 | 2 |
| 66 | } | - |
| 67 | QPen::QPen(const QColor &color) | - |
| 68 | { | - |
| 69 | d = new QPenData(color, 1, Qt::SolidLine, qpen_default_cap, qpen_default_join); | - |
| 70 | } executed: }Execution Count:85379 | 85379 |
| 71 | QPen::QPen(const QBrush &brush, qreal width, Qt::PenStyle s, Qt::PenCapStyle c, Qt::PenJoinStyle j) | - |
| 72 | { | - |
| 73 | d = new QPenData(brush, width, s, c, j, false); | - |
| 74 | } executed: }Execution Count:28310 | 28310 |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | | - |
| 79 | | - |
| 80 | | - |
| 81 | | - |
| 82 | QPen::QPen(const QPen &p) | - |
| 83 | { | - |
| 84 | d = p.d; | - |
| 85 | d->ref.ref(); | - |
| 86 | } executed: }Execution Count:141806 | 141806 |
| 87 | | - |
| 88 | | - |
| 89 | | - |
| 90 | | - |
| 91 | | - |
| 92 | | - |
| 93 | QPen::~QPen() | - |
| 94 | { | - |
| 95 | if (!d->ref.deref()) evaluated: !d->ref.deref()| yes Evaluation Count:52399 | yes Evaluation Count:299441 |
| 52399-299441 |
| 96 | delete d; executed: delete d;Execution Count:52399 | 52399 |
| 97 | } executed: }Execution Count:351840 | 351840 |
| 98 | void QPen::detach() | - |
| 99 | { | - |
| 100 | if (d->ref.load() == 1) evaluated: d->ref.load() == 1| yes Evaluation Count:434 | yes Evaluation Count:1157 |
| 434-1157 |
| 101 | return; executed: return;Execution Count:434 | 434 |
| 102 | | - |
| 103 | QPenData *x = new QPenData(*static_cast<QPenData *>(d)); | - |
| 104 | if (!d->ref.deref()) partially evaluated: !d->ref.deref()| no Evaluation Count:0 | yes Evaluation Count:1157 |
| 0-1157 |
| 105 | delete d; never executed: delete d; | 0 |
| 106 | x->ref.store(1); | - |
| 107 | d = x; | - |
| 108 | } executed: }Execution Count:1157 | 1157 |
| 109 | QPen &QPen::operator=(const QPen &p) | - |
| 110 | { | - |
| 111 | qAtomicAssign(d, p.d); | - |
| 112 | return *this; executed: return *this;Execution Count:212488 | 212488 |
| 113 | } | - |
| 114 | QPen::operator QVariant() const | - |
| 115 | { | - |
| 116 | return QVariant(QVariant::Pen, this); executed: return QVariant(QVariant::Pen, this);Execution Count:1 | 1 |
| 117 | } | - |
| 118 | Qt::PenStyle QPen::style() const | - |
| 119 | { | - |
| 120 | return d->style; executed: return d->style;Execution Count:60119 | 60119 |
| 121 | } | - |
| 122 | void QPen::setStyle(Qt::PenStyle s) | - |
| 123 | { | - |
| 124 | if (d->style == s) evaluated: d->style == s| yes Evaluation Count:1628 | yes Evaluation Count:3 |
| 3-1628 |
| 125 | return; executed: return;Execution Count:1628 | 1628 |
| 126 | detach(); | - |
| 127 | d->style = s; | - |
| 128 | QPenData *dd = static_cast<QPenData *>(d); | - |
| 129 | dd->dashPattern.clear(); | - |
| 130 | dd->dashOffset = 0; | - |
| 131 | } executed: }Execution Count:3 | 3 |
| 132 | | - |
| 133 | | - |
| 134 | | - |
| 135 | | - |
| 136 | | - |
| 137 | | - |
| 138 | QVector<qreal> QPen::dashPattern() const | - |
| 139 | { | - |
| 140 | QPenData *dd = static_cast<QPenData *>(d); | - |
| 141 | if (d->style == Qt::SolidLine || d->style == Qt::NoPen) { evaluated: d->style == Qt::SolidLine| yes Evaluation Count:72580 | yes Evaluation Count:89 |
evaluated: d->style == Qt::NoPen| yes Evaluation Count:20 | yes Evaluation Count:69 |
| 20-72580 |
| 142 | return QVector<qreal>(); executed: return QVector<qreal>();Execution Count:72600 | 72600 |
| 143 | } else if (dd->dashPattern.isEmpty()) { evaluated: dd->dashPattern.isEmpty()| yes Evaluation Count:39 | yes Evaluation Count:30 |
| 30-39 |
| 144 | const qreal space = 2; | - |
| 145 | const qreal dot = 1; | - |
| 146 | const qreal dash = 4; | - |
| 147 | | - |
| 148 | switch (d->style) { | - |
| 149 | case Qt::DashLine: | - |
| 150 | dd->dashPattern << dash << space; | - |
| 151 | break; executed: break;Execution Count:14 | 14 |
| 152 | case Qt::DotLine: | - |
| 153 | dd->dashPattern << dot << space; | - |
| 154 | break; | 0 |
| 155 | case Qt::DashDotLine: | - |
| 156 | dd->dashPattern << dash << space << dot << space; | - |
| 157 | break; executed: break;Execution Count:19 | 19 |
| 158 | case Qt::DashDotDotLine: | - |
| 159 | dd->dashPattern << dash << space << dot << space << dot << space; | - |
| 160 | break; executed: break;Execution Count:6 | 6 |
| 161 | default: | - |
| 162 | break; | 0 |
| 163 | } | - |
| 164 | } executed: }Execution Count:39 | 39 |
| 165 | return dd->dashPattern; executed: return dd->dashPattern;Execution Count:69 | 69 |
| 166 | } | - |
| 167 | void QPen::setDashPattern(const QVector<qreal> &pattern) | - |
| 168 | { | - |
| 169 | if (pattern.isEmpty()) partially evaluated: pattern.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 170 | return; | 0 |
| 171 | detach(); | - |
| 172 | | - |
| 173 | QPenData *dd = static_cast<QPenData *>(d); | - |
| 174 | dd->dashPattern = pattern; | - |
| 175 | d->style = Qt::CustomDashLine; | - |
| 176 | | - |
| 177 | if ((dd->dashPattern.size() % 2) == 1) { partially evaluated: (dd->dashPattern.size() % 2) == 1| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 178 | QMessageLogger("painting/qpen.cpp", 509, __PRETTY_FUNCTION__).warning("QPen::setDashPattern: Pattern not of even length"); | - |
| 179 | dd->dashPattern << 1; | - |
| 180 | } | 0 |
| 181 | } executed: }Execution Count:1 | 1 |
| 182 | | - |
| 183 | | - |
| 184 | | - |
| 185 | | - |
| 186 | | - |
| 187 | | - |
| 188 | | - |
| 189 | qreal QPen::dashOffset() const | - |
| 190 | { | - |
| 191 | QPenData *dd = static_cast<QPenData *>(d); | - |
| 192 | return dd->dashOffset; executed: return dd->dashOffset;Execution Count:72967 | 72967 |
| 193 | } | - |
| 194 | void QPen::setDashOffset(qreal offset) | - |
| 195 | { | - |
| 196 | if (qFuzzyCompare(offset, static_cast<QPenData *>(d)->dashOffset)) never evaluated: qFuzzyCompare(offset, static_cast<QPenData *>(d)->dashOffset) | 0 |
| 197 | return; | 0 |
| 198 | detach(); | - |
| 199 | QPenData *dd = static_cast<QPenData *>(d); | - |
| 200 | dd->dashOffset = offset; | - |
| 201 | if (d->style != Qt::CustomDashLine) { never evaluated: d->style != Qt::CustomDashLine | 0 |
| 202 | dd->dashPattern = dashPattern(); | - |
| 203 | d->style = Qt::CustomDashLine; | - |
| 204 | } | 0 |
| 205 | } | 0 |
| 206 | | - |
| 207 | | - |
| 208 | | - |
| 209 | | - |
| 210 | | - |
| 211 | | - |
| 212 | | - |
| 213 | qreal QPen::miterLimit() const | - |
| 214 | { | - |
| 215 | const QPenData *dd = static_cast<QPenData *>(d); | - |
| 216 | return dd->miterLimit; executed: return dd->miterLimit;Execution Count:98149 | 98149 |
| 217 | } | - |
| 218 | void QPen::setMiterLimit(qreal limit) | - |
| 219 | { | - |
| 220 | detach(); | - |
| 221 | QPenData *dd = static_cast<QPenData *>(d); | - |
| 222 | dd->miterLimit = limit; | - |
| 223 | } executed: }Execution Count:2 | 2 |
| 224 | int QPen::width() const | - |
| 225 | { | - |
| 226 | return qRound(d->width); executed: return qRound(d->width);Execution Count:213 | 213 |
| 227 | } | - |
| 228 | qreal QPen::widthF() const | - |
| 229 | { | - |
| 230 | return d->width; executed: return d->width;Execution Count:82174 | 82174 |
| 231 | } | - |
| 232 | void QPen::setWidth(int width) | - |
| 233 | { | - |
| 234 | if (width < 0) partially evaluated: width < 0| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 235 | QMessageLogger("painting/qpen.cpp", 635, __PRETTY_FUNCTION__).warning("QPen::setWidth: Setting a pen width with a negative value is not defined"); never executed: QMessageLogger("painting/qpen.cpp", 635, __PRETTY_FUNCTION__).warning("QPen::setWidth: Setting a pen width with a negative value is not defined"); | 0 |
| 236 | if ((qreal)width == d->width) partially evaluated: (qreal)width == d->width| no Evaluation Count:0 | yes Evaluation Count:105 |
| 0-105 |
| 237 | return; | 0 |
| 238 | detach(); | - |
| 239 | d->width = width; | - |
| 240 | } executed: }Execution Count:105 | 105 |
| 241 | void QPen::setWidthF(qreal width) | - |
| 242 | { | - |
| 243 | if (width < 0.f) { partially evaluated: width < 0.f| no Evaluation Count:0 | yes Evaluation Count:1096 |
| 0-1096 |
| 244 | QMessageLogger("painting/qpen.cpp", 659, __PRETTY_FUNCTION__).warning("QPen::setWidthF: Setting a pen width with a negative value is not defined"); | - |
| 245 | return; | 0 |
| 246 | } | - |
| 247 | if (qAbs(d->width - width) < 0.00000001f) evaluated: qAbs(d->width - width) < 0.00000001f| yes Evaluation Count:1073 | yes Evaluation Count:23 |
| 23-1073 |
| 248 | return; executed: return;Execution Count:1073 | 1073 |
| 249 | detach(); | - |
| 250 | d->width = width; | - |
| 251 | d->defaultWidth = false; | - |
| 252 | } executed: }Execution Count:23 | 23 |
| 253 | | - |
| 254 | | - |
| 255 | | - |
| 256 | | - |
| 257 | | - |
| 258 | | - |
| 259 | | - |
| 260 | Qt::PenCapStyle QPen::capStyle() const | - |
| 261 | { | - |
| 262 | return d->capStyle; executed: return d->capStyle;Execution Count:74696 | 74696 |
| 263 | } | - |
| 264 | void QPen::setCapStyle(Qt::PenCapStyle c) | - |
| 265 | { | - |
| 266 | if (d->capStyle == c) evaluated: d->capStyle == c| yes Evaluation Count:24 | yes Evaluation Count:616 |
| 24-616 |
| 267 | return; executed: return;Execution Count:24 | 24 |
| 268 | detach(); | - |
| 269 | d->capStyle = c; | - |
| 270 | } executed: }Execution Count:616 | 616 |
| 271 | | - |
| 272 | | - |
| 273 | | - |
| 274 | | - |
| 275 | | - |
| 276 | | - |
| 277 | Qt::PenJoinStyle QPen::joinStyle() const | - |
| 278 | { | - |
| 279 | return d->joinStyle; executed: return d->joinStyle;Execution Count:2111 | 2111 |
| 280 | } | - |
| 281 | void QPen::setJoinStyle(Qt::PenJoinStyle j) | - |
| 282 | { | - |
| 283 | if (d->joinStyle == j) evaluated: d->joinStyle == j| yes Evaluation Count:48 | yes Evaluation Count:48 |
| 48 |
| 284 | return; executed: return;Execution Count:48 | 48 |
| 285 | detach(); | - |
| 286 | d->joinStyle = j; | - |
| 287 | } executed: }Execution Count:48 | 48 |
| 288 | QColor QPen::color() const | - |
| 289 | { | - |
| 290 | return d->brush.color(); executed: return d->brush.color();Execution Count:1053 | 1053 |
| 291 | } | - |
| 292 | void QPen::setColor(const QColor &c) | - |
| 293 | { | - |
| 294 | detach(); | - |
| 295 | d->brush = QBrush(c); | - |
| 296 | } executed: }Execution Count:547 | 547 |
| 297 | | - |
| 298 | | - |
| 299 | | - |
| 300 | | - |
| 301 | | - |
| 302 | QBrush QPen::brush() const | - |
| 303 | { | - |
| 304 | return d->brush; executed: return d->brush;Execution Count:327521 | 327521 |
| 305 | } | - |
| 306 | | - |
| 307 | | - |
| 308 | | - |
| 309 | | - |
| 310 | | - |
| 311 | | - |
| 312 | | - |
| 313 | void QPen::setBrush(const QBrush &brush) | - |
| 314 | { | - |
| 315 | detach(); | - |
| 316 | d->brush = brush; | - |
| 317 | } | 0 |
| 318 | | - |
| 319 | | - |
| 320 | | - |
| 321 | | - |
| 322 | | - |
| 323 | | - |
| 324 | | - |
| 325 | bool QPen::isSolid() const | - |
| 326 | { | - |
| 327 | return d->brush.style() == Qt::SolidPattern; executed: return d->brush.style() == Qt::SolidPattern;Execution Count:18 | 18 |
| 328 | } | - |
| 329 | bool QPen::isCosmetic() const | - |
| 330 | { | - |
| 331 | QPenData *dd = static_cast<QPenData *>(d); | - |
| 332 | return (dd->cosmetic == true) || d->width == 0; executed: return (dd->cosmetic == true) || d->width == 0;Execution Count:167803 | 167803 |
| 333 | } | - |
| 334 | void QPen::setCosmetic(bool cosmetic) | - |
| 335 | { | - |
| 336 | detach(); | - |
| 337 | QPenData *dd = static_cast<QPenData *>(d); | - |
| 338 | dd->cosmetic = cosmetic; | - |
| 339 | } executed: }Execution Count:192 | 192 |
| 340 | bool QPen::operator==(const QPen &p) const | - |
| 341 | { | - |
| 342 | QPenData *dd = static_cast<QPenData *>(d); | - |
| 343 | QPenData *pdd = static_cast<QPenData *>(p.d); | - |
| 344 | return (p.d == d) | 150585 |
| 345 | || (p.d->style == d->style | 150585 |
| 346 | && p.d->capStyle == d->capStyle | 150585 |
| 347 | && p.d->joinStyle == d->joinStyle | 150585 |
| 348 | && p.d->width == d->width | 150585 |
| 349 | && pdd->miterLimit == dd->miterLimit | 150585 |
| 350 | && (d->style != Qt::CustomDashLine | 150585 |
| 351 | || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) && | 150585 |
| 352 | pdd->dashPattern == dd->dashPattern)) | 150585 |
| 353 | && p.d->brush == d->brush | 150585 |
| 354 | && pdd->cosmetic == dd->cosmetic | 150585 |
| 355 | && pdd->defaultWidth == dd->defaultWidth); executed: return (p.d == d) || (p.d->style == d->style && p.d->capStyle == d->capStyle && p.d->joinStyle == d->joinStyle && p.d->width == d->width && pdd->miterLimit == dd->miterLimit && (d->style != Qt::CustomDashLine || (qFuzzyCompare(pdd->dashOffset, dd->dashOffset) && pdd->dashPattern == dd->dashPattern)) && p.d->brush == d->brush && pdd->cosmetic == dd->cosmetic && pdd->defaultWidth == dd->defaultWidth);Execution Count:150585 | 150585 |
| 356 | } | - |
| 357 | bool QPen::isDetached() | - |
| 358 | { | - |
| 359 | return d->ref.load() == 1; never executed: return d->ref.load() == 1; | 0 |
| 360 | } | - |
| 361 | QDataStream &operator<<(QDataStream &s, const QPen &p) | - |
| 362 | { | - |
| 363 | QPenData *dd = static_cast<QPenData *>(p.d); | - |
| 364 | if (s.version() < 3) { partially evaluated: s.version() < 3| no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
| 365 | s << (quint8)p.style(); | - |
| 366 | } else if (s.version() < QDataStream::Qt_4_3) { evaluated: s.version() < QDataStream::Qt_4_3| yes Evaluation Count:1 | yes Evaluation Count:68 |
| 0-68 |
| 367 | s << (quint8)(p.style() | p.capStyle() | p.joinStyle()); | - |
| 368 | } else { executed: }Execution Count:1 | 1 |
| 369 | s << (quint16)(p.style() | p.capStyle() | p.joinStyle()); | - |
| 370 | s << (bool)(dd->cosmetic); | - |
| 371 | } executed: }Execution Count:68 | 68 |
| 372 | | - |
| 373 | if (s.version() < 7) { partially evaluated: s.version() < 7| no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
| 374 | s << (quint8)p.width(); | - |
| 375 | s << p.color(); | - |
| 376 | } else { | 0 |
| 377 | s << double(p.widthF()); | - |
| 378 | s << p.brush(); | - |
| 379 | s << double(p.miterLimit()); | - |
| 380 | if (sizeof(qreal) == sizeof(double)) { partially evaluated: sizeof(qreal) == sizeof(double)| yes Evaluation Count:69 | no Evaluation Count:0 |
| 0-69 |
| 381 | s << p.dashPattern(); | - |
| 382 | } else { executed: }Execution Count:69 | 69 |
| 383 | | - |
| 384 | | - |
| 385 | | - |
| 386 | QVector<qreal> pattern = p.dashPattern(); | - |
| 387 | s << quint32(pattern.size()); | - |
| 388 | for (int i = 0; i < pattern.size(); ++i) never evaluated: i < pattern.size() | 0 |
| 389 | s << double(pattern.at(i)); never executed: s << double(pattern.at(i)); | 0 |
| 390 | } | 0 |
| 391 | if (s.version() >= 9) evaluated: s.version() >= 9| yes Evaluation Count:68 | yes Evaluation Count:1 |
| 1-68 |
| 392 | s << double(p.dashOffset()); executed: s << double(p.dashOffset());Execution Count:68 | 68 |
| 393 | if (s.version() >= QDataStream::Qt_5_0) evaluated: s.version() >= QDataStream::Qt_5_0| yes Evaluation Count:52 | yes Evaluation Count:17 |
| 17-52 |
| 394 | s << bool(dd->defaultWidth); executed: s << bool(dd->defaultWidth);Execution Count:52 | 52 |
| 395 | } executed: }Execution Count:69 | 69 |
| 396 | return s; executed: return s;Execution Count:69 | 69 |
| 397 | } | - |
| 398 | QDataStream &operator>>(QDataStream &s, QPen &p) | - |
| 399 | { | - |
| 400 | quint16 style; | - |
| 401 | quint8 width8 = 0; | - |
| 402 | double width = 0; | - |
| 403 | QColor color; | - |
| 404 | QBrush brush; | - |
| 405 | double miterLimit = 2; | - |
| 406 | QVector<qreal> dashPattern; | - |
| 407 | double dashOffset = 0; | - |
| 408 | bool cosmetic = false; | - |
| 409 | bool defaultWidth = false; | - |
| 410 | if (s.version() < QDataStream::Qt_4_3) { evaluated: s.version() < QDataStream::Qt_4_3| yes Evaluation Count:2 | yes Evaluation Count:52 |
| 2-52 |
| 411 | quint8 style8; | - |
| 412 | s >> style8; | - |
| 413 | style = style8; | - |
| 414 | } else { executed: }Execution Count:2 | 2 |
| 415 | s >> style; | - |
| 416 | s >> cosmetic; | - |
| 417 | } executed: }Execution Count:52 | 52 |
| 418 | if (s.version() < 7) { partially evaluated: s.version() < 7| no Evaluation Count:0 | yes Evaluation Count:54 |
| 0-54 |
| 419 | s >> width8; | - |
| 420 | s >> color; | - |
| 421 | brush = color; | - |
| 422 | width = width8; | - |
| 423 | } else { | 0 |
| 424 | s >> width; | - |
| 425 | s >> brush; | - |
| 426 | s >> miterLimit; | - |
| 427 | if (sizeof(qreal) == sizeof(double)) { partially evaluated: sizeof(qreal) == sizeof(double)| yes Evaluation Count:54 | no Evaluation Count:0 |
| 0-54 |
| 428 | s >> dashPattern; | - |
| 429 | } else { executed: }Execution Count:54 | 54 |
| 430 | quint32 numDashes; | - |
| 431 | s >> numDashes; | - |
| 432 | double dash; | - |
| 433 | for (quint32 i = 0; i < numDashes; ++i) { never evaluated: i < numDashes | 0 |
| 434 | s >> dash; | - |
| 435 | dashPattern << dash; | - |
| 436 | } | 0 |
| 437 | } | 0 |
| 438 | if (s.version() >= 9) evaluated: s.version() >= 9| yes Evaluation Count:52 | yes Evaluation Count:2 |
| 2-52 |
| 439 | s >> dashOffset; executed: s >> dashOffset;Execution Count:52 | 52 |
| 440 | } executed: }Execution Count:54 | 54 |
| 441 | | - |
| 442 | if (s.version() >= QDataStream::Qt_5_0) { evaluated: s.version() >= QDataStream::Qt_5_0| yes Evaluation Count:52 | yes Evaluation Count:2 |
| 2-52 |
| 443 | s >> defaultWidth; | - |
| 444 | } else { executed: }Execution Count:52 | 52 |
| 445 | | - |
| 446 | defaultWidth = qFuzzyIsNull(width); | - |
| 447 | } executed: }Execution Count:2 | 2 |
| 448 | | - |
| 449 | p.detach(); | - |
| 450 | QPenData *dd = static_cast<QPenData *>(p.d); | - |
| 451 | dd->width = width; | - |
| 452 | dd->brush = brush; | - |
| 453 | dd->style = Qt::PenStyle(style & Qt::MPenStyle); | - |
| 454 | dd->capStyle = Qt::PenCapStyle(style & Qt::MPenCapStyle); | - |
| 455 | dd->joinStyle = Qt::PenJoinStyle(style & Qt::MPenJoinStyle); | - |
| 456 | dd->dashPattern = dashPattern; | - |
| 457 | dd->miterLimit = miterLimit; | - |
| 458 | dd->dashOffset = dashOffset; | - |
| 459 | dd->cosmetic = cosmetic; | - |
| 460 | dd->defaultWidth = defaultWidth; | - |
| 461 | | - |
| 462 | return s; executed: return s;Execution Count:54 | 54 |
| 463 | } | - |
| 464 | | - |
| 465 | | - |
| 466 | | - |
| 467 | QDebug operator<<(QDebug dbg, const QPen &p) | - |
| 468 | { | - |
| 469 | const char *PEN_STYLES[] = { | - |
| 470 | "NoPen", | - |
| 471 | "SolidLine", | - |
| 472 | "DashLine", | - |
| 473 | "DotLine", | - |
| 474 | "DashDotLine", | - |
| 475 | "DashDotDotLine", | - |
| 476 | "CustomDashLine" | - |
| 477 | }; | - |
| 478 | | - |
| 479 | dbg.nospace() << "QPen(" << p.width() << ',' << p.brush() | - |
| 480 | << ',' << PEN_STYLES[p.style()] << ',' << int(p.capStyle()) | - |
| 481 | << ',' << int(p.joinStyle()) << ',' << p.dashPattern() | - |
| 482 | << ',' << p.dashOffset() | - |
| 483 | << ',' << p.miterLimit() << ')'; | - |
| 484 | return dbg.space(); executed: return dbg.space();Execution Count:1 | 1 |
| 485 | } | - |
| 486 | | - |
| 487 | | - |
| | |