| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qpainterpath.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||
| 6 | struct QPainterPathPrivateDeleter | - | ||||||||||||||||||||||||||||||||||||
| 7 | { | - | ||||||||||||||||||||||||||||||||||||
| 8 | static inline void cleanup(QPainterPathPrivate *d) | - | ||||||||||||||||||||||||||||||||||||
| 9 | { | - | ||||||||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||||||||
| 12 | if (d
| 0 | ||||||||||||||||||||||||||||||||||||
| 13 | delete static_cast<QPainterPathData *>(d); never executed: delete static_cast<QPainterPathData *>(d); | 0 | ||||||||||||||||||||||||||||||||||||
| 14 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 15 | }; | - | ||||||||||||||||||||||||||||||||||||
| 16 | QPainterPath qt_stroke_dash(const QPainterPath &path, qreal *dashes, int dashCount); | - | ||||||||||||||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||||||||||||||
| 18 | void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length, | - | ||||||||||||||||||||||||||||||||||||
| 19 | QPointF* startPoint, QPointF *endPoint) | - | ||||||||||||||||||||||||||||||||||||
| 20 | { | - | ||||||||||||||||||||||||||||||||||||
| 21 | if (r.isNull()
| 0 | ||||||||||||||||||||||||||||||||||||
| 22 | if (startPoint
| 0 | ||||||||||||||||||||||||||||||||||||
| 23 | * never executed: startPoint = QPointF();*startPoint = QPointF();never executed: *startPoint = QPointF(); | 0 | ||||||||||||||||||||||||||||||||||||
| 24 | if (endPoint
| 0 | ||||||||||||||||||||||||||||||||||||
| 25 | * never executed: endPoint = QPointF();*endPoint = QPointF();never executed: *endPoint = QPointF(); | 0 | ||||||||||||||||||||||||||||||||||||
| 26 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 27 | } | - | ||||||||||||||||||||||||||||||||||||
| 28 | - | |||||||||||||||||||||||||||||||||||||
| 29 | qreal w2 = r.width() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 30 | qreal h2 = r.height() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||||||||||||||
| 32 | qreal angles[2] = { angle, angle + length }; | - | ||||||||||||||||||||||||||||||||||||
| 33 | QPointF *points[2] = { startPoint, endPoint }; | - | ||||||||||||||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||||||||||||||
| 35 | for (int i = 0; i < 2
| 0 | ||||||||||||||||||||||||||||||||||||
| 36 | if (!points[i]
| 0 | ||||||||||||||||||||||||||||||||||||
| 37 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
| 38 | - | |||||||||||||||||||||||||||||||||||||
| 39 | qreal theta = angles[i] - 360 * qFloor(angles[i] / 360); | - | ||||||||||||||||||||||||||||||||||||
| 40 | qreal t = theta / 90; | - | ||||||||||||||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||||||||||||||
| 42 | int quadrant = int(t); | - | ||||||||||||||||||||||||||||||||||||
| 43 | t -= quadrant; | - | ||||||||||||||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||||||||||||||
| 45 | t = qt_t_for_arc_angle(90 * t); | - | ||||||||||||||||||||||||||||||||||||
| 46 | - | |||||||||||||||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||||||||||||||
| 48 | if (quadrant & 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 49 | t = 1 - t; never executed: t = 1 - t; | 0 | ||||||||||||||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||||||||||||||
| 51 | qreal a, b, c, d; | - | ||||||||||||||||||||||||||||||||||||
| 52 | QBezier::coefficients(t, a, b, c, d); | - | ||||||||||||||||||||||||||||||||||||
| 53 | QPointF p(a + b + c*0.5522847498, d + c + b*0.5522847498); | - | ||||||||||||||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||||||||||||||
| 56 | if (quadrant == 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 57 | p.rx() = -p.x(); never executed: p.rx() = -p.x(); | 0 | ||||||||||||||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||||||||||||||
| 60 | if (quadrant == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 61 | p.ry() = -p.y(); never executed: p.ry() = -p.y(); | 0 | ||||||||||||||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||||||||||||||
| 63 | *points[i] = r.center() + QPointF(w2 * p.x(), h2 * p.y()); | - | ||||||||||||||||||||||||||||||||||||
| 64 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 65 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 66 | int QPainterPath::elementCount() const | - | ||||||||||||||||||||||||||||||||||||
| 67 | { | - | ||||||||||||||||||||||||||||||||||||
| 68 | return never executed: d_ptrreturn d_ptr ? d_ptr->elements.size() : 0;
never executed: return d_ptr ? d_ptr->elements.size() : 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 69 | } | - | ||||||||||||||||||||||||||||||||||||
| 70 | QPainterPath::Element QPainterPath::elementAt(int i) const | - | ||||||||||||||||||||||||||||||||||||
| 71 | { | - | ||||||||||||||||||||||||||||||||||||
| 72 | ((!(d_ptr)) ? qt_assert("d_ptr",__FILE__,490) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 73 | ((!(i >= 0 && i < elementCount())) ? qt_assert("i >= 0 && i < elementCount()",__FILE__,491) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 74 | return never executed: d_ptr->elements.at(i);return d_ptr->elements.at(i);never executed: return d_ptr->elements.at(i); | 0 | ||||||||||||||||||||||||||||||||||||
| 75 | } | - | ||||||||||||||||||||||||||||||||||||
| 76 | void QPainterPath::setElementPositionAt(int i, qreal x, qreal y) | - | ||||||||||||||||||||||||||||||||||||
| 77 | { | - | ||||||||||||||||||||||||||||||||||||
| 78 | ((!(d_ptr)) ? qt_assert("d_ptr",__FILE__,505) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 79 | ((!(i >= 0 && i < elementCount())) ? qt_assert("i >= 0 && i < elementCount()",__FILE__,506) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 80 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 81 | QPainterPath::Element &e = d_ptr->elements[i]; | - | ||||||||||||||||||||||||||||||||||||
| 82 | e.x = x; | - | ||||||||||||||||||||||||||||||||||||
| 83 | e.y = y; | - | ||||||||||||||||||||||||||||||||||||
| 84 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 85 | QPainterPath::QPainterPath() noexcept | - | ||||||||||||||||||||||||||||||||||||
| 86 | : d_ptr(0) | - | ||||||||||||||||||||||||||||||||||||
| 87 | { | - | ||||||||||||||||||||||||||||||||||||
| 88 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 89 | QPainterPath::QPainterPath(const QPainterPath &other) | - | ||||||||||||||||||||||||||||||||||||
| 90 | : d_ptr(other.d_ptr.data()) | - | ||||||||||||||||||||||||||||||||||||
| 91 | { | - | ||||||||||||||||||||||||||||||||||||
| 92 | if (d_ptr
| 0 | ||||||||||||||||||||||||||||||||||||
| 93 | d_ptr->ref.ref(); never executed: d_ptr->ref.ref(); | 0 | ||||||||||||||||||||||||||||||||||||
| 94 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||||||||||||||
| 101 | QPainterPath::QPainterPath(const QPointF &startPoint) | - | ||||||||||||||||||||||||||||||||||||
| 102 | : d_ptr(new QPainterPathData) | - | ||||||||||||||||||||||||||||||||||||
| 103 | { | - | ||||||||||||||||||||||||||||||||||||
| 104 | Element e = { startPoint.x(), startPoint.y(), MoveToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 105 | d_func()->elements << e; | - | ||||||||||||||||||||||||||||||||||||
| 106 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||||||||||||||
| 108 | void QPainterPath::detach() | - | ||||||||||||||||||||||||||||||||||||
| 109 | { | - | ||||||||||||||||||||||||||||||||||||
| 110 | if (d_ptr->ref.load() != 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 111 | detach_helper(); never executed: detach_helper(); | 0 | ||||||||||||||||||||||||||||||||||||
| 112 | setDirty(true); | - | ||||||||||||||||||||||||||||||||||||
| 113 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||||||||||||||
| 118 | void QPainterPath::detach_helper() | - | ||||||||||||||||||||||||||||||||||||
| 119 | { | - | ||||||||||||||||||||||||||||||||||||
| 120 | QPainterPathPrivate *data = new QPainterPathData(*d_func()); | - | ||||||||||||||||||||||||||||||||||||
| 121 | d_ptr.reset(data); | - | ||||||||||||||||||||||||||||||||||||
| 122 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||||||||||||||
| 127 | void QPainterPath::ensureData_helper() | - | ||||||||||||||||||||||||||||||||||||
| 128 | { | - | ||||||||||||||||||||||||||||||||||||
| 129 | QPainterPathPrivate *data = new QPainterPathData; | - | ||||||||||||||||||||||||||||||||||||
| 130 | data->elements.reserve(16); | - | ||||||||||||||||||||||||||||||||||||
| 131 | QPainterPath::Element e = { 0, 0, QPainterPath::MoveToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 132 | data->elements << e; | - | ||||||||||||||||||||||||||||||||||||
| 133 | d_ptr.reset(data); | - | ||||||||||||||||||||||||||||||||||||
| 134 | ((!(d_ptr != 0)) ? qt_assert("d_ptr != 0",__FILE__,581) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 135 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 136 | QPainterPath &QPainterPath::operator=(const QPainterPath &other) | - | ||||||||||||||||||||||||||||||||||||
| 137 | { | - | ||||||||||||||||||||||||||||||||||||
| 138 | if (other.d_func() != d_func()
| 0 | ||||||||||||||||||||||||||||||||||||
| 139 | QPainterPathPrivate *data = other.d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 140 | if (data
| 0 | ||||||||||||||||||||||||||||||||||||
| 141 | data->ref.ref(); never executed: data->ref.ref(); | 0 | ||||||||||||||||||||||||||||||||||||
| 142 | d_ptr.reset(data); | - | ||||||||||||||||||||||||||||||||||||
| 143 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 144 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||||||||||||||||||||
| 145 | } | - | ||||||||||||||||||||||||||||||||||||
| 146 | QPainterPath::~QPainterPath() | - | ||||||||||||||||||||||||||||||||||||
| 147 | { | - | ||||||||||||||||||||||||||||||||||||
| 148 | } | - | ||||||||||||||||||||||||||||||||||||
| 149 | void QPainterPath::closeSubpath() | - | ||||||||||||||||||||||||||||||||||||
| 150 | { | - | ||||||||||||||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||||||||||||||
| 154 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 155 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 156 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||||||||||||||
| 158 | d_func()->close(); | - | ||||||||||||||||||||||||||||||||||||
| 159 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 160 | void QPainterPath::moveTo(const QPointF &p) | - | ||||||||||||||||||||||||||||||||||||
| 161 | { | - | ||||||||||||||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||||||||||||||
| 166 | if (!qt_is_finite(p.x())
| 0 | ||||||||||||||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||||||||||||||
| 168 | QMessageLogger(__FILE__, 674, __PRETTY_FUNCTION__).warning("QPainterPath::moveTo: Adding point where x or y is NaN or Inf, ignoring call"); | - | ||||||||||||||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||||||||||||||
| 170 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 171 | } | - | ||||||||||||||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||||||||||||||
| 173 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 174 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||||||||||||||
| 176 | QPainterPathData *d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 177 | ((!(!d->elements.isEmpty())) ? qt_assert("!d->elements.isEmpty()",__FILE__,683) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 178 | - | |||||||||||||||||||||||||||||||||||||
| 179 | d->require_moveTo = false; | - | ||||||||||||||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||||||||||||||
| 181 | if (d->elements.last().type == MoveToElement
| 0 | ||||||||||||||||||||||||||||||||||||
| 182 | d->elements.last().x = p.x(); | - | ||||||||||||||||||||||||||||||||||||
| 183 | d->elements.last().y = p.y(); | - | ||||||||||||||||||||||||||||||||||||
| 184 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 185 | Element elm = { p.x(), p.y(), MoveToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 186 | d->elements.append(elm); | - | ||||||||||||||||||||||||||||||||||||
| 187 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 188 | d->cStart = d->elements.size() - 1; | - | ||||||||||||||||||||||||||||||||||||
| 189 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 190 | void QPainterPath::lineTo(const QPointF &p) | - | ||||||||||||||||||||||||||||||||||||
| 191 | { | - | ||||||||||||||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||||||||
| 196 | if (!qt_is_finite(p.x())
| 0 | ||||||||||||||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||||||||||||||
| 198 | QMessageLogger(__FILE__, 724, __PRETTY_FUNCTION__).warning("QPainterPath::lineTo: Adding point where x or y is NaN or Inf, ignoring call"); | - | ||||||||||||||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||||||||||||||
| 200 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 201 | } | - | ||||||||||||||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||||||||||||||
| 203 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 204 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||||||||||||||
| 206 | QPainterPathData *d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 207 | ((!(!d->elements.isEmpty())) ? qt_assert("!d->elements.isEmpty()",__FILE__,733) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 208 | d->maybeMoveTo(); | - | ||||||||||||||||||||||||||||||||||||
| 209 | if (p == QPointF(d->elements.last())
| 0 | ||||||||||||||||||||||||||||||||||||
| 210 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 211 | Element elm = { p.x(), p.y(), LineToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 212 | d->elements.append(elm); | - | ||||||||||||||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||||||||||||||
| 214 | d->convex = d->elements.size() == 3
| 0 | ||||||||||||||||||||||||||||||||||||
| 215 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 216 | void QPainterPath::cubicTo(const QPointF &c1, const QPointF &c2, const QPointF &e) | - | ||||||||||||||||||||||||||||||||||||
| 217 | { | - | ||||||||||||||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||||||||||||||
| 223 | if (!qt_is_finite(c1.x())
| 0 | ||||||||||||||||||||||||||||||||||||
| 224 | || !qt_is_finite(e.x())
| 0 | ||||||||||||||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||||||||||||||
| 226 | QMessageLogger(__FILE__, 784, __PRETTY_FUNCTION__).warning("QPainterPath::cubicTo: Adding point where x or y is NaN or Inf, ignoring call"); | - | ||||||||||||||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||||||||||||||
| 228 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 229 | } | - | ||||||||||||||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||||||||||||||
| 231 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 232 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||||||||||||||
| 234 | QPainterPathData *d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 235 | ((!(!d->elements.isEmpty())) ? qt_assert("!d->elements.isEmpty()",__FILE__,793) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||||||||||||||
| 240 | if (d->elements.last() == c1
| 0 | ||||||||||||||||||||||||||||||||||||
| 241 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||||||||||||||
| 243 | d->maybeMoveTo(); | - | ||||||||||||||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||||||||||||||
| 245 | Element ce1 = { c1.x(), c1.y(), CurveToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 246 | Element ce2 = { c2.x(), c2.y(), CurveToDataElement }; | - | ||||||||||||||||||||||||||||||||||||
| 247 | Element ee = { e.x(), e.y(), CurveToDataElement }; | - | ||||||||||||||||||||||||||||||||||||
| 248 | d->elements << ce1 << ce2 << ee; | - | ||||||||||||||||||||||||||||||||||||
| 249 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 250 | void QPainterPath::quadTo(const QPointF &c, const QPointF &e) | - | ||||||||||||||||||||||||||||||||||||
| 251 | { | - | ||||||||||||||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||||||||||||||
| 257 | if (!qt_is_finite(c.x())
| 0 | ||||||||||||||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||||||||||||||
| 259 | QMessageLogger(__FILE__, 840, __PRETTY_FUNCTION__).warning("QPainterPath::quadTo: Adding point where x or y is NaN or Inf, ignoring call"); | - | ||||||||||||||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||||||||||||||
| 261 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 262 | } | - | ||||||||||||||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||||||||||||||
| 264 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 265 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||||||||||||||
| 267 | QPainterPathPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 268 | ((!(!d->elements.isEmpty())) ? qt_assert("!d->elements.isEmpty()",__FILE__,849) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 269 | const QPainterPath::Element &elm = d->elements.at(elementCount()-1); | - | ||||||||||||||||||||||||||||||||||||
| 270 | QPointF prev(elm.x, elm.y); | - | ||||||||||||||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||||||||||||||
| 274 | if (prev == c
| 0 | ||||||||||||||||||||||||||||||||||||
| 275 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||||||||||||||
| 277 | QPointF c1((prev.x() + 2*c.x()) / 3, (prev.y() + 2*c.y()) / 3); | - | ||||||||||||||||||||||||||||||||||||
| 278 | QPointF c2((e.x() + 2*c.x()) / 3, (e.y() + 2*c.y()) / 3); | - | ||||||||||||||||||||||||||||||||||||
| 279 | cubicTo(c1, c2, e); | - | ||||||||||||||||||||||||||||||||||||
| 280 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 281 | void QPainterPath::arcTo(const QRectF &rect, qreal startAngle, qreal sweepLength) | - | ||||||||||||||||||||||||||||||||||||
| 282 | { | - | ||||||||||||||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||||||||||||||
| 288 | if ((!qt_is_finite(rect.x())
| 0 | ||||||||||||||||||||||||||||||||||||
| 289 | || !qt_is_finite(startAngle)
| 0 | ||||||||||||||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||||||||||||||
| 291 | QMessageLogger(__FILE__, 912, __PRETTY_FUNCTION__).warning("QPainterPath::arcTo: Adding arc where a parameter is NaN or Inf, ignoring call"); | - | ||||||||||||||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||||||||||||||
| 293 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 294 | } | - | ||||||||||||||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||||||||||||||
| 296 | if (rect.isNull()
| 0 | ||||||||||||||||||||||||||||||||||||
| 297 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||||||||||||||
| 299 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 300 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||||||||||||||
| 302 | int point_count; | - | ||||||||||||||||||||||||||||||||||||
| 303 | QPointF pts[15]; | - | ||||||||||||||||||||||||||||||||||||
| 304 | QPointF curve_start = qt_curves_for_arc(rect, startAngle, sweepLength, pts, &point_count); | - | ||||||||||||||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||||||||||||||
| 306 | lineTo(curve_start); | - | ||||||||||||||||||||||||||||||||||||
| 307 | for (int i=0; i<point_count
| 0 | ||||||||||||||||||||||||||||||||||||
| 308 | cubicTo(pts[i].x(), pts[i].y(), | - | ||||||||||||||||||||||||||||||||||||
| 309 | pts[i+1].x(), pts[i+1].y(), | - | ||||||||||||||||||||||||||||||||||||
| 310 | pts[i+2].x(), pts[i+2].y()); | - | ||||||||||||||||||||||||||||||||||||
| 311 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||||||||||||||
| 313 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 314 | void QPainterPath::arcMoveTo(const QRectF &rect, qreal angle) | - | ||||||||||||||||||||||||||||||||||||
| 315 | { | - | ||||||||||||||||||||||||||||||||||||
| 316 | if (rect.isNull()
| 0 | ||||||||||||||||||||||||||||||||||||
| 317 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||||||||||||||
| 319 | QPointF pt; | - | ||||||||||||||||||||||||||||||||||||
| 320 | qt_find_ellipse_coords(rect, angle, 0, &pt, 0); | - | ||||||||||||||||||||||||||||||||||||
| 321 | moveTo(pt); | - | ||||||||||||||||||||||||||||||||||||
| 322 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 323 | QPointF QPainterPath::currentPosition() const | - | ||||||||||||||||||||||||||||||||||||
| 324 | { | - | ||||||||||||||||||||||||||||||||||||
| 325 | return never executed: !d_ptrreturn !d_ptr || d_func()->elements.isEmpty() ? QPointF() : QPointF(d_func()->elements.last().x, d_func()->elements.last().y);
never executed: return !d_ptr || d_func()->elements.isEmpty() ? QPointF() : QPointF(d_func()->elements.last().x, d_func()->elements.last().y); | 0 | ||||||||||||||||||||||||||||||||||||
| 326 | ? QPointF() never executed: return !d_ptr || d_func()->elements.isEmpty() ? QPointF() : QPointF(d_func()->elements.last().x, d_func()->elements.last().y); | 0 | ||||||||||||||||||||||||||||||||||||
| 327 | : QPointF(d_func()->elements.last().x, d_func()->elements.last().y); never executed: return !d_ptr || d_func()->elements.isEmpty() ? QPointF() : QPointF(d_func()->elements.last().x, d_func()->elements.last().y); | 0 | ||||||||||||||||||||||||||||||||||||
| 328 | } | - | ||||||||||||||||||||||||||||||||||||
| 329 | void QPainterPath::addRect(const QRectF &r) | - | ||||||||||||||||||||||||||||||||||||
| 330 | { | - | ||||||||||||||||||||||||||||||||||||
| 331 | if (!qt_is_finite(r.x())
| 0 | ||||||||||||||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||||||||||||||
| 333 | QMessageLogger(__FILE__, 1017, __PRETTY_FUNCTION__).warning("QPainterPath::addRect: Adding rect where a parameter is NaN or Inf, ignoring call"); | - | ||||||||||||||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||||||||||||||
| 335 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 336 | } | - | ||||||||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||||||||
| 338 | if (r.isNull()
| 0 | ||||||||||||||||||||||||||||||||||||
| 339 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 340 | - | |||||||||||||||||||||||||||||||||||||
| 341 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 342 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||||||||||||||
| 344 | bool first = d_func()->elements.size() < 2; | - | ||||||||||||||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||||||||||||||
| 346 | d_func()->elements.reserve(d_func()->elements.size() + 5); | - | ||||||||||||||||||||||||||||||||||||
| 347 | moveTo(r.x(), r.y()); | - | ||||||||||||||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||||||||||||||
| 349 | Element l1 = { r.x() + r.width(), r.y(), LineToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 350 | Element l2 = { r.x() + r.width(), r.y() + r.height(), LineToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 351 | Element l3 = { r.x(), r.y() + r.height(), LineToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 352 | Element l4 = { r.x(), r.y(), LineToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||||||||||||||
| 354 | d_func()->elements << l1 << l2 << l3 << l4; | - | ||||||||||||||||||||||||||||||||||||
| 355 | d_func()->require_moveTo = true; | - | ||||||||||||||||||||||||||||||||||||
| 356 | d_func()->convex = first; | - | ||||||||||||||||||||||||||||||||||||
| 357 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 358 | void QPainterPath::addPolygon(const QPolygonF &polygon) | - | ||||||||||||||||||||||||||||||||||||
| 359 | { | - | ||||||||||||||||||||||||||||||||||||
| 360 | if (polygon.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 361 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||||||||||||||
| 363 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 364 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||||||||||||||
| 366 | d_func()->elements.reserve(d_func()->elements.size() + polygon.size()); | - | ||||||||||||||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||||||||||||||
| 368 | moveTo(polygon.first()); | - | ||||||||||||||||||||||||||||||||||||
| 369 | for (int i=1; i<polygon.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 370 | Element elm = { polygon.at(i).x(), polygon.at(i).y(), LineToElement }; | - | ||||||||||||||||||||||||||||||||||||
| 371 | d_func()->elements << elm; | - | ||||||||||||||||||||||||||||||||||||
| 372 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 373 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 374 | void QPainterPath::addEllipse(const QRectF &boundingRect) | - | ||||||||||||||||||||||||||||||||||||
| 375 | { | - | ||||||||||||||||||||||||||||||||||||
| 376 | if (!qt_is_finite(boundingRect.x())
| 0 | ||||||||||||||||||||||||||||||||||||
| 377 | || !qt_is_finite(boundingRect.width())
| 0 | ||||||||||||||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||||||||||||||
| 379 | QMessageLogger(__FILE__, 1101, __PRETTY_FUNCTION__).warning("QPainterPath::addEllipse: Adding ellipse where a parameter is NaN or Inf, ignoring call"); | - | ||||||||||||||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||||||||||||||
| 381 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 382 | } | - | ||||||||||||||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||||||||||||||
| 384 | if (boundingRect.isNull()
| 0 | ||||||||||||||||||||||||||||||||||||
| 385 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||||||||||||||
| 387 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 388 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||||||||||||||
| 390 | QPainterPathPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 391 | bool first = d_func()->elements.size() < 2; | - | ||||||||||||||||||||||||||||||||||||
| 392 | d->elements.reserve(d->elements.size() + 13); | - | ||||||||||||||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||||||||||||||
| 394 | QPointF pts[12]; | - | ||||||||||||||||||||||||||||||||||||
| 395 | int point_count; | - | ||||||||||||||||||||||||||||||||||||
| 396 | QPointF start = qt_curves_for_arc(boundingRect, 0, -360, pts, &point_count); | - | ||||||||||||||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||||||||||||||
| 398 | moveTo(start); | - | ||||||||||||||||||||||||||||||||||||
| 399 | cubicTo(pts[0], pts[1], pts[2]); | - | ||||||||||||||||||||||||||||||||||||
| 400 | cubicTo(pts[3], pts[4], pts[5]); | - | ||||||||||||||||||||||||||||||||||||
| 401 | cubicTo(pts[6], pts[7], pts[8]); | - | ||||||||||||||||||||||||||||||||||||
| 402 | cubicTo(pts[9], pts[10], pts[11]); | - | ||||||||||||||||||||||||||||||||||||
| 403 | d_func()->require_moveTo = true; | - | ||||||||||||||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||||||||||||||
| 405 | d_func()->convex = first; | - | ||||||||||||||||||||||||||||||||||||
| 406 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 407 | void QPainterPath::addText(const QPointF &point, const QFont &f, const QString &text) | - | ||||||||||||||||||||||||||||||||||||
| 408 | { | - | ||||||||||||||||||||||||||||||||||||
| 409 | if (text.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 410 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||||||||||||||
| 412 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 413 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||||||||||||||
| 415 | QTextLayout layout(text, f); | - | ||||||||||||||||||||||||||||||||||||
| 416 | layout.setCacheEnabled(true); | - | ||||||||||||||||||||||||||||||||||||
| 417 | QTextEngine *eng = layout.engine(); | - | ||||||||||||||||||||||||||||||||||||
| 418 | layout.beginLayout(); | - | ||||||||||||||||||||||||||||||||||||
| 419 | QTextLine line = layout.createLine(); | - | ||||||||||||||||||||||||||||||||||||
| 420 | (void)line;; | - | ||||||||||||||||||||||||||||||||||||
| 421 | layout.endLayout(); | - | ||||||||||||||||||||||||||||||||||||
| 422 | const QScriptLine &sl = eng->lines[0]; | - | ||||||||||||||||||||||||||||||||||||
| 423 | if (!sl.length
| 0 | ||||||||||||||||||||||||||||||||||||
| 424 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||||||||||||||
| 426 | int nItems = eng->layoutData->items.size(); | - | ||||||||||||||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||||||||||||||
| 428 | qreal x(point.x()); | - | ||||||||||||||||||||||||||||||||||||
| 429 | qreal y(point.y()); | - | ||||||||||||||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||||||||||||||
| 431 | QVarLengthArray<int> visualOrder(nItems); | - | ||||||||||||||||||||||||||||||||||||
| 432 | QVarLengthArray<uchar> levels(nItems); | - | ||||||||||||||||||||||||||||||||||||
| 433 | for (int i = 0; i < nItems
| 0 | ||||||||||||||||||||||||||||||||||||
| 434 | levels[i] = eng->layoutData->items[i].analysis.bidiLevel; never executed: levels[i] = eng->layoutData->items[i].analysis.bidiLevel; | 0 | ||||||||||||||||||||||||||||||||||||
| 435 | QTextEngine::bidiReorder(nItems, levels.data(), visualOrder.data()); | - | ||||||||||||||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||||||||||||||
| 437 | for (int i = 0; i < nItems
| 0 | ||||||||||||||||||||||||||||||||||||
| 438 | int item = visualOrder[i]; | - | ||||||||||||||||||||||||||||||||||||
| 439 | QScriptItem &si = eng->layoutData->items[item]; | - | ||||||||||||||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||||||||||||||
| 441 | if (si.analysis.flags < QScriptAnalysis::TabOrObject
| 0 | ||||||||||||||||||||||||||||||||||||
| 442 | QGlyphLayout glyphs = eng->shapedGlyphs(&si); | - | ||||||||||||||||||||||||||||||||||||
| 443 | QFontEngine *fe = f.d->engineForScript(si.analysis.script); | - | ||||||||||||||||||||||||||||||||||||
| 444 | ((!(fe)) ? qt_assert("fe",__FILE__,1185) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 445 | fe->addOutlineToPath(x, y, glyphs, this, | - | ||||||||||||||||||||||||||||||||||||
| 446 | si.analysis.bidiLevel % 2 | - | ||||||||||||||||||||||||||||||||||||
| 447 | ? QTextItem::RenderFlags(QTextItem::RightToLeft) | - | ||||||||||||||||||||||||||||||||||||
| 448 | : QTextItem::RenderFlags(0)); | - | ||||||||||||||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||||||||||||||
| 450 | const qreal lw = fe->lineThickness().toReal(); | - | ||||||||||||||||||||||||||||||||||||
| 451 | if (f.d->underline
| 0 | ||||||||||||||||||||||||||||||||||||
| 452 | qreal pos = fe->underlinePosition().toReal(); | - | ||||||||||||||||||||||||||||||||||||
| 453 | addRect(x, y + pos, si.width.toReal(), lw); | - | ||||||||||||||||||||||||||||||||||||
| 454 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 455 | if (f.d->overline
| 0 | ||||||||||||||||||||||||||||||||||||
| 456 | qreal pos = fe->ascent().toReal() + 1; | - | ||||||||||||||||||||||||||||||||||||
| 457 | addRect(x, y - pos, si.width.toReal(), lw); | - | ||||||||||||||||||||||||||||||||||||
| 458 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 459 | if (f.d->strikeOut
| 0 | ||||||||||||||||||||||||||||||||||||
| 460 | qreal pos = fe->ascent().toReal() / 3; | - | ||||||||||||||||||||||||||||||||||||
| 461 | addRect(x, y - pos, si.width.toReal(), lw); | - | ||||||||||||||||||||||||||||||||||||
| 462 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 463 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 464 | x += si.width.toReal(); | - | ||||||||||||||||||||||||||||||||||||
| 465 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 466 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 467 | void QPainterPath::addPath(const QPainterPath &other) | - | ||||||||||||||||||||||||||||||||||||
| 468 | { | - | ||||||||||||||||||||||||||||||||||||
| 469 | if (other.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 470 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||||||||||||||
| 472 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 473 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||||||||||||||
| 475 | QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func()); | - | ||||||||||||||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||||||||||||||
| 477 | if (d->elements.last().type == MoveToElement
| 0 | ||||||||||||||||||||||||||||||||||||
| 478 | d->elements.remove(d->elements.size()-1); never executed: d->elements.remove(d->elements.size()-1); | 0 | ||||||||||||||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||||||||||||||
| 481 | int cStart = d->elements.size() + other.d_func()->cStart; | - | ||||||||||||||||||||||||||||||||||||
| 482 | d->elements += other.d_func()->elements; | - | ||||||||||||||||||||||||||||||||||||
| 483 | d->cStart = cStart; | - | ||||||||||||||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||||||||||||||
| 485 | d->require_moveTo = other.d_func()->isClosed(); | - | ||||||||||||||||||||||||||||||||||||
| 486 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 487 | void QPainterPath::connectPath(const QPainterPath &other) | - | ||||||||||||||||||||||||||||||||||||
| 488 | { | - | ||||||||||||||||||||||||||||||||||||
| 489 | if (other.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 490 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||||||||||||||
| 492 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 493 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 494 | - | |||||||||||||||||||||||||||||||||||||
| 495 | QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func()); | - | ||||||||||||||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||||||||||||||
| 497 | if (d->elements.last().type == MoveToElement
| 0 | ||||||||||||||||||||||||||||||||||||
| 498 | d->elements.remove(d->elements.size()-1); never executed: d->elements.remove(d->elements.size()-1); | 0 | ||||||||||||||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||||||||||||||
| 501 | int cStart = d->elements.size() + other.d_func()->cStart; | - | ||||||||||||||||||||||||||||||||||||
| 502 | int first = d->elements.size(); | - | ||||||||||||||||||||||||||||||||||||
| 503 | d->elements += other.d_func()->elements; | - | ||||||||||||||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||||||||||||||
| 505 | if (first != 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 506 | d->elements[first].type = LineToElement; never executed: d->elements[first].type = LineToElement; | 0 | ||||||||||||||||||||||||||||||||||||
| 507 | - | |||||||||||||||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||||||||||||||
| 509 | if (first > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 510 | d->elements.remove(first--); | - | ||||||||||||||||||||||||||||||||||||
| 511 | --cStart; | - | ||||||||||||||||||||||||||||||||||||
| 512 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||||||||||||||
| 514 | if (cStart != first
| 0 | ||||||||||||||||||||||||||||||||||||
| 515 | d->cStart = cStart; never executed: d->cStart = cStart; | 0 | ||||||||||||||||||||||||||||||||||||
| 516 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 517 | void QPainterPath::addRegion(const QRegion ®ion) | - | ||||||||||||||||||||||||||||||||||||
| 518 | { | - | ||||||||||||||||||||||||||||||||||||
| 519 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 520 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||||||||||||||
| 522 | QVector<QRect> rects = region.rects(); | - | ||||||||||||||||||||||||||||||||||||
| 523 | d_func()->elements.reserve(rects.size() * 5); | - | ||||||||||||||||||||||||||||||||||||
| 524 | for (int i=0; i<rects.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 525 | addRect(rects.at(i)); never executed: addRect(rects.at(i)); | 0 | ||||||||||||||||||||||||||||||||||||
| 526 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||||||||||||||
| 529 | - | |||||||||||||||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||||||||||||||
| 533 | - | |||||||||||||||||||||||||||||||||||||
| 534 | Qt::FillRule QPainterPath::fillRule() const | - | ||||||||||||||||||||||||||||||||||||
| 535 | { | - | ||||||||||||||||||||||||||||||||||||
| 536 | return never executed: isEmpty()return isEmpty() ? Qt::OddEvenFill : d_func()->fillRule;
never executed: return isEmpty() ? Qt::OddEvenFill : d_func()->fillRule; | 0 | ||||||||||||||||||||||||||||||||||||
| 537 | } | - | ||||||||||||||||||||||||||||||||||||
| 538 | void QPainterPath::setFillRule(Qt::FillRule fillRule) | - | ||||||||||||||||||||||||||||||||||||
| 539 | { | - | ||||||||||||||||||||||||||||||||||||
| 540 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 541 | if (d_func()->fillRule == fillRule
| 0 | ||||||||||||||||||||||||||||||||||||
| 542 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 543 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||||||||||||||
| 545 | d_func()->fillRule = fillRule; | - | ||||||||||||||||||||||||||||||||||||
| 546 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 547 | static QRectF qt_painterpath_bezier_extrema(const QBezier &b) | - | ||||||||||||||||||||||||||||||||||||
| 548 | { | - | ||||||||||||||||||||||||||||||||||||
| 549 | qreal minx, miny, maxx, maxy; | - | ||||||||||||||||||||||||||||||||||||
| 550 | - | |||||||||||||||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||||||||||||||
| 552 | if (b.x1 < b.x4
| 0 | ||||||||||||||||||||||||||||||||||||
| 553 | minx = b.x1; | - | ||||||||||||||||||||||||||||||||||||
| 554 | maxx = b.x4; | - | ||||||||||||||||||||||||||||||||||||
| 555 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 556 | minx = b.x4; | - | ||||||||||||||||||||||||||||||||||||
| 557 | maxx = b.x1; | - | ||||||||||||||||||||||||||||||||||||
| 558 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 559 | if (b.y1 < b.y4
| 0 | ||||||||||||||||||||||||||||||||||||
| 560 | miny = b.y1; | - | ||||||||||||||||||||||||||||||||||||
| 561 | maxy = b.y4; | - | ||||||||||||||||||||||||||||||||||||
| 562 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 563 | miny = b.y4; | - | ||||||||||||||||||||||||||||||||||||
| 564 | maxy = b.y1; | - | ||||||||||||||||||||||||||||||||||||
| 565 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 566 | - | |||||||||||||||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||||||||||||||
| 568 | { | - | ||||||||||||||||||||||||||||||||||||
| 569 | qreal ax = 3 * (-b.x1 + 3*b.x2 - 3*b.x3 +b.x4); | - | ||||||||||||||||||||||||||||||||||||
| 570 | qreal bx = 6 * (b.x1 - 2*b.x2 + b.x3); | - | ||||||||||||||||||||||||||||||||||||
| 571 | qreal cx = 3 * (- b.x1 + b.x2); | - | ||||||||||||||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||||||||||||||
| 573 | if (qFuzzyIsNull(ax)
| 0 | ||||||||||||||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||||||||||||||
| 576 | if (!qFuzzyIsNull(bx)
| 0 | ||||||||||||||||||||||||||||||||||||
| 577 | qreal t = -cx / bx; | - | ||||||||||||||||||||||||||||||||||||
| 578 | if (t >= 0
never executed: else if (p.x() > maxxminx = p.x();
never executed: if (p.y() < minymaxx = p.x();
never executed: else if (p.y() > maxyminy = p.y();
never executed: }maxy = p.y();never executed: ;end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 579 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||||||||||||||
| 581 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 582 | const qreal tx = bx * bx - 4 * ax * cx; | - | ||||||||||||||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||||||||||||||
| 584 | if (tx >= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 585 | qreal temp = qSqrt(tx); | - | ||||||||||||||||||||||||||||||||||||
| 586 | qreal rcp = 1 / (2 * ax); | - | ||||||||||||||||||||||||||||||||||||
| 587 | qreal t1 = (-bx + temp) * rcp; | - | ||||||||||||||||||||||||||||||||||||
| 588 | if (t1 >= 0
never executed: else if (p.x() > maxxminx = p.x();
never executed: if (p.y() < minymaxx = p.x();
never executed: else if (p.y() > maxyminy = p.y();
never executed: }maxy = p.y();never executed: ;end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||||||||||||||
| 590 | qreal t2 = (-bx - temp) * rcp; | - | ||||||||||||||||||||||||||||||||||||
| 591 | if (t2 >= 0
never executed: else if (p.x() > maxxminx = p.x();
never executed: if (p.y() < minymaxx = p.x();
never executed: else if (p.y() > maxyminy = p.y();
never executed: }maxy = p.y();never executed: ;end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 592 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 593 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 594 | } | - | ||||||||||||||||||||||||||||||||||||
| 595 | - | |||||||||||||||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||||||||||||||
| 597 | { | - | ||||||||||||||||||||||||||||||||||||
| 598 | qreal ay = 3 * (-b.y1 + 3*b.y2 - 3*b.y3 +b.y4); | - | ||||||||||||||||||||||||||||||||||||
| 599 | qreal by = 6 * (b.y1 - 2*b.y2 + b.y3); | - | ||||||||||||||||||||||||||||||||||||
| 600 | qreal cy = 3 * (- b.y1 + b.y2); | - | ||||||||||||||||||||||||||||||||||||
| 601 | - | |||||||||||||||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||||||||||||||
| 603 | if (qFuzzyIsNull(ay)
| 0 | ||||||||||||||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||||||||||||||
| 606 | if (!qFuzzyIsNull(by)
| 0 | ||||||||||||||||||||||||||||||||||||
| 607 | qreal t = -cy / by; | - | ||||||||||||||||||||||||||||||||||||
| 608 | if (t >= 0
never executed: else if (p.x() > maxxminx = p.x();
never executed: if (p.y() < minymaxx = p.x();
never executed: else if (p.y() > maxyminy = p.y();
never executed: }maxy = p.y();never executed: ;end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 609 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||||||||||||||
| 611 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 612 | const qreal ty = by * by - 4 * ay * cy; | - | ||||||||||||||||||||||||||||||||||||
| 613 | - | |||||||||||||||||||||||||||||||||||||
| 614 | if (ty > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 615 | qreal temp = qSqrt(ty); | - | ||||||||||||||||||||||||||||||||||||
| 616 | qreal rcp = 1 / (2 * ay); | - | ||||||||||||||||||||||||||||||||||||
| 617 | qreal t1 = (-by + temp) * rcp; | - | ||||||||||||||||||||||||||||||||||||
| 618 | if (t1 >= 0
never executed: else if (p.x() > maxxminx = p.x();
never executed: if (p.y() < minymaxx = p.x();
never executed: else if (p.y() > maxyminy = p.y();
never executed: }maxy = p.y();never executed: ;end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 619 | - | |||||||||||||||||||||||||||||||||||||
| 620 | qreal t2 = (-by - temp) * rcp; | - | ||||||||||||||||||||||||||||||||||||
| 621 | if (t2 >= 0
never executed: else if (p.x() > maxxminx = p.x();
never executed: if (p.y() < minymaxx = p.x();
never executed: else if (p.y() > maxyminy = p.y();
never executed: }maxy = p.y();never executed: ;end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 622 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 623 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 624 | } | - | ||||||||||||||||||||||||||||||||||||
| 625 | return never executed: QRectF(minx, miny, maxx - minx, maxy - miny);return QRectF(minx, miny, maxx - minx, maxy - miny);never executed: return QRectF(minx, miny, maxx - minx, maxy - miny); | 0 | ||||||||||||||||||||||||||||||||||||
| 626 | } | - | ||||||||||||||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||||||||||||||
| 628 | - | |||||||||||||||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||||||||||||||
| 630 | - | |||||||||||||||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||||||||||||||
| 632 | - | |||||||||||||||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||||||||||||||
| 634 | QRectF QPainterPath::boundingRect() const | - | ||||||||||||||||||||||||||||||||||||
| 635 | { | - | ||||||||||||||||||||||||||||||||||||
| 636 | if (!d_ptr
| 0 | ||||||||||||||||||||||||||||||||||||
| 637 | return never executed: QRectF();return QRectF();never executed: return QRectF(); | 0 | ||||||||||||||||||||||||||||||||||||
| 638 | QPainterPathData *d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 639 | - | |||||||||||||||||||||||||||||||||||||
| 640 | if (d->dirtyBounds
| 0 | ||||||||||||||||||||||||||||||||||||
| 641 | computeBoundingRect(); never executed: computeBoundingRect(); | 0 | ||||||||||||||||||||||||||||||||||||
| 642 | return never executed: d->bounds;return d->bounds;never executed: return d->bounds; | 0 | ||||||||||||||||||||||||||||||||||||
| 643 | } | - | ||||||||||||||||||||||||||||||||||||
| 644 | QRectF QPainterPath::controlPointRect() const | - | ||||||||||||||||||||||||||||||||||||
| 645 | { | - | ||||||||||||||||||||||||||||||||||||
| 646 | if (!d_ptr
| 0 | ||||||||||||||||||||||||||||||||||||
| 647 | return never executed: QRectF();return QRectF();never executed: return QRectF(); | 0 | ||||||||||||||||||||||||||||||||||||
| 648 | QPainterPathData *d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 649 | - | |||||||||||||||||||||||||||||||||||||
| 650 | if (d->dirtyControlBounds
| 0 | ||||||||||||||||||||||||||||||||||||
| 651 | computeControlPointRect(); never executed: computeControlPointRect(); | 0 | ||||||||||||||||||||||||||||||||||||
| 652 | return never executed: d->controlBounds;return d->controlBounds;never executed: return d->controlBounds; | 0 | ||||||||||||||||||||||||||||||||||||
| 653 | } | - | ||||||||||||||||||||||||||||||||||||
| 654 | bool QPainterPath::isEmpty() const | - | ||||||||||||||||||||||||||||||||||||
| 655 | { | - | ||||||||||||||||||||||||||||||||||||
| 656 | return never executed: !d_ptrreturn !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement);
never executed: return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement); | 0 | ||||||||||||||||||||||||||||||||||||
| 657 | } | - | ||||||||||||||||||||||||||||||||||||
| 658 | QPainterPath QPainterPath::toReversed() const | - | ||||||||||||||||||||||||||||||||||||
| 659 | { | - | ||||||||||||||||||||||||||||||||||||
| 660 | const QPainterPathPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 661 | QPainterPath rev; | - | ||||||||||||||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||||||||||||||
| 663 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 664 | rev = *this; | - | ||||||||||||||||||||||||||||||||||||
| 665 | return never executed: rev;return rev;never executed: return rev; | 0 | ||||||||||||||||||||||||||||||||||||
| 666 | } | - | ||||||||||||||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||||||||||||||
| 668 | rev.moveTo(d->elements.at(d->elements.size()-1).x, d->elements.at(d->elements.size()-1).y); | - | ||||||||||||||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||||||||||||||
| 670 | for (int i=d->elements.size()-1; i>=1
| 0 | ||||||||||||||||||||||||||||||||||||
| 671 | const QPainterPath::Element &elm = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 672 | const QPainterPath::Element &prev = d->elements.at(i-1); | - | ||||||||||||||||||||||||||||||||||||
| 673 | switch (elm.type) { | - | ||||||||||||||||||||||||||||||||||||
| 674 | case never executed: LineToElement:case LineToElement:never executed: case LineToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 675 | rev.lineTo(prev.x, prev.y); | - | ||||||||||||||||||||||||||||||||||||
| 676 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 677 | case never executed: MoveToElement:case MoveToElement:never executed: case MoveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 678 | rev.moveTo(prev.x, prev.y); | - | ||||||||||||||||||||||||||||||||||||
| 679 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 680 | case never executed: CurveToDataElement:case CurveToDataElement:never executed: case CurveToDataElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 681 | { | - | ||||||||||||||||||||||||||||||||||||
| 682 | ((!(i>=3)) ? qt_assert("i>=3",__FILE__,1523) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 683 | const QPainterPath::Element &cp1 = d->elements.at(i-2); | - | ||||||||||||||||||||||||||||||||||||
| 684 | const QPainterPath::Element &sp = d->elements.at(i-3); | - | ||||||||||||||||||||||||||||||||||||
| 685 | ((!(prev.type == CurveToDataElement)) ? qt_assert("prev.type == CurveToDataElement",__FILE__,1526) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 686 | ((!(cp1.type == CurveToElement)) ? qt_assert("cp1.type == CurveToElement",__FILE__,1527) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 687 | rev.cubicTo(prev.x, prev.y, cp1.x, cp1.y, sp.x, sp.y); | - | ||||||||||||||||||||||||||||||||||||
| 688 | i -= 2; | - | ||||||||||||||||||||||||||||||||||||
| 689 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 690 | } | - | ||||||||||||||||||||||||||||||||||||
| 691 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 692 | ((!(!"qt_reversed_path")) ? qt_assert("!\"qt_reversed_path\"",__FILE__,1533) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 693 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 694 | } | - | ||||||||||||||||||||||||||||||||||||
| 695 | } | - | ||||||||||||||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||||||||||||||
| 697 | return never executed: rev;return rev;never executed: return rev; | 0 | ||||||||||||||||||||||||||||||||||||
| 698 | } | - | ||||||||||||||||||||||||||||||||||||
| 699 | QList<QPolygonF> QPainterPath::toSubpathPolygons(const QTransform &matrix) const | - | ||||||||||||||||||||||||||||||||||||
| 700 | { | - | ||||||||||||||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||||||||||||||
| 702 | const QPainterPathPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 703 | QList<QPolygonF> flatCurves; | - | ||||||||||||||||||||||||||||||||||||
| 704 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 705 | return never executed: flatCurves;return flatCurves;never executed: return flatCurves; | 0 | ||||||||||||||||||||||||||||||||||||
| 706 | - | |||||||||||||||||||||||||||||||||||||
| 707 | QPolygonF current; | - | ||||||||||||||||||||||||||||||||||||
| 708 | for (int i=0; i<elementCount()
| 0 | ||||||||||||||||||||||||||||||||||||
| 709 | const QPainterPath::Element &e = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 710 | switch (e.type) { | - | ||||||||||||||||||||||||||||||||||||
| 711 | case never executed: QPainterPath::MoveToElement:case QPainterPath::MoveToElement:never executed: case QPainterPath::MoveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 712 | if (current.size() > 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 713 | flatCurves += current; never executed: flatCurves += current; | 0 | ||||||||||||||||||||||||||||||||||||
| 714 | current.clear(); | - | ||||||||||||||||||||||||||||||||||||
| 715 | current.reserve(16); | - | ||||||||||||||||||||||||||||||||||||
| 716 | current += QPointF(e.x, e.y) * matrix; | - | ||||||||||||||||||||||||||||||||||||
| 717 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 718 | case never executed: QPainterPath::LineToElement:case QPainterPath::LineToElement:never executed: case QPainterPath::LineToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 719 | current += QPointF(e.x, e.y) * matrix; | - | ||||||||||||||||||||||||||||||||||||
| 720 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 721 | case never executed: QPainterPath::CurveToElement:case QPainterPath::CurveToElement:never executed: {case QPainterPath::CurveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 722 | ((!(d->elements.at(i+1).type == QPainterPath::CurveToDataElement)) ? qt_assert("d->elements.at(i+1).type == QPainterPath::CurveToDataElement",__FILE__,1576) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 723 | ((!(d->elements.at(i+2).type == QPainterPath::CurveToDataElement)) ? qt_assert("d->elements.at(i+2).type == QPainterPath::CurveToDataElement",__FILE__,1577) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 724 | QBezier bezier = QBezier::fromPoints(QPointF(d->elements.at(i-1).x, d->elements.at(i-1).y) * matrix, | - | ||||||||||||||||||||||||||||||||||||
| 725 | QPointF(e.x, e.y) * matrix, | - | ||||||||||||||||||||||||||||||||||||
| 726 | QPointF(d->elements.at(i+1).x, d->elements.at(i+1).y) * matrix, | - | ||||||||||||||||||||||||||||||||||||
| 727 | QPointF(d->elements.at(i+2).x, d->elements.at(i+2).y) * matrix); | - | ||||||||||||||||||||||||||||||||||||
| 728 | bezier.addToPolygon(¤t); | - | ||||||||||||||||||||||||||||||||||||
| 729 | i+=2; | - | ||||||||||||||||||||||||||||||||||||
| 730 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 731 | } | - | ||||||||||||||||||||||||||||||||||||
| 732 | case never executed: QPainterPath::CurveToDataElement:case QPainterPath::CurveToDataElement:never executed: case QPainterPath::CurveToDataElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 733 | ((!(!"QPainterPath::toSubpathPolygons(), bad element type")) ? qt_assert("!\"QPainterPath::toSubpathPolygons(), bad element type\"",__FILE__,1587) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 734 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 735 | } | - | ||||||||||||||||||||||||||||||||||||
| 736 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 737 | - | |||||||||||||||||||||||||||||||||||||
| 738 | if (current.size()>1
| 0 | ||||||||||||||||||||||||||||||||||||
| 739 | flatCurves += current; never executed: flatCurves += current; | 0 | ||||||||||||||||||||||||||||||||||||
| 740 | - | |||||||||||||||||||||||||||||||||||||
| 741 | return never executed: flatCurves;return flatCurves;never executed: return flatCurves; | 0 | ||||||||||||||||||||||||||||||||||||
| 742 | } | - | ||||||||||||||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||||||||||||||
| 747 | QList<QPolygonF> QPainterPath::toSubpathPolygons(const QMatrix &matrix) const | - | ||||||||||||||||||||||||||||||||||||
| 748 | { | - | ||||||||||||||||||||||||||||||||||||
| 749 | return never executed: toSubpathPolygons(QTransform(matrix));return toSubpathPolygons(QTransform(matrix));never executed: return toSubpathPolygons(QTransform(matrix)); | 0 | ||||||||||||||||||||||||||||||||||||
| 750 | } | - | ||||||||||||||||||||||||||||||||||||
| 751 | QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const | - | ||||||||||||||||||||||||||||||||||||
| 752 | { | - | ||||||||||||||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||||||||||||||
| 754 | QList<QPolygonF> polys; | - | ||||||||||||||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||||||||||||||
| 756 | QList<QPolygonF> subpaths = toSubpathPolygons(matrix); | - | ||||||||||||||||||||||||||||||||||||
| 757 | int count = subpaths.size(); | - | ||||||||||||||||||||||||||||||||||||
| 758 | - | |||||||||||||||||||||||||||||||||||||
| 759 | if (count == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 760 | return never executed: polys;return polys;never executed: return polys; | 0 | ||||||||||||||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||||||||||||||
| 762 | QVector<QRectF> bounds; | - | ||||||||||||||||||||||||||||||||||||
| 763 | bounds.reserve(count); | - | ||||||||||||||||||||||||||||||||||||
| 764 | for (int i=0; i<count
| 0 | ||||||||||||||||||||||||||||||||||||
| 765 | bounds += subpaths.at(i).boundingRect(); never executed: bounds += subpaths.at(i).boundingRect(); | 0 | ||||||||||||||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||||||||||||||
| 767 | - | |||||||||||||||||||||||||||||||||||||
| 768 | - | |||||||||||||||||||||||||||||||||||||
| 769 | - | |||||||||||||||||||||||||||||||||||||
| 770 | - | |||||||||||||||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||||||||||||||
| 772 | - | |||||||||||||||||||||||||||||||||||||
| 773 | QVector< QList<int> > isects; | - | ||||||||||||||||||||||||||||||||||||
| 774 | isects.resize(count); | - | ||||||||||||||||||||||||||||||||||||
| 775 | - | |||||||||||||||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||||||||||||||
| 777 | for (int j=0; j<count
| 0 | ||||||||||||||||||||||||||||||||||||
| 778 | if (subpaths.at(j).size() <= 2
| 0 | ||||||||||||||||||||||||||||||||||||
| 779 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
| 780 | QRectF cbounds = bounds.at(j); | - | ||||||||||||||||||||||||||||||||||||
| 781 | for (int i=0; i<count
| 0 | ||||||||||||||||||||||||||||||||||||
| 782 | if (cbounds.intersects(bounds.at(i))
| 0 | ||||||||||||||||||||||||||||||||||||
| 783 | isects[j] << i; | - | ||||||||||||||||||||||||||||||||||||
| 784 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 785 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 786 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 787 | for (int i=0; i<count
| 0 | ||||||||||||||||||||||||||||||||||||
| 788 | const QList<int> ¤t_isects = isects.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 789 | for (int j=0; j<current_isects.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 790 | int isect_j = current_isects.at(j); | - | ||||||||||||||||||||||||||||||||||||
| 791 | if (isect_j == i
| 0 | ||||||||||||||||||||||||||||||||||||
| 792 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
| 793 | for (int k=0; k<isects[isect_j].size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 794 | int isect_k = isects[isect_j][k]; | - | ||||||||||||||||||||||||||||||||||||
| 795 | if (isect_k != i
| 0 | ||||||||||||||||||||||||||||||||||||
| 796 | isects[i] += isect_k; | - | ||||||||||||||||||||||||||||||||||||
| 797 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 798 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 799 | isects[isect_j].clear(); | - | ||||||||||||||||||||||||||||||||||||
| 800 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 801 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 802 | for (int i=0; i<count
| 0 | ||||||||||||||||||||||||||||||||||||
| 803 | const QList<int> &subpath_list = isects[i]; | - | ||||||||||||||||||||||||||||||||||||
| 804 | if (!subpath_list.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 805 | QPolygonF buildUp; | - | ||||||||||||||||||||||||||||||||||||
| 806 | for (int j=0; j<subpath_list.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 807 | const QPolygonF &subpath = subpaths.at(subpath_list.at(j)); | - | ||||||||||||||||||||||||||||||||||||
| 808 | buildUp += subpath; | - | ||||||||||||||||||||||||||||||||||||
| 809 | if (!subpath.isClosed()
| 0 | ||||||||||||||||||||||||||||||||||||
| 810 | buildUp += subpath.first(); never executed: buildUp += subpath.first(); | 0 | ||||||||||||||||||||||||||||||||||||
| 811 | if (!buildUp.isClosed()
| 0 | ||||||||||||||||||||||||||||||||||||
| 812 | buildUp += buildUp.first(); never executed: buildUp += buildUp.first(); | 0 | ||||||||||||||||||||||||||||||||||||
| 813 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 814 | polys += buildUp; | - | ||||||||||||||||||||||||||||||||||||
| 815 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 816 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 817 | - | |||||||||||||||||||||||||||||||||||||
| 818 | return never executed: polys;return polys;never executed: return polys; | 0 | ||||||||||||||||||||||||||||||||||||
| 819 | } | - | ||||||||||||||||||||||||||||||||||||
| 820 | - | |||||||||||||||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||||||||||||||
| 822 | - | |||||||||||||||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||||||||||||||
| 824 | QList<QPolygonF> QPainterPath::toFillPolygons(const QMatrix &matrix) const | - | ||||||||||||||||||||||||||||||||||||
| 825 | { | - | ||||||||||||||||||||||||||||||||||||
| 826 | return never executed: toFillPolygons(QTransform(matrix));return toFillPolygons(QTransform(matrix));never executed: return toFillPolygons(QTransform(matrix)); | 0 | ||||||||||||||||||||||||||||||||||||
| 827 | } | - | ||||||||||||||||||||||||||||||||||||
| 828 | - | |||||||||||||||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||||||||||||||
| 830 | static void qt_painterpath_isect_line(const QPointF &p1, | - | ||||||||||||||||||||||||||||||||||||
| 831 | const QPointF &p2, | - | ||||||||||||||||||||||||||||||||||||
| 832 | const QPointF &pos, | - | ||||||||||||||||||||||||||||||||||||
| 833 | int *winding) | - | ||||||||||||||||||||||||||||||||||||
| 834 | { | - | ||||||||||||||||||||||||||||||||||||
| 835 | qreal x1 = p1.x(); | - | ||||||||||||||||||||||||||||||||||||
| 836 | qreal y1 = p1.y(); | - | ||||||||||||||||||||||||||||||||||||
| 837 | qreal x2 = p2.x(); | - | ||||||||||||||||||||||||||||||||||||
| 838 | qreal y2 = p2.y(); | - | ||||||||||||||||||||||||||||||||||||
| 839 | qreal y = pos.y(); | - | ||||||||||||||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||||||||||||||
| 841 | int dir = 1; | - | ||||||||||||||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||||||||||||||
| 843 | if (qFuzzyCompare(y1, y2)
| 0 | ||||||||||||||||||||||||||||||||||||
| 844 | - | |||||||||||||||||||||||||||||||||||||
| 845 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 846 | } else if (y2 < y1
| 0 | ||||||||||||||||||||||||||||||||||||
| 847 | qreal x_tmp = x2; x2 = x1; x1 = x_tmp; | - | ||||||||||||||||||||||||||||||||||||
| 848 | qreal y_tmp = y2; y2 = y1; y1 = y_tmp; | - | ||||||||||||||||||||||||||||||||||||
| 849 | dir = -1; | - | ||||||||||||||||||||||||||||||||||||
| 850 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 851 | - | |||||||||||||||||||||||||||||||||||||
| 852 | if (y >= y1
| 0 | ||||||||||||||||||||||||||||||||||||
| 853 | qreal x = x1 + ((x2 - x1) / (y2 - y1)) * (y - y1); | - | ||||||||||||||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||||||||||||||
| 856 | if (x<=pos.x()
| 0 | ||||||||||||||||||||||||||||||||||||
| 857 | (*winding) += dir; | - | ||||||||||||||||||||||||||||||||||||
| 858 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 859 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 860 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||||||||
| 862 | static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt, | - | ||||||||||||||||||||||||||||||||||||
| 863 | int *winding, int depth = 0) | - | ||||||||||||||||||||||||||||||||||||
| 864 | { | - | ||||||||||||||||||||||||||||||||||||
| 865 | qreal y = pt.y(); | - | ||||||||||||||||||||||||||||||||||||
| 866 | qreal x = pt.x(); | - | ||||||||||||||||||||||||||||||||||||
| 867 | QRectF bounds = bezier.bounds(); | - | ||||||||||||||||||||||||||||||||||||
| 868 | - | |||||||||||||||||||||||||||||||||||||
| 869 | - | |||||||||||||||||||||||||||||||||||||
| 870 | - | |||||||||||||||||||||||||||||||||||||
| 871 | - | |||||||||||||||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||||||||||||||
| 873 | if (y >= bounds.y()
| 0 | ||||||||||||||||||||||||||||||||||||
| 874 | - | |||||||||||||||||||||||||||||||||||||
| 875 | - | |||||||||||||||||||||||||||||||||||||
| 876 | - | |||||||||||||||||||||||||||||||||||||
| 877 | const qreal lower_bound = qreal(.001); | - | ||||||||||||||||||||||||||||||||||||
| 878 | if (depth == 32
| 0 | ||||||||||||||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||||||||||||||
| 881 | - | |||||||||||||||||||||||||||||||||||||
| 882 | if (bezier.pt1().x() <= x
| 0 | ||||||||||||||||||||||||||||||||||||
| 883 | (*winding) += (bezier.pt4().y() > bezier.pt1().y()
| 0 | ||||||||||||||||||||||||||||||||||||
| 884 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 885 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 886 | } | - | ||||||||||||||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||||||||||||||
| 888 | - | |||||||||||||||||||||||||||||||||||||
| 889 | QBezier first_half, second_half; | - | ||||||||||||||||||||||||||||||||||||
| 890 | bezier.split(&first_half, &second_half); | - | ||||||||||||||||||||||||||||||||||||
| 891 | qt_painterpath_isect_curve(first_half, pt, winding, depth + 1); | - | ||||||||||||||||||||||||||||||||||||
| 892 | qt_painterpath_isect_curve(second_half, pt, winding, depth + 1); | - | ||||||||||||||||||||||||||||||||||||
| 893 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 894 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 895 | bool QPainterPath::contains(const QPointF &pt) const | - | ||||||||||||||||||||||||||||||||||||
| 896 | { | - | ||||||||||||||||||||||||||||||||||||
| 897 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 898 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 899 | - | |||||||||||||||||||||||||||||||||||||
| 900 | QPainterPathData *d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 901 | - | |||||||||||||||||||||||||||||||||||||
| 902 | int winding_number = 0; | - | ||||||||||||||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||||||||||||||
| 904 | QPointF last_pt; | - | ||||||||||||||||||||||||||||||||||||
| 905 | QPointF last_start; | - | ||||||||||||||||||||||||||||||||||||
| 906 | for (int i=0; i<d->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 907 | const Element &e = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||||||||||||||
| 909 | switch (e.type) { | - | ||||||||||||||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||||||||||||||
| 911 | case never executed: MoveToElement:case MoveToElement:never executed: case MoveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 912 | if (i > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 913 | qt_painterpath_isect_line(last_pt, last_start, pt, &winding_number); never executed: qt_painterpath_isect_line(last_pt, last_start, pt, &winding_number); | 0 | ||||||||||||||||||||||||||||||||||||
| 914 | last_start = last_pt = e; | - | ||||||||||||||||||||||||||||||||||||
| 915 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 916 | - | |||||||||||||||||||||||||||||||||||||
| 917 | case never executed: LineToElement:case LineToElement:never executed: case LineToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 918 | qt_painterpath_isect_line(last_pt, e, pt, &winding_number); | - | ||||||||||||||||||||||||||||||||||||
| 919 | last_pt = e; | - | ||||||||||||||||||||||||||||||||||||
| 920 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 921 | - | |||||||||||||||||||||||||||||||||||||
| 922 | case never executed: CurveToElement:case CurveToElement:never executed: case CurveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 923 | { | - | ||||||||||||||||||||||||||||||||||||
| 924 | const QPainterPath::Element &cp2 = d->elements.at(++i); | - | ||||||||||||||||||||||||||||||||||||
| 925 | const QPainterPath::Element &ep = d->elements.at(++i); | - | ||||||||||||||||||||||||||||||||||||
| 926 | qt_painterpath_isect_curve(QBezier::fromPoints(last_pt, e, cp2, ep), | - | ||||||||||||||||||||||||||||||||||||
| 927 | pt, &winding_number); | - | ||||||||||||||||||||||||||||||||||||
| 928 | last_pt = ep; | - | ||||||||||||||||||||||||||||||||||||
| 929 | - | |||||||||||||||||||||||||||||||||||||
| 930 | } | - | ||||||||||||||||||||||||||||||||||||
| 931 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||||||||||||||
| 933 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 934 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 935 | } | - | ||||||||||||||||||||||||||||||||||||
| 936 | } | - | ||||||||||||||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||||||||||||||
| 938 | - | |||||||||||||||||||||||||||||||||||||
| 939 | if (last_pt != last_start
| 0 | ||||||||||||||||||||||||||||||||||||
| 940 | qt_painterpath_isect_line(last_pt, last_start, pt, &winding_number); never executed: qt_painterpath_isect_line(last_pt, last_start, pt, &winding_number); | 0 | ||||||||||||||||||||||||||||||||||||
| 941 | - | |||||||||||||||||||||||||||||||||||||
| 942 | return never executed: (d->fillRule == Qt::WindingFillreturn (d->fillRule == Qt::WindingFill ? (winding_number != 0) : ((winding_number % 2) != 0));
never executed: return (d->fillRule == Qt::WindingFill ? (winding_number != 0) : ((winding_number % 2) != 0)); | 0 | ||||||||||||||||||||||||||||||||||||
| 943 | ? (winding_number != 0) never executed: return (d->fillRule == Qt::WindingFill ? (winding_number != 0) : ((winding_number % 2) != 0)); | 0 | ||||||||||||||||||||||||||||||||||||
| 944 | : ((winding_number % 2) != 0)); never executed: return (d->fillRule == Qt::WindingFill ? (winding_number != 0) : ((winding_number % 2) != 0)); | 0 | ||||||||||||||||||||||||||||||||||||
| 945 | } | - | ||||||||||||||||||||||||||||||||||||
| 946 | - | |||||||||||||||||||||||||||||||||||||
| 947 | static bool qt_painterpath_isect_line_rect(qreal x1, qreal y1, qreal x2, qreal y2, | - | ||||||||||||||||||||||||||||||||||||
| 948 | const QRectF &rect) | - | ||||||||||||||||||||||||||||||||||||
| 949 | { | - | ||||||||||||||||||||||||||||||||||||
| 950 | qreal left = rect.left(); | - | ||||||||||||||||||||||||||||||||||||
| 951 | qreal right = rect.right(); | - | ||||||||||||||||||||||||||||||||||||
| 952 | qreal top = rect.top(); | - | ||||||||||||||||||||||||||||||||||||
| 953 | qreal bottom = rect.bottom(); | - | ||||||||||||||||||||||||||||||||||||
| 954 | - | |||||||||||||||||||||||||||||||||||||
| 955 | enum { Left, Right, Top, Bottom }; | - | ||||||||||||||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||||||||||||||
| 957 | int p1 = ((x1 < left) << Left) | - | ||||||||||||||||||||||||||||||||||||
| 958 | | ((x1 > right) << Right) | - | ||||||||||||||||||||||||||||||||||||
| 959 | | ((y1 < top) << Top) | - | ||||||||||||||||||||||||||||||||||||
| 960 | | ((y1 > bottom) << Bottom); | - | ||||||||||||||||||||||||||||||||||||
| 961 | int p2 = ((x2 < left) << Left) | - | ||||||||||||||||||||||||||||||||||||
| 962 | | ((x2 > right) << Right) | - | ||||||||||||||||||||||||||||||||||||
| 963 | | ((y2 < top) << Top) | - | ||||||||||||||||||||||||||||||||||||
| 964 | | ((y2 > bottom) << Bottom); | - | ||||||||||||||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||||||||||||||
| 966 | if (p1 & p2
| 0 | ||||||||||||||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||||||||||||||
| 968 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||||||||||||||
| 970 | if (p1 | p2
| 0 | ||||||||||||||||||||||||||||||||||||
| 971 | qreal dx = x2 - x1; | - | ||||||||||||||||||||||||||||||||||||
| 972 | qreal dy = y2 - y1; | - | ||||||||||||||||||||||||||||||||||||
| 973 | - | |||||||||||||||||||||||||||||||||||||
| 974 | - | |||||||||||||||||||||||||||||||||||||
| 975 | if (x1 < left
| 0 | ||||||||||||||||||||||||||||||||||||
| 976 | y1 += dy/dx * (left - x1); | - | ||||||||||||||||||||||||||||||||||||
| 977 | x1 = left; | - | ||||||||||||||||||||||||||||||||||||
| 978 | } never executed: else if (x1 > rightend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 979 | y1 -= dy/dx * (x1 - right); | - | ||||||||||||||||||||||||||||||||||||
| 980 | x1 = right; | - | ||||||||||||||||||||||||||||||||||||
| 981 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 982 | if (x2 < left
| 0 | ||||||||||||||||||||||||||||||||||||
| 983 | y2 += dy/dx * (left - x2); | - | ||||||||||||||||||||||||||||||||||||
| 984 | x2 = left; | - | ||||||||||||||||||||||||||||||||||||
| 985 | } never executed: else if (x2 > rightend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 986 | y2 -= dy/dx * (x2 - right); | - | ||||||||||||||||||||||||||||||||||||
| 987 | x2 = right; | - | ||||||||||||||||||||||||||||||||||||
| 988 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||||||||||||||
| 990 | p1 = ((y1 < top) << Top) | - | ||||||||||||||||||||||||||||||||||||
| 991 | | ((y1 > bottom) << Bottom); | - | ||||||||||||||||||||||||||||||||||||
| 992 | p2 = ((y2 < top) << Top) | - | ||||||||||||||||||||||||||||||||||||
| 993 | | ((y2 > bottom) << Bottom); | - | ||||||||||||||||||||||||||||||||||||
| 994 | - | |||||||||||||||||||||||||||||||||||||
| 995 | if (p1 & p2
| 0 | ||||||||||||||||||||||||||||||||||||
| 996 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||||||||||||||
| 998 | - | |||||||||||||||||||||||||||||||||||||
| 999 | if (y1 < top
| 0 | ||||||||||||||||||||||||||||||||||||
| 1000 | x1 += dx/dy * (top - y1); | - | ||||||||||||||||||||||||||||||||||||
| 1001 | y1 = top; | - | ||||||||||||||||||||||||||||||||||||
| 1002 | } never executed: else if (y1 > bottomend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1003 | x1 -= dx/dy * (y1 - bottom); | - | ||||||||||||||||||||||||||||||||||||
| 1004 | y1 = bottom; | - | ||||||||||||||||||||||||||||||||||||
| 1005 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1006 | if (y2 < top
| 0 | ||||||||||||||||||||||||||||||||||||
| 1007 | x2 += dx/dy * (top - y2); | - | ||||||||||||||||||||||||||||||||||||
| 1008 | y2 = top; | - | ||||||||||||||||||||||||||||||||||||
| 1009 | } never executed: else if (y2 > bottomend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1010 | x2 -= dx/dy * (y2 - bottom); | - | ||||||||||||||||||||||||||||||||||||
| 1011 | y2 = bottom; | - | ||||||||||||||||||||||||||||||||||||
| 1012 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1013 | - | |||||||||||||||||||||||||||||||||||||
| 1014 | p1 = ((x1 < left) << Left) | - | ||||||||||||||||||||||||||||||||||||
| 1015 | | ((x1 > right) << Right); | - | ||||||||||||||||||||||||||||||||||||
| 1016 | p2 = ((x2 < left) << Left) | - | ||||||||||||||||||||||||||||||||||||
| 1017 | | ((x2 > right) << Right); | - | ||||||||||||||||||||||||||||||||||||
| 1018 | - | |||||||||||||||||||||||||||||||||||||
| 1019 | if (p1 & p2
| 0 | ||||||||||||||||||||||||||||||||||||
| 1020 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1021 | - | |||||||||||||||||||||||||||||||||||||
| 1022 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1023 | } | - | ||||||||||||||||||||||||||||||||||||
| 1024 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1025 | } | - | ||||||||||||||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||||||||||||||
| 1027 | static bool qt_isect_curve_horizontal(const QBezier &bezier, qreal y, qreal x1, qreal x2, int depth = 0) | - | ||||||||||||||||||||||||||||||||||||
| 1028 | { | - | ||||||||||||||||||||||||||||||||||||
| 1029 | QRectF bounds = bezier.bounds(); | - | ||||||||||||||||||||||||||||||||||||
| 1030 | - | |||||||||||||||||||||||||||||||||||||
| 1031 | if (y >= bounds.top()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1032 | && bounds.right() >= x1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1033 | const qreal lower_bound = qreal(.01); | - | ||||||||||||||||||||||||||||||||||||
| 1034 | if (depth == 32
| 0 | ||||||||||||||||||||||||||||||||||||
| 1035 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||||||||||||||
| 1037 | QBezier first_half, second_half; | - | ||||||||||||||||||||||||||||||||||||
| 1038 | bezier.split(&first_half, &second_half); | - | ||||||||||||||||||||||||||||||||||||
| 1039 | if (qt_isect_curve_horizontal(first_half, y, x1, x2, depth + 1)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1040 | || qt_isect_curve_horizontal(second_half, y, x1, x2, depth + 1)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1041 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1042 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1043 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1044 | } | - | ||||||||||||||||||||||||||||||||||||
| 1045 | - | |||||||||||||||||||||||||||||||||||||
| 1046 | static bool qt_isect_curve_vertical(const QBezier &bezier, qreal x, qreal y1, qreal y2, int depth = 0) | - | ||||||||||||||||||||||||||||||||||||
| 1047 | { | - | ||||||||||||||||||||||||||||||||||||
| 1048 | QRectF bounds = bezier.bounds(); | - | ||||||||||||||||||||||||||||||||||||
| 1049 | - | |||||||||||||||||||||||||||||||||||||
| 1050 | if (x >= bounds.left()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1051 | && bounds.bottom() >= y1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1052 | const qreal lower_bound = qreal(.01); | - | ||||||||||||||||||||||||||||||||||||
| 1053 | if (depth == 32
| 0 | ||||||||||||||||||||||||||||||||||||
| 1054 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1055 | - | |||||||||||||||||||||||||||||||||||||
| 1056 | QBezier first_half, second_half; | - | ||||||||||||||||||||||||||||||||||||
| 1057 | bezier.split(&first_half, &second_half); | - | ||||||||||||||||||||||||||||||||||||
| 1058 | if (qt_isect_curve_vertical(first_half, x, y1, y2, depth + 1)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1059 | || qt_isect_curve_vertical(second_half, x, y1, y2, depth + 1)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1060 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1061 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1062 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1063 | } | - | ||||||||||||||||||||||||||||||||||||
| 1064 | - | |||||||||||||||||||||||||||||||||||||
| 1065 | - | |||||||||||||||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||||||||||||||
| 1067 | - | |||||||||||||||||||||||||||||||||||||
| 1068 | static bool qt_painterpath_check_crossing(const QPainterPath *path, const QRectF &rect) | - | ||||||||||||||||||||||||||||||||||||
| 1069 | { | - | ||||||||||||||||||||||||||||||||||||
| 1070 | QPointF last_pt; | - | ||||||||||||||||||||||||||||||||||||
| 1071 | QPointF last_start; | - | ||||||||||||||||||||||||||||||||||||
| 1072 | for (int i=0; i<path->elementCount()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1073 | const QPainterPath::Element &e = path->elementAt(i); | - | ||||||||||||||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||||||||||||||
| 1075 | switch (e.type) { | - | ||||||||||||||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||||||||||||||
| 1077 | case never executed: QPainterPath::MoveToElement:case QPainterPath::MoveToElement:never executed: case QPainterPath::MoveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1078 | if (i > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1079 | && qFuzzyCompare(last_pt.x(), last_start.x())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1080 | && qFuzzyCompare(last_pt.y(), last_start.y())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1081 | && qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(),
| 0 | ||||||||||||||||||||||||||||||||||||
| 1082 | last_start.x(), last_start.y(), rect)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1083 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1084 | last_start = last_pt = e; | - | ||||||||||||||||||||||||||||||||||||
| 1085 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1086 | - | |||||||||||||||||||||||||||||||||||||
| 1087 | case never executed: QPainterPath::LineToElement:case QPainterPath::LineToElement:never executed: case QPainterPath::LineToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1088 | if (qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(), e.x, e.y, rect)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1089 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1090 | last_pt = e; | - | ||||||||||||||||||||||||||||||||||||
| 1091 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1092 | - | |||||||||||||||||||||||||||||||||||||
| 1093 | case never executed: QPainterPath::CurveToElement:case QPainterPath::CurveToElement:never executed: case QPainterPath::CurveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1094 | { | - | ||||||||||||||||||||||||||||||||||||
| 1095 | QPointF cp2 = path->elementAt(++i); | - | ||||||||||||||||||||||||||||||||||||
| 1096 | QPointF ep = path->elementAt(++i); | - | ||||||||||||||||||||||||||||||||||||
| 1097 | QBezier bezier = QBezier::fromPoints(last_pt, e, cp2, ep); | - | ||||||||||||||||||||||||||||||||||||
| 1098 | if (qt_isect_curve_horizontal(bezier, rect.top(), rect.left(), rect.right())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1099 | || qt_isect_curve_horizontal(bezier, rect.bottom(), rect.left(), rect.right())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1100 | || qt_isect_curve_vertical(bezier, rect.left(), rect.top(), rect.bottom())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1101 | || qt_isect_curve_vertical(bezier, rect.right(), rect.top(), rect.bottom())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1102 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1103 | last_pt = ep; | - | ||||||||||||||||||||||||||||||||||||
| 1104 | } | - | ||||||||||||||||||||||||||||||||||||
| 1105 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||||||||||||||
| 1107 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1108 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1109 | } | - | ||||||||||||||||||||||||||||||||||||
| 1110 | } | - | ||||||||||||||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||||||||||||||
| 1112 | - | |||||||||||||||||||||||||||||||||||||
| 1113 | if (last_pt != last_start
| 0 | ||||||||||||||||||||||||||||||||||||
| 1114 | && qt_painterpath_isect_line_rect(last_pt.x(), last_pt.y(),
| 0 | ||||||||||||||||||||||||||||||||||||
| 1115 | last_start.x(), last_start.y(), rect)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1116 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1117 | - | |||||||||||||||||||||||||||||||||||||
| 1118 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1119 | } | - | ||||||||||||||||||||||||||||||||||||
| 1120 | bool QPainterPath::intersects(const QRectF &rect) const | - | ||||||||||||||||||||||||||||||||||||
| 1121 | { | - | ||||||||||||||||||||||||||||||||||||
| 1122 | if (elementCount() == 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1123 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1124 | - | |||||||||||||||||||||||||||||||||||||
| 1125 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1126 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||||||||||||||
| 1128 | QRectF cp = controlPointRect(); | - | ||||||||||||||||||||||||||||||||||||
| 1129 | QRectF rn = rect.normalized(); | - | ||||||||||||||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||||||||||||||
| 1131 | - | |||||||||||||||||||||||||||||||||||||
| 1132 | - | |||||||||||||||||||||||||||||||||||||
| 1133 | - | |||||||||||||||||||||||||||||||||||||
| 1134 | if (qMax(rn.left(), cp.left()) > qMin(rn.right(), cp.right())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1135 | || qMax(rn.top(), cp.top()) > qMin(rn.bottom(), cp.bottom())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1136 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1137 | - | |||||||||||||||||||||||||||||||||||||
| 1138 | - | |||||||||||||||||||||||||||||||||||||
| 1139 | if (qt_painterpath_check_crossing(this, rect)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1140 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1141 | - | |||||||||||||||||||||||||||||||||||||
| 1142 | if (contains(rect.center())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1143 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1144 | - | |||||||||||||||||||||||||||||||||||||
| 1145 | QPainterPathPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1146 | - | |||||||||||||||||||||||||||||||||||||
| 1147 | - | |||||||||||||||||||||||||||||||||||||
| 1148 | for (int i=0; i<d->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1149 | const Element &e = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 1150 | if (e.type == QPainterPath::MoveToElement
| 0 | ||||||||||||||||||||||||||||||||||||
| 1151 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1152 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1153 | - | |||||||||||||||||||||||||||||||||||||
| 1154 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1155 | } | - | ||||||||||||||||||||||||||||||||||||
| 1156 | - | |||||||||||||||||||||||||||||||||||||
| 1157 | - | |||||||||||||||||||||||||||||||||||||
| 1158 | - | |||||||||||||||||||||||||||||||||||||
| 1159 | - | |||||||||||||||||||||||||||||||||||||
| 1160 | - | |||||||||||||||||||||||||||||||||||||
| 1161 | - | |||||||||||||||||||||||||||||||||||||
| 1162 | - | |||||||||||||||||||||||||||||||||||||
| 1163 | void QPainterPath::translate(qreal dx, qreal dy) | - | ||||||||||||||||||||||||||||||||||||
| 1164 | { | - | ||||||||||||||||||||||||||||||||||||
| 1165 | if (!d_ptr
| 0 | ||||||||||||||||||||||||||||||||||||
| 1166 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||||||||||||||
| 1168 | int elementsLeft = d_ptr->elements.size(); | - | ||||||||||||||||||||||||||||||||||||
| 1169 | if (elementsLeft <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1170 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1171 | - | |||||||||||||||||||||||||||||||||||||
| 1172 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 1173 | QPainterPath::Element *element = d_func()->elements.data(); | - | ||||||||||||||||||||||||||||||||||||
| 1174 | ((!(element)) ? qt_assert("element",__FILE__,2101) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 1175 | while (elementsLeft--
| 0 | ||||||||||||||||||||||||||||||||||||
| 1176 | element->x += dx; | - | ||||||||||||||||||||||||||||||||||||
| 1177 | element->y += dy; | - | ||||||||||||||||||||||||||||||||||||
| 1178 | ++element; | - | ||||||||||||||||||||||||||||||||||||
| 1179 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1180 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1181 | QPainterPath QPainterPath::translated(qreal dx, qreal dy) const | - | ||||||||||||||||||||||||||||||||||||
| 1182 | { | - | ||||||||||||||||||||||||||||||||||||
| 1183 | QPainterPath copy(*this); | - | ||||||||||||||||||||||||||||||||||||
| 1184 | copy.translate(dx, dy); | - | ||||||||||||||||||||||||||||||||||||
| 1185 | return never executed: copy;return copy;never executed: return copy; | 0 | ||||||||||||||||||||||||||||||||||||
| 1186 | } | - | ||||||||||||||||||||||||||||||||||||
| 1187 | bool QPainterPath::contains(const QRectF &rect) const | - | ||||||||||||||||||||||||||||||||||||
| 1188 | { | - | ||||||||||||||||||||||||||||||||||||
| 1189 | QPainterPathPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1190 | - | |||||||||||||||||||||||||||||||||||||
| 1191 | - | |||||||||||||||||||||||||||||||||||||
| 1192 | - | |||||||||||||||||||||||||||||||||||||
| 1193 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1194 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1195 | - | |||||||||||||||||||||||||||||||||||||
| 1196 | - | |||||||||||||||||||||||||||||||||||||
| 1197 | - | |||||||||||||||||||||||||||||||||||||
| 1198 | - | |||||||||||||||||||||||||||||||||||||
| 1199 | if (qt_painterpath_check_crossing(this, rect)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1200 | if (fillRule() == Qt::OddEvenFill
| 0 | ||||||||||||||||||||||||||||||||||||
| 1201 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1202 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||||||||||||||
| 1204 | - | |||||||||||||||||||||||||||||||||||||
| 1205 | if (!contains(rect.topLeft())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1206 | !contains(rect.topRight())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1207 | !contains(rect.bottomRight())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1208 | !contains(rect.bottomLeft())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1209 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1210 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1211 | } | - | ||||||||||||||||||||||||||||||||||||
| 1212 | - | |||||||||||||||||||||||||||||||||||||
| 1213 | - | |||||||||||||||||||||||||||||||||||||
| 1214 | - | |||||||||||||||||||||||||||||||||||||
| 1215 | - | |||||||||||||||||||||||||||||||||||||
| 1216 | - | |||||||||||||||||||||||||||||||||||||
| 1217 | if (!contains(rect.center())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1218 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1219 | - | |||||||||||||||||||||||||||||||||||||
| 1220 | - | |||||||||||||||||||||||||||||||||||||
| 1221 | - | |||||||||||||||||||||||||||||||||||||
| 1222 | - | |||||||||||||||||||||||||||||||||||||
| 1223 | - | |||||||||||||||||||||||||||||||||||||
| 1224 | - | |||||||||||||||||||||||||||||||||||||
| 1225 | - | |||||||||||||||||||||||||||||||||||||
| 1226 | for (int i=0; i<d->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1227 | const Element &e = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 1228 | if (e.type == QPainterPath::MoveToElement
| 0 | ||||||||||||||||||||||||||||||||||||
| 1229 | if (fillRule() == Qt::OddEvenFill
| 0 | ||||||||||||||||||||||||||||||||||||
| 1230 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1231 | - | |||||||||||||||||||||||||||||||||||||
| 1232 | bool stop = false; | - | ||||||||||||||||||||||||||||||||||||
| 1233 | for (; !stop
| 0 | ||||||||||||||||||||||||||||||||||||
| 1234 | const Element &el = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 1235 | switch (el.type) { | - | ||||||||||||||||||||||||||||||||||||
| 1236 | case never executed: MoveToElement:case MoveToElement:never executed: case MoveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1237 | stop = true; | - | ||||||||||||||||||||||||||||||||||||
| 1238 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1239 | case never executed: LineToElement:case LineToElement:never executed: case LineToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1240 | if (!contains(el)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1241 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1242 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1243 | case never executed: CurveToElement:case CurveToElement:never executed: case CurveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1244 | if (!contains(d->elements.at(i+2))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1245 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1246 | i += 2; | - | ||||||||||||||||||||||||||||||||||||
| 1247 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1248 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1249 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1250 | } | - | ||||||||||||||||||||||||||||||||||||
| 1251 | } | - | ||||||||||||||||||||||||||||||||||||
| 1252 | - | |||||||||||||||||||||||||||||||||||||
| 1253 | - | |||||||||||||||||||||||||||||||||||||
| 1254 | --i; | - | ||||||||||||||||||||||||||||||||||||
| 1255 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1256 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||||||||||||||
| 1258 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1259 | } | - | ||||||||||||||||||||||||||||||||||||
| 1260 | - | |||||||||||||||||||||||||||||||||||||
| 1261 | static inline bool epsilonCompare(const QPointF &a, const QPointF &b, const QSizeF &epsilon) | - | ||||||||||||||||||||||||||||||||||||
| 1262 | { | - | ||||||||||||||||||||||||||||||||||||
| 1263 | return never executed: qAbs(a.x() - b.x()) <= epsilon.width()return qAbs(a.x() - b.x()) <= epsilon.width() && qAbs(a.y() - b.y()) <= epsilon.height();
never executed: return qAbs(a.x() - b.x()) <= epsilon.width() && qAbs(a.y() - b.y()) <= epsilon.height(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1264 | && qAbs(a.y() - b.y()) <= epsilon.height()
never executed: return qAbs(a.x() - b.x()) <= epsilon.width() && qAbs(a.y() - b.y()) <= epsilon.height(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1265 | } | - | ||||||||||||||||||||||||||||||||||||
| 1266 | bool QPainterPath::operator==(const QPainterPath &path) const | - | ||||||||||||||||||||||||||||||||||||
| 1267 | { | - | ||||||||||||||||||||||||||||||||||||
| 1268 | QPainterPathData *d = reinterpret_cast<QPainterPathData *>(d_func()); | - | ||||||||||||||||||||||||||||||||||||
| 1269 | if (path.d_func() == d
| 0 | ||||||||||||||||||||||||||||||||||||
| 1270 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1271 | else if (!d
| 0 | ||||||||||||||||||||||||||||||||||||
| 1272 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1273 | else if (d->fillRule != path.d_func()->fillRule
| 0 | ||||||||||||||||||||||||||||||||||||
| 1274 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1275 | else if (d->elements.size() != path.d_func()->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1276 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1277 | - | |||||||||||||||||||||||||||||||||||||
| 1278 | const qreal qt_epsilon = sizeof(qreal) == sizeof(double)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1279 | - | |||||||||||||||||||||||||||||||||||||
| 1280 | QSizeF epsilon = boundingRect().size(); | - | ||||||||||||||||||||||||||||||||||||
| 1281 | epsilon.rwidth() *= qt_epsilon; | - | ||||||||||||||||||||||||||||||||||||
| 1282 | epsilon.rheight() *= qt_epsilon; | - | ||||||||||||||||||||||||||||||||||||
| 1283 | - | |||||||||||||||||||||||||||||||||||||
| 1284 | for (int i = 0; i < d->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1285 | if (d->elements.at(i).type != path.d_func()->elements.at(i).type
| 0 | ||||||||||||||||||||||||||||||||||||
| 1286 | || !epsilonCompare(d->elements.at(i), path.d_func()->elements.at(i), epsilon)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1287 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1288 | - | |||||||||||||||||||||||||||||||||||||
| 1289 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1290 | } | - | ||||||||||||||||||||||||||||||||||||
| 1291 | bool QPainterPath::operator!=(const QPainterPath &path) const | - | ||||||||||||||||||||||||||||||||||||
| 1292 | { | - | ||||||||||||||||||||||||||||||||||||
| 1293 | return never executed: !(*this==path);return !(*this==path);never executed: return !(*this==path); | 0 | ||||||||||||||||||||||||||||||||||||
| 1294 | } | - | ||||||||||||||||||||||||||||||||||||
| 1295 | QPainterPath QPainterPath::operator&(const QPainterPath &other) const | - | ||||||||||||||||||||||||||||||||||||
| 1296 | { | - | ||||||||||||||||||||||||||||||||||||
| 1297 | return never executed: intersected(other);return intersected(other);never executed: return intersected(other); | 0 | ||||||||||||||||||||||||||||||||||||
| 1298 | } | - | ||||||||||||||||||||||||||||||||||||
| 1299 | QPainterPath QPainterPath::operator|(const QPainterPath &other) const | - | ||||||||||||||||||||||||||||||||||||
| 1300 | { | - | ||||||||||||||||||||||||||||||||||||
| 1301 | return never executed: united(other);return united(other);never executed: return united(other); | 0 | ||||||||||||||||||||||||||||||||||||
| 1302 | } | - | ||||||||||||||||||||||||||||||||||||
| 1303 | QPainterPath QPainterPath::operator+(const QPainterPath &other) const | - | ||||||||||||||||||||||||||||||||||||
| 1304 | { | - | ||||||||||||||||||||||||||||||||||||
| 1305 | return never executed: united(other);return united(other);never executed: return united(other); | 0 | ||||||||||||||||||||||||||||||||||||
| 1306 | } | - | ||||||||||||||||||||||||||||||||||||
| 1307 | QPainterPath QPainterPath::operator-(const QPainterPath &other) const | - | ||||||||||||||||||||||||||||||||||||
| 1308 | { | - | ||||||||||||||||||||||||||||||||||||
| 1309 | return never executed: subtracted(other);return subtracted(other);never executed: return subtracted(other); | 0 | ||||||||||||||||||||||||||||||||||||
| 1310 | } | - | ||||||||||||||||||||||||||||||||||||
| 1311 | QPainterPath &QPainterPath::operator&=(const QPainterPath &other) | - | ||||||||||||||||||||||||||||||||||||
| 1312 | { | - | ||||||||||||||||||||||||||||||||||||
| 1313 | return never executed: *this = (*this & other);return *this = (*this & other);never executed: return *this = (*this & other); | 0 | ||||||||||||||||||||||||||||||||||||
| 1314 | } | - | ||||||||||||||||||||||||||||||||||||
| 1315 | QPainterPath &QPainterPath::operator|=(const QPainterPath &other) | - | ||||||||||||||||||||||||||||||||||||
| 1316 | { | - | ||||||||||||||||||||||||||||||||||||
| 1317 | return never executed: *this = (*this | other);return *this = (*this | other);never executed: return *this = (*this | other); | 0 | ||||||||||||||||||||||||||||||||||||
| 1318 | } | - | ||||||||||||||||||||||||||||||||||||
| 1319 | QPainterPath &QPainterPath::operator+=(const QPainterPath &other) | - | ||||||||||||||||||||||||||||||||||||
| 1320 | { | - | ||||||||||||||||||||||||||||||||||||
| 1321 | return never executed: *this = (*this + other);return *this = (*this + other);never executed: return *this = (*this + other); | 0 | ||||||||||||||||||||||||||||||||||||
| 1322 | } | - | ||||||||||||||||||||||||||||||||||||
| 1323 | QPainterPath &QPainterPath::operator-=(const QPainterPath &other) | - | ||||||||||||||||||||||||||||||||||||
| 1324 | { | - | ||||||||||||||||||||||||||||||||||||
| 1325 | return never executed: *this = (*this - other);return *this = (*this - other);never executed: return *this = (*this - other); | 0 | ||||||||||||||||||||||||||||||||||||
| 1326 | } | - | ||||||||||||||||||||||||||||||||||||
| 1327 | QDataStream &operator<<(QDataStream &s, const QPainterPath &p) | - | ||||||||||||||||||||||||||||||||||||
| 1328 | { | - | ||||||||||||||||||||||||||||||||||||
| 1329 | if (p.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1330 | s << 0; | - | ||||||||||||||||||||||||||||||||||||
| 1331 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||||||||||||||
| 1332 | } | - | ||||||||||||||||||||||||||||||||||||
| 1333 | - | |||||||||||||||||||||||||||||||||||||
| 1334 | s << p.elementCount(); | - | ||||||||||||||||||||||||||||||||||||
| 1335 | for (int i=0; i < p.d_func()->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1336 | const QPainterPath::Element &e = p.d_func()->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 1337 | s << int(e.type); | - | ||||||||||||||||||||||||||||||||||||
| 1338 | s << double(e.x) << double(e.y); | - | ||||||||||||||||||||||||||||||||||||
| 1339 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1340 | s << p.d_func()->cStart; | - | ||||||||||||||||||||||||||||||||||||
| 1341 | s << int(p.d_func()->fillRule); | - | ||||||||||||||||||||||||||||||||||||
| 1342 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||||||||||||||
| 1343 | } | - | ||||||||||||||||||||||||||||||||||||
| 1344 | QDataStream &operator>>(QDataStream &s, QPainterPath &p) | - | ||||||||||||||||||||||||||||||||||||
| 1345 | { | - | ||||||||||||||||||||||||||||||||||||
| 1346 | int size; | - | ||||||||||||||||||||||||||||||||||||
| 1347 | s >> size; | - | ||||||||||||||||||||||||||||||||||||
| 1348 | - | |||||||||||||||||||||||||||||||||||||
| 1349 | if (size == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1350 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||||||||||||||
| 1351 | - | |||||||||||||||||||||||||||||||||||||
| 1352 | p.ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 1353 | if (p.d_func()->elements.size() == 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1354 | ((!(p.d_func()->elements.at(0).type == QPainterPath::MoveToElement)) ? qt_assert("p.d_func()->elements.at(0).type == QPainterPath::MoveToElement",__FILE__,2423) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 1355 | p.d_func()->elements.clear(); | - | ||||||||||||||||||||||||||||||||||||
| 1356 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1357 | p.d_func()->elements.reserve(p.d_func()->elements.size() + size); | - | ||||||||||||||||||||||||||||||||||||
| 1358 | for (int i=0; i<size
| 0 | ||||||||||||||||||||||||||||||||||||
| 1359 | int type; | - | ||||||||||||||||||||||||||||||||||||
| 1360 | double x, y; | - | ||||||||||||||||||||||||||||||||||||
| 1361 | s >> type; | - | ||||||||||||||||||||||||||||||||||||
| 1362 | s >> x; | - | ||||||||||||||||||||||||||||||||||||
| 1363 | s >> y; | - | ||||||||||||||||||||||||||||||||||||
| 1364 | ((!(type >= 0 && type <= 3)) ? qt_assert("type >= 0 && type <= 3",__FILE__,2433) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 1365 | if (!qt_is_finite(x)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1366 | - | |||||||||||||||||||||||||||||||||||||
| 1367 | QMessageLogger(__FILE__, 2436, __PRETTY_FUNCTION__).warning("QDataStream::operator>>: NaN or Inf element found in path, skipping it"); | - | ||||||||||||||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||||||||||||||
| 1369 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||
| 1370 | } | - | ||||||||||||||||||||||||||||||||||||
| 1371 | QPainterPath::Element elm = { qreal(x), qreal(y), QPainterPath::ElementType(type) }; | - | ||||||||||||||||||||||||||||||||||||
| 1372 | p.d_func()->elements.append(elm); | - | ||||||||||||||||||||||||||||||||||||
| 1373 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1374 | s >> p.d_func()->cStart; | - | ||||||||||||||||||||||||||||||||||||
| 1375 | int fillRule; | - | ||||||||||||||||||||||||||||||||||||
| 1376 | s >> fillRule; | - | ||||||||||||||||||||||||||||||||||||
| 1377 | ((!(fillRule == Qt::OddEvenFill || Qt::WindingFill)) ? qt_assert("fillRule == Qt::OddEvenFill || Qt::WindingFill",__FILE__,2446) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 1378 | p.d_func()->fillRule = Qt::FillRule(fillRule); | - | ||||||||||||||||||||||||||||||||||||
| 1379 | p.d_func()->dirtyBounds = true; | - | ||||||||||||||||||||||||||||||||||||
| 1380 | p.d_func()->dirtyControlBounds = true; | - | ||||||||||||||||||||||||||||||||||||
| 1381 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||||||||||||||
| 1382 | } | - | ||||||||||||||||||||||||||||||||||||
| 1383 | - | |||||||||||||||||||||||||||||||||||||
| 1384 | - | |||||||||||||||||||||||||||||||||||||
| 1385 | - | |||||||||||||||||||||||||||||||||||||
| 1386 | - | |||||||||||||||||||||||||||||||||||||
| 1387 | - | |||||||||||||||||||||||||||||||||||||
| 1388 | - | |||||||||||||||||||||||||||||||||||||
| 1389 | - | |||||||||||||||||||||||||||||||||||||
| 1390 | void qt_path_stroke_move_to(qfixed x, qfixed y, void *data) | - | ||||||||||||||||||||||||||||||||||||
| 1391 | { | - | ||||||||||||||||||||||||||||||||||||
| 1392 | ((QPainterPath *) data)->moveTo(x, y); | - | ||||||||||||||||||||||||||||||||||||
| 1393 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1394 | - | |||||||||||||||||||||||||||||||||||||
| 1395 | void qt_path_stroke_line_to(qfixed x, qfixed y, void *data) | - | ||||||||||||||||||||||||||||||||||||
| 1396 | { | - | ||||||||||||||||||||||||||||||||||||
| 1397 | ((QPainterPath *) data)->lineTo(x, y); | - | ||||||||||||||||||||||||||||||||||||
| 1398 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1399 | - | |||||||||||||||||||||||||||||||||||||
| 1400 | void qt_path_stroke_cubic_to(qfixed c1x, qfixed c1y, | - | ||||||||||||||||||||||||||||||||||||
| 1401 | qfixed c2x, qfixed c2y, | - | ||||||||||||||||||||||||||||||||||||
| 1402 | qfixed ex, qfixed ey, | - | ||||||||||||||||||||||||||||||||||||
| 1403 | void *data) | - | ||||||||||||||||||||||||||||||||||||
| 1404 | { | - | ||||||||||||||||||||||||||||||||||||
| 1405 | ((QPainterPath *) data)->cubicTo(c1x, c1y, | - | ||||||||||||||||||||||||||||||||||||
| 1406 | c2x, c2y, | - | ||||||||||||||||||||||||||||||||||||
| 1407 | ex, ey); | - | ||||||||||||||||||||||||||||||||||||
| 1408 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1409 | QPainterPathStrokerPrivate::QPainterPathStrokerPrivate() | - | ||||||||||||||||||||||||||||||||||||
| 1410 | : dashOffset(0) | - | ||||||||||||||||||||||||||||||||||||
| 1411 | { | - | ||||||||||||||||||||||||||||||||||||
| 1412 | stroker.setMoveToHook(qt_path_stroke_move_to); | - | ||||||||||||||||||||||||||||||||||||
| 1413 | stroker.setLineToHook(qt_path_stroke_line_to); | - | ||||||||||||||||||||||||||||||||||||
| 1414 | stroker.setCubicToHook(qt_path_stroke_cubic_to); | - | ||||||||||||||||||||||||||||||||||||
| 1415 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1416 | - | |||||||||||||||||||||||||||||||||||||
| 1417 | - | |||||||||||||||||||||||||||||||||||||
| 1418 | - | |||||||||||||||||||||||||||||||||||||
| 1419 | - | |||||||||||||||||||||||||||||||||||||
| 1420 | QPainterPathStroker::QPainterPathStroker() | - | ||||||||||||||||||||||||||||||||||||
| 1421 | : d_ptr(new QPainterPathStrokerPrivate) | - | ||||||||||||||||||||||||||||||||||||
| 1422 | { | - | ||||||||||||||||||||||||||||||||||||
| 1423 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1424 | - | |||||||||||||||||||||||||||||||||||||
| 1425 | - | |||||||||||||||||||||||||||||||||||||
| 1426 | - | |||||||||||||||||||||||||||||||||||||
| 1427 | - | |||||||||||||||||||||||||||||||||||||
| 1428 | - | |||||||||||||||||||||||||||||||||||||
| 1429 | - | |||||||||||||||||||||||||||||||||||||
| 1430 | QPainterPathStroker::QPainterPathStroker(const QPen &pen) | - | ||||||||||||||||||||||||||||||||||||
| 1431 | : d_ptr(new QPainterPathStrokerPrivate) | - | ||||||||||||||||||||||||||||||||||||
| 1432 | { | - | ||||||||||||||||||||||||||||||||||||
| 1433 | setWidth(pen.widthF()); | - | ||||||||||||||||||||||||||||||||||||
| 1434 | setCapStyle(pen.capStyle()); | - | ||||||||||||||||||||||||||||||||||||
| 1435 | setJoinStyle(pen.joinStyle()); | - | ||||||||||||||||||||||||||||||||||||
| 1436 | setMiterLimit(pen.miterLimit()); | - | ||||||||||||||||||||||||||||||||||||
| 1437 | setDashOffset(pen.dashOffset()); | - | ||||||||||||||||||||||||||||||||||||
| 1438 | - | |||||||||||||||||||||||||||||||||||||
| 1439 | if (pen.style() == Qt::CustomDashLine
| 0 | ||||||||||||||||||||||||||||||||||||
| 1440 | setDashPattern(pen.dashPattern()); never executed: setDashPattern(pen.dashPattern()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1441 | else | - | ||||||||||||||||||||||||||||||||||||
| 1442 | setDashPattern(pen.style()); never executed: setDashPattern(pen.style()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1443 | } | - | ||||||||||||||||||||||||||||||||||||
| 1444 | - | |||||||||||||||||||||||||||||||||||||
| 1445 | - | |||||||||||||||||||||||||||||||||||||
| 1446 | - | |||||||||||||||||||||||||||||||||||||
| 1447 | - | |||||||||||||||||||||||||||||||||||||
| 1448 | QPainterPathStroker::~QPainterPathStroker() | - | ||||||||||||||||||||||||||||||||||||
| 1449 | { | - | ||||||||||||||||||||||||||||||||||||
| 1450 | } | - | ||||||||||||||||||||||||||||||||||||
| 1451 | QPainterPath QPainterPathStroker::createStroke(const QPainterPath &path) const | - | ||||||||||||||||||||||||||||||||||||
| 1452 | { | - | ||||||||||||||||||||||||||||||||||||
| 1453 | QPainterPathStrokerPrivate *d = const_cast<QPainterPathStrokerPrivate *>(d_func()); | - | ||||||||||||||||||||||||||||||||||||
| 1454 | QPainterPath stroke; | - | ||||||||||||||||||||||||||||||||||||
| 1455 | if (path.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1456 | return never executed: path;return path;never executed: return path; | 0 | ||||||||||||||||||||||||||||||||||||
| 1457 | if (d->dashPattern.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1458 | d->stroker.strokePath(path, &stroke, QTransform()); | - | ||||||||||||||||||||||||||||||||||||
| 1459 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1460 | QDashStroker dashStroker(&d->stroker); | - | ||||||||||||||||||||||||||||||||||||
| 1461 | dashStroker.setDashPattern(d->dashPattern); | - | ||||||||||||||||||||||||||||||||||||
| 1462 | dashStroker.setDashOffset(d->dashOffset); | - | ||||||||||||||||||||||||||||||||||||
| 1463 | dashStroker.setClipRect(d->stroker.clipRect()); | - | ||||||||||||||||||||||||||||||||||||
| 1464 | dashStroker.strokePath(path, &stroke, QTransform()); | - | ||||||||||||||||||||||||||||||||||||
| 1465 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1466 | stroke.setFillRule(Qt::WindingFill); | - | ||||||||||||||||||||||||||||||||||||
| 1467 | return never executed: stroke;return stroke;never executed: return stroke; | 0 | ||||||||||||||||||||||||||||||||||||
| 1468 | } | - | ||||||||||||||||||||||||||||||||||||
| 1469 | - | |||||||||||||||||||||||||||||||||||||
| 1470 | - | |||||||||||||||||||||||||||||||||||||
| 1471 | - | |||||||||||||||||||||||||||||||||||||
| 1472 | - | |||||||||||||||||||||||||||||||||||||
| 1473 | - | |||||||||||||||||||||||||||||||||||||
| 1474 | - | |||||||||||||||||||||||||||||||||||||
| 1475 | - | |||||||||||||||||||||||||||||||||||||
| 1476 | void QPainterPathStroker::setWidth(qreal width) | - | ||||||||||||||||||||||||||||||||||||
| 1477 | { | - | ||||||||||||||||||||||||||||||||||||
| 1478 | QPainterPathStrokerPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1479 | if (width <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1480 | width = 1; never executed: width = 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1481 | d->stroker.setStrokeWidth(qfixed(width)); | - | ||||||||||||||||||||||||||||||||||||
| 1482 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1483 | - | |||||||||||||||||||||||||||||||||||||
| 1484 | - | |||||||||||||||||||||||||||||||||||||
| 1485 | - | |||||||||||||||||||||||||||||||||||||
| 1486 | - | |||||||||||||||||||||||||||||||||||||
| 1487 | qreal QPainterPathStroker::width() const | - | ||||||||||||||||||||||||||||||||||||
| 1488 | { | - | ||||||||||||||||||||||||||||||||||||
| 1489 | return never executed: d_func()->stroker.strokeWidth();return d_func()->stroker.strokeWidth();never executed: return d_func()->stroker.strokeWidth(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1490 | } | - | ||||||||||||||||||||||||||||||||||||
| 1491 | - | |||||||||||||||||||||||||||||||||||||
| 1492 | - | |||||||||||||||||||||||||||||||||||||
| 1493 | - | |||||||||||||||||||||||||||||||||||||
| 1494 | - | |||||||||||||||||||||||||||||||||||||
| 1495 | - | |||||||||||||||||||||||||||||||||||||
| 1496 | - | |||||||||||||||||||||||||||||||||||||
| 1497 | - | |||||||||||||||||||||||||||||||||||||
| 1498 | void QPainterPathStroker::setCapStyle(Qt::PenCapStyle style) | - | ||||||||||||||||||||||||||||||||||||
| 1499 | { | - | ||||||||||||||||||||||||||||||||||||
| 1500 | d_func()->stroker.setCapStyle(style); | - | ||||||||||||||||||||||||||||||||||||
| 1501 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1502 | - | |||||||||||||||||||||||||||||||||||||
| 1503 | - | |||||||||||||||||||||||||||||||||||||
| 1504 | - | |||||||||||||||||||||||||||||||||||||
| 1505 | - | |||||||||||||||||||||||||||||||||||||
| 1506 | - | |||||||||||||||||||||||||||||||||||||
| 1507 | Qt::PenCapStyle QPainterPathStroker::capStyle() const | - | ||||||||||||||||||||||||||||||||||||
| 1508 | { | - | ||||||||||||||||||||||||||||||||||||
| 1509 | return never executed: d_func()->stroker.capStyle();return d_func()->stroker.capStyle();never executed: return d_func()->stroker.capStyle(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1510 | } | - | ||||||||||||||||||||||||||||||||||||
| 1511 | - | |||||||||||||||||||||||||||||||||||||
| 1512 | - | |||||||||||||||||||||||||||||||||||||
| 1513 | - | |||||||||||||||||||||||||||||||||||||
| 1514 | - | |||||||||||||||||||||||||||||||||||||
| 1515 | void QPainterPathStroker::setJoinStyle(Qt::PenJoinStyle style) | - | ||||||||||||||||||||||||||||||||||||
| 1516 | { | - | ||||||||||||||||||||||||||||||||||||
| 1517 | d_func()->stroker.setJoinStyle(style); | - | ||||||||||||||||||||||||||||||||||||
| 1518 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1519 | - | |||||||||||||||||||||||||||||||||||||
| 1520 | - | |||||||||||||||||||||||||||||||||||||
| 1521 | - | |||||||||||||||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||||||||||||||
| 1523 | Qt::PenJoinStyle QPainterPathStroker::joinStyle() const | - | ||||||||||||||||||||||||||||||||||||
| 1524 | { | - | ||||||||||||||||||||||||||||||||||||
| 1525 | return never executed: d_func()->stroker.joinStyle();return d_func()->stroker.joinStyle();never executed: return d_func()->stroker.joinStyle(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1526 | } | - | ||||||||||||||||||||||||||||||||||||
| 1527 | void QPainterPathStroker::setMiterLimit(qreal limit) | - | ||||||||||||||||||||||||||||||||||||
| 1528 | { | - | ||||||||||||||||||||||||||||||||||||
| 1529 | d_func()->stroker.setMiterLimit(qfixed(limit)); | - | ||||||||||||||||||||||||||||||||||||
| 1530 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1531 | - | |||||||||||||||||||||||||||||||||||||
| 1532 | - | |||||||||||||||||||||||||||||||||||||
| 1533 | - | |||||||||||||||||||||||||||||||||||||
| 1534 | - | |||||||||||||||||||||||||||||||||||||
| 1535 | qreal QPainterPathStroker::miterLimit() const | - | ||||||||||||||||||||||||||||||||||||
| 1536 | { | - | ||||||||||||||||||||||||||||||||||||
| 1537 | return never executed: d_func()->stroker.miterLimit();return d_func()->stroker.miterLimit();never executed: return d_func()->stroker.miterLimit(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1538 | } | - | ||||||||||||||||||||||||||||||||||||
| 1539 | void QPainterPathStroker::setCurveThreshold(qreal threshold) | - | ||||||||||||||||||||||||||||||||||||
| 1540 | { | - | ||||||||||||||||||||||||||||||||||||
| 1541 | d_func()->stroker.setCurveThreshold(qfixed(threshold)); | - | ||||||||||||||||||||||||||||||||||||
| 1542 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1543 | - | |||||||||||||||||||||||||||||||||||||
| 1544 | - | |||||||||||||||||||||||||||||||||||||
| 1545 | - | |||||||||||||||||||||||||||||||||||||
| 1546 | - | |||||||||||||||||||||||||||||||||||||
| 1547 | - | |||||||||||||||||||||||||||||||||||||
| 1548 | qreal QPainterPathStroker::curveThreshold() const | - | ||||||||||||||||||||||||||||||||||||
| 1549 | { | - | ||||||||||||||||||||||||||||||||||||
| 1550 | return never executed: d_func()->stroker.curveThreshold();return d_func()->stroker.curveThreshold();never executed: return d_func()->stroker.curveThreshold(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1551 | } | - | ||||||||||||||||||||||||||||||||||||
| 1552 | - | |||||||||||||||||||||||||||||||||||||
| 1553 | - | |||||||||||||||||||||||||||||||||||||
| 1554 | - | |||||||||||||||||||||||||||||||||||||
| 1555 | - | |||||||||||||||||||||||||||||||||||||
| 1556 | void QPainterPathStroker::setDashPattern(Qt::PenStyle style) | - | ||||||||||||||||||||||||||||||||||||
| 1557 | { | - | ||||||||||||||||||||||||||||||||||||
| 1558 | d_func()->dashPattern = QDashStroker::patternForStyle(style); | - | ||||||||||||||||||||||||||||||||||||
| 1559 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1560 | void QPainterPathStroker::setDashPattern(const QVector<qreal> &dashPattern) | - | ||||||||||||||||||||||||||||||||||||
| 1561 | { | - | ||||||||||||||||||||||||||||||||||||
| 1562 | d_func()->dashPattern.clear(); | - | ||||||||||||||||||||||||||||||||||||
| 1563 | for (int i=0; i<dashPattern.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1564 | d_func()->dashPattern << qfixed(dashPattern.at(i)); never executed: d_func()->dashPattern << qfixed(dashPattern.at(i)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1565 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1566 | - | |||||||||||||||||||||||||||||||||||||
| 1567 | - | |||||||||||||||||||||||||||||||||||||
| 1568 | - | |||||||||||||||||||||||||||||||||||||
| 1569 | - | |||||||||||||||||||||||||||||||||||||
| 1570 | QVector<qreal> QPainterPathStroker::dashPattern() const | - | ||||||||||||||||||||||||||||||||||||
| 1571 | { | - | ||||||||||||||||||||||||||||||||||||
| 1572 | return never executed: d_func()->dashPattern;return d_func()->dashPattern;never executed: return d_func()->dashPattern; | 0 | ||||||||||||||||||||||||||||||||||||
| 1573 | } | - | ||||||||||||||||||||||||||||||||||||
| 1574 | - | |||||||||||||||||||||||||||||||||||||
| 1575 | - | |||||||||||||||||||||||||||||||||||||
| 1576 | - | |||||||||||||||||||||||||||||||||||||
| 1577 | - | |||||||||||||||||||||||||||||||||||||
| 1578 | qreal QPainterPathStroker::dashOffset() const | - | ||||||||||||||||||||||||||||||||||||
| 1579 | { | - | ||||||||||||||||||||||||||||||||||||
| 1580 | return never executed: d_func()->dashOffset;return d_func()->dashOffset;never executed: return d_func()->dashOffset; | 0 | ||||||||||||||||||||||||||||||||||||
| 1581 | } | - | ||||||||||||||||||||||||||||||||||||
| 1582 | - | |||||||||||||||||||||||||||||||||||||
| 1583 | - | |||||||||||||||||||||||||||||||||||||
| 1584 | - | |||||||||||||||||||||||||||||||||||||
| 1585 | - | |||||||||||||||||||||||||||||||||||||
| 1586 | - | |||||||||||||||||||||||||||||||||||||
| 1587 | - | |||||||||||||||||||||||||||||||||||||
| 1588 | - | |||||||||||||||||||||||||||||||||||||
| 1589 | void QPainterPathStroker::setDashOffset(qreal offset) | - | ||||||||||||||||||||||||||||||||||||
| 1590 | { | - | ||||||||||||||||||||||||||||||||||||
| 1591 | d_func()->dashOffset = offset; | - | ||||||||||||||||||||||||||||||||||||
| 1592 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1593 | QPolygonF QPainterPath::toFillPolygon(const QTransform &matrix) const | - | ||||||||||||||||||||||||||||||||||||
| 1594 | { | - | ||||||||||||||||||||||||||||||||||||
| 1595 | - | |||||||||||||||||||||||||||||||||||||
| 1596 | QList<QPolygonF> flats = toSubpathPolygons(matrix); | - | ||||||||||||||||||||||||||||||||||||
| 1597 | QPolygonF polygon; | - | ||||||||||||||||||||||||||||||||||||
| 1598 | if (flats.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1599 | return never executed: polygon;return polygon;never executed: return polygon; | 0 | ||||||||||||||||||||||||||||||||||||
| 1600 | QPointF first = flats.first().first(); | - | ||||||||||||||||||||||||||||||||||||
| 1601 | for (int i=0; i<flats.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1602 | polygon += flats.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 1603 | if (!flats.at(i).isClosed()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1604 | polygon += flats.at(i).first(); never executed: polygon += flats.at(i).first(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1605 | if (i > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1606 | polygon += first; never executed: polygon += first; | 0 | ||||||||||||||||||||||||||||||||||||
| 1607 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1608 | return never executed: polygon;return polygon;never executed: return polygon; | 0 | ||||||||||||||||||||||||||||||||||||
| 1609 | } | - | ||||||||||||||||||||||||||||||||||||
| 1610 | - | |||||||||||||||||||||||||||||||||||||
| 1611 | - | |||||||||||||||||||||||||||||||||||||
| 1612 | - | |||||||||||||||||||||||||||||||||||||
| 1613 | - | |||||||||||||||||||||||||||||||||||||
| 1614 | QPolygonF QPainterPath::toFillPolygon(const QMatrix &matrix) const | - | ||||||||||||||||||||||||||||||||||||
| 1615 | { | - | ||||||||||||||||||||||||||||||||||||
| 1616 | return never executed: toFillPolygon(QTransform(matrix));return toFillPolygon(QTransform(matrix));never executed: return toFillPolygon(QTransform(matrix)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1617 | } | - | ||||||||||||||||||||||||||||||||||||
| 1618 | - | |||||||||||||||||||||||||||||||||||||
| 1619 | - | |||||||||||||||||||||||||||||||||||||
| 1620 | - | |||||||||||||||||||||||||||||||||||||
| 1621 | static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d) | - | ||||||||||||||||||||||||||||||||||||
| 1622 | { | - | ||||||||||||||||||||||||||||||||||||
| 1623 | return never executed: 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a);return 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a);never executed: return 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a); | 0 | ||||||||||||||||||||||||||||||||||||
| 1624 | } | - | ||||||||||||||||||||||||||||||||||||
| 1625 | - | |||||||||||||||||||||||||||||||||||||
| 1626 | - | |||||||||||||||||||||||||||||||||||||
| 1627 | - | |||||||||||||||||||||||||||||||||||||
| 1628 | - | |||||||||||||||||||||||||||||||||||||
| 1629 | qreal QPainterPath::length() const | - | ||||||||||||||||||||||||||||||||||||
| 1630 | { | - | ||||||||||||||||||||||||||||||||||||
| 1631 | QPainterPathPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1632 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1633 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1634 | - | |||||||||||||||||||||||||||||||||||||
| 1635 | qreal len = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1636 | for (int i=1; i<d->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1637 | const Element &e = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 1638 | - | |||||||||||||||||||||||||||||||||||||
| 1639 | switch (e.type) { | - | ||||||||||||||||||||||||||||||||||||
| 1640 | case never executed: MoveToElement:case MoveToElement:never executed: case MoveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1641 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1642 | case never executed: LineToElement:case LineToElement:never executed: case LineToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1643 | { | - | ||||||||||||||||||||||||||||||||||||
| 1644 | len += QLineF(d->elements.at(i-1), e).length(); | - | ||||||||||||||||||||||||||||||||||||
| 1645 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1646 | } | - | ||||||||||||||||||||||||||||||||||||
| 1647 | case never executed: CurveToElement:case CurveToElement:never executed: case CurveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1648 | { | - | ||||||||||||||||||||||||||||||||||||
| 1649 | QBezier b = QBezier::fromPoints(d->elements.at(i-1), | - | ||||||||||||||||||||||||||||||||||||
| 1650 | e, | - | ||||||||||||||||||||||||||||||||||||
| 1651 | d->elements.at(i+1), | - | ||||||||||||||||||||||||||||||||||||
| 1652 | d->elements.at(i+2)); | - | ||||||||||||||||||||||||||||||||||||
| 1653 | len += b.length(); | - | ||||||||||||||||||||||||||||||||||||
| 1654 | i += 2; | - | ||||||||||||||||||||||||||||||||||||
| 1655 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1656 | } | - | ||||||||||||||||||||||||||||||||||||
| 1657 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1658 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1659 | } | - | ||||||||||||||||||||||||||||||||||||
| 1660 | } | - | ||||||||||||||||||||||||||||||||||||
| 1661 | return never executed: len;return len;never executed: return len; | 0 | ||||||||||||||||||||||||||||||||||||
| 1662 | } | - | ||||||||||||||||||||||||||||||||||||
| 1663 | qreal QPainterPath::percentAtLength(qreal len) const | - | ||||||||||||||||||||||||||||||||||||
| 1664 | { | - | ||||||||||||||||||||||||||||||||||||
| 1665 | QPainterPathPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1666 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1667 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1668 | - | |||||||||||||||||||||||||||||||||||||
| 1669 | qreal totalLength = length(); | - | ||||||||||||||||||||||||||||||||||||
| 1670 | if (len > totalLength
| 0 | ||||||||||||||||||||||||||||||||||||
| 1671 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1672 | - | |||||||||||||||||||||||||||||||||||||
| 1673 | qreal curLen = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1674 | for (int i=1; i<d->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1675 | const Element &e = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 1676 | - | |||||||||||||||||||||||||||||||||||||
| 1677 | switch (e.type) { | - | ||||||||||||||||||||||||||||||||||||
| 1678 | case never executed: MoveToElement:case MoveToElement:never executed: case MoveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1679 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1680 | case never executed: LineToElement:case LineToElement:never executed: case LineToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1681 | { | - | ||||||||||||||||||||||||||||||||||||
| 1682 | QLineF line(d->elements.at(i-1), e); | - | ||||||||||||||||||||||||||||||||||||
| 1683 | qreal llen = line.length(); | - | ||||||||||||||||||||||||||||||||||||
| 1684 | curLen += llen; | - | ||||||||||||||||||||||||||||||||||||
| 1685 | if (curLen >= len
| 0 | ||||||||||||||||||||||||||||||||||||
| 1686 | return never executed: len/totalLength ;return len/totalLength ;never executed: return len/totalLength ; | 0 | ||||||||||||||||||||||||||||||||||||
| 1687 | } | - | ||||||||||||||||||||||||||||||||||||
| 1688 | - | |||||||||||||||||||||||||||||||||||||
| 1689 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1690 | } | - | ||||||||||||||||||||||||||||||||||||
| 1691 | case never executed: CurveToElement:case CurveToElement:never executed: case CurveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1692 | { | - | ||||||||||||||||||||||||||||||||||||
| 1693 | QBezier b = QBezier::fromPoints(d->elements.at(i-1), | - | ||||||||||||||||||||||||||||||||||||
| 1694 | e, | - | ||||||||||||||||||||||||||||||||||||
| 1695 | d->elements.at(i+1), | - | ||||||||||||||||||||||||||||||||||||
| 1696 | d->elements.at(i+2)); | - | ||||||||||||||||||||||||||||||||||||
| 1697 | qreal blen = b.length(); | - | ||||||||||||||||||||||||||||||||||||
| 1698 | qreal prevLen = curLen; | - | ||||||||||||||||||||||||||||||||||||
| 1699 | curLen += blen; | - | ||||||||||||||||||||||||||||||||||||
| 1700 | - | |||||||||||||||||||||||||||||||||||||
| 1701 | if (curLen >= len
| 0 | ||||||||||||||||||||||||||||||||||||
| 1702 | qreal res = b.tAtLength(len - prevLen); | - | ||||||||||||||||||||||||||||||||||||
| 1703 | return never executed: (res * blen + prevLen)/totalLength;return (res * blen + prevLen)/totalLength;never executed: return (res * blen + prevLen)/totalLength; | 0 | ||||||||||||||||||||||||||||||||||||
| 1704 | } | - | ||||||||||||||||||||||||||||||||||||
| 1705 | - | |||||||||||||||||||||||||||||||||||||
| 1706 | i += 2; | - | ||||||||||||||||||||||||||||||||||||
| 1707 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1708 | } | - | ||||||||||||||||||||||||||||||||||||
| 1709 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1710 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1711 | } | - | ||||||||||||||||||||||||||||||||||||
| 1712 | } | - | ||||||||||||||||||||||||||||||||||||
| 1713 | - | |||||||||||||||||||||||||||||||||||||
| 1714 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1715 | } | - | ||||||||||||||||||||||||||||||||||||
| 1716 | - | |||||||||||||||||||||||||||||||||||||
| 1717 | static inline QBezier bezierAtT(const QPainterPath &path, qreal t, qreal *startingLength, qreal *bezierLength) | - | ||||||||||||||||||||||||||||||||||||
| 1718 | { | - | ||||||||||||||||||||||||||||||||||||
| 1719 | *startingLength = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1720 | if (t > 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1721 | return never executed: QBezier();return QBezier();never executed: return QBezier(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1722 | - | |||||||||||||||||||||||||||||||||||||
| 1723 | qreal curLen = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1724 | qreal totalLength = path.length(); | - | ||||||||||||||||||||||||||||||||||||
| 1725 | - | |||||||||||||||||||||||||||||||||||||
| 1726 | const int lastElement = path.elementCount() - 1; | - | ||||||||||||||||||||||||||||||||||||
| 1727 | for (int i=0; i <= lastElement
| 0 | ||||||||||||||||||||||||||||||||||||
| 1728 | const QPainterPath::Element &e = path.elementAt(i); | - | ||||||||||||||||||||||||||||||||||||
| 1729 | - | |||||||||||||||||||||||||||||||||||||
| 1730 | switch (e.type) { | - | ||||||||||||||||||||||||||||||||||||
| 1731 | case never executed: QPainterPath::MoveToElement:case QPainterPath::MoveToElement:never executed: case QPainterPath::MoveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1732 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1733 | case never executed: QPainterPath::LineToElement:case QPainterPath::LineToElement:never executed: case QPainterPath::LineToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1734 | { | - | ||||||||||||||||||||||||||||||||||||
| 1735 | QLineF line(path.elementAt(i-1), e); | - | ||||||||||||||||||||||||||||||||||||
| 1736 | qreal llen = line.length(); | - | ||||||||||||||||||||||||||||||||||||
| 1737 | curLen += llen; | - | ||||||||||||||||||||||||||||||||||||
| 1738 | if (i == lastElement
| 0 | ||||||||||||||||||||||||||||||||||||
| 1739 | *bezierLength = llen; | - | ||||||||||||||||||||||||||||||||||||
| 1740 | QPointF a = path.elementAt(i-1); | - | ||||||||||||||||||||||||||||||||||||
| 1741 | QPointF delta = e - a; | - | ||||||||||||||||||||||||||||||||||||
| 1742 | return never executed: QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e);return QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e);never executed: return QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e); | 0 | ||||||||||||||||||||||||||||||||||||
| 1743 | } | - | ||||||||||||||||||||||||||||||||||||
| 1744 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1745 | } | - | ||||||||||||||||||||||||||||||||||||
| 1746 | case never executed: QPainterPath::CurveToElement:case QPainterPath::CurveToElement:never executed: case QPainterPath::CurveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 1747 | { | - | ||||||||||||||||||||||||||||||||||||
| 1748 | QBezier b = QBezier::fromPoints(path.elementAt(i-1), | - | ||||||||||||||||||||||||||||||||||||
| 1749 | e, | - | ||||||||||||||||||||||||||||||||||||
| 1750 | path.elementAt(i+1), | - | ||||||||||||||||||||||||||||||||||||
| 1751 | path.elementAt(i+2)); | - | ||||||||||||||||||||||||||||||||||||
| 1752 | qreal blen = b.length(); | - | ||||||||||||||||||||||||||||||||||||
| 1753 | curLen += blen; | - | ||||||||||||||||||||||||||||||||||||
| 1754 | - | |||||||||||||||||||||||||||||||||||||
| 1755 | if (i + 2 == lastElement
| 0 | ||||||||||||||||||||||||||||||||||||
| 1756 | *bezierLength = blen; | - | ||||||||||||||||||||||||||||||||||||
| 1757 | return never executed: b;return b;never executed: return b; | 0 | ||||||||||||||||||||||||||||||||||||
| 1758 | } | - | ||||||||||||||||||||||||||||||||||||
| 1759 | - | |||||||||||||||||||||||||||||||||||||
| 1760 | i += 2; | - | ||||||||||||||||||||||||||||||||||||
| 1761 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1762 | } | - | ||||||||||||||||||||||||||||||||||||
| 1763 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1764 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1765 | } | - | ||||||||||||||||||||||||||||||||||||
| 1766 | *startingLength = curLen; | - | ||||||||||||||||||||||||||||||||||||
| 1767 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1768 | return never executed: QBezier();return QBezier();never executed: return QBezier(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1769 | } | - | ||||||||||||||||||||||||||||||||||||
| 1770 | QPointF QPainterPath::pointAtPercent(qreal t) const | - | ||||||||||||||||||||||||||||||||||||
| 1771 | { | - | ||||||||||||||||||||||||||||||||||||
| 1772 | if (t < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1773 | QMessageLogger(__FILE__, 2982, __PRETTY_FUNCTION__).warning("QPainterPath::pointAtPercent accepts only values between 0 and 1"); | - | ||||||||||||||||||||||||||||||||||||
| 1774 | return never executed: QPointF();return QPointF();never executed: return QPointF(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1775 | } | - | ||||||||||||||||||||||||||||||||||||
| 1776 | - | |||||||||||||||||||||||||||||||||||||
| 1777 | if (!d_ptr
| 0 | ||||||||||||||||||||||||||||||||||||
| 1778 | return never executed: QPointF();return QPointF();never executed: return QPointF(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1779 | - | |||||||||||||||||||||||||||||||||||||
| 1780 | if (d_ptr->elements.size() == 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1781 | return never executed: d_ptr->elements.at(0);return d_ptr->elements.at(0);never executed: return d_ptr->elements.at(0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1782 | - | |||||||||||||||||||||||||||||||||||||
| 1783 | qreal totalLength = length(); | - | ||||||||||||||||||||||||||||||||||||
| 1784 | qreal curLen = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1785 | qreal bezierLen = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1786 | QBezier b = bezierAtT(*this, t, &curLen, &bezierLen); | - | ||||||||||||||||||||||||||||||||||||
| 1787 | qreal realT = (totalLength * t - curLen) / bezierLen; | - | ||||||||||||||||||||||||||||||||||||
| 1788 | - | |||||||||||||||||||||||||||||||||||||
| 1789 | return never executed: b.pointAt(qBound(qreal(0), realT, qreal(1)));return b.pointAt(qBound(qreal(0), realT, qreal(1)));never executed: return b.pointAt(qBound(qreal(0), realT, qreal(1))); | 0 | ||||||||||||||||||||||||||||||||||||
| 1790 | } | - | ||||||||||||||||||||||||||||||||||||
| 1791 | qreal QPainterPath::angleAtPercent(qreal t) const | - | ||||||||||||||||||||||||||||||||||||
| 1792 | { | - | ||||||||||||||||||||||||||||||||||||
| 1793 | if (t < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1794 | QMessageLogger(__FILE__, 3016, __PRETTY_FUNCTION__).warning("QPainterPath::angleAtPercent accepts only values between 0 and 1"); | - | ||||||||||||||||||||||||||||||||||||
| 1795 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1796 | } | - | ||||||||||||||||||||||||||||||||||||
| 1797 | - | |||||||||||||||||||||||||||||||||||||
| 1798 | qreal totalLength = length(); | - | ||||||||||||||||||||||||||||||||||||
| 1799 | qreal curLen = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1800 | qreal bezierLen = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1801 | QBezier bez = bezierAtT(*this, t, &curLen, &bezierLen); | - | ||||||||||||||||||||||||||||||||||||
| 1802 | qreal realT = (totalLength * t - curLen) / bezierLen; | - | ||||||||||||||||||||||||||||||||||||
| 1803 | - | |||||||||||||||||||||||||||||||||||||
| 1804 | qreal m1 = slopeAt(realT, bez.x1, bez.x2, bez.x3, bez.x4); | - | ||||||||||||||||||||||||||||||||||||
| 1805 | qreal m2 = slopeAt(realT, bez.y1, bez.y2, bez.y3, bez.y4); | - | ||||||||||||||||||||||||||||||||||||
| 1806 | - | |||||||||||||||||||||||||||||||||||||
| 1807 | return never executed: QLineF(0, 0, m1, m2).angle();return QLineF(0, 0, m1, m2).angle();never executed: return QLineF(0, 0, m1, m2).angle(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1808 | } | - | ||||||||||||||||||||||||||||||||||||
| 1809 | qreal QPainterPath::slopeAtPercent(qreal t) const | - | ||||||||||||||||||||||||||||||||||||
| 1810 | { | - | ||||||||||||||||||||||||||||||||||||
| 1811 | if (t < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1812 | QMessageLogger(__FILE__, 3045, __PRETTY_FUNCTION__).warning("QPainterPath::slopeAtPercent accepts only values between 0 and 1"); | - | ||||||||||||||||||||||||||||||||||||
| 1813 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1814 | } | - | ||||||||||||||||||||||||||||||||||||
| 1815 | - | |||||||||||||||||||||||||||||||||||||
| 1816 | qreal totalLength = length(); | - | ||||||||||||||||||||||||||||||||||||
| 1817 | qreal curLen = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1818 | qreal bezierLen = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1819 | QBezier bez = bezierAtT(*this, t, &curLen, &bezierLen); | - | ||||||||||||||||||||||||||||||||||||
| 1820 | qreal realT = (totalLength * t - curLen) / bezierLen; | - | ||||||||||||||||||||||||||||||||||||
| 1821 | - | |||||||||||||||||||||||||||||||||||||
| 1822 | qreal m1 = slopeAt(realT, bez.x1, bez.x2, bez.x3, bez.x4); | - | ||||||||||||||||||||||||||||||||||||
| 1823 | qreal m2 = slopeAt(realT, bez.y1, bez.y2, bez.y3, bez.y4); | - | ||||||||||||||||||||||||||||||||||||
| 1824 | - | |||||||||||||||||||||||||||||||||||||
| 1825 | qreal slope = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1826 | - | |||||||||||||||||||||||||||||||||||||
| 1827 | if (m1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1828 | slope = m2/m1; never executed: slope = m2/m1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1829 | else { | - | ||||||||||||||||||||||||||||||||||||
| 1830 | if (std::numeric_limits<qreal>::has_infinity
| 0 | ||||||||||||||||||||||||||||||||||||
| 1831 | slope = (
| 0 | ||||||||||||||||||||||||||||||||||||
| 1832 | : std::numeric_limits<qreal>::infinity(); | - | ||||||||||||||||||||||||||||||||||||
| 1833 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1834 | if (sizeof(qreal) == sizeof(double)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1835 | return never executed: 1.79769313486231570e+308;return 1.79769313486231570e+308;never executed: return 1.79769313486231570e+308; | 0 | ||||||||||||||||||||||||||||||||||||
| 1836 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1837 | return never executed: ((qreal)3.40282346638528860e+38);return ((qreal)3.40282346638528860e+38);never executed: return ((qreal)3.40282346638528860e+38); | 0 | ||||||||||||||||||||||||||||||||||||
| 1838 | } | - | ||||||||||||||||||||||||||||||||||||
| 1839 | } | - | ||||||||||||||||||||||||||||||||||||
| 1840 | } | - | ||||||||||||||||||||||||||||||||||||
| 1841 | - | |||||||||||||||||||||||||||||||||||||
| 1842 | return never executed: slope;return slope;never executed: return slope; | 0 | ||||||||||||||||||||||||||||||||||||
| 1843 | } | - | ||||||||||||||||||||||||||||||||||||
| 1844 | void QPainterPath::addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, | - | ||||||||||||||||||||||||||||||||||||
| 1845 | Qt::SizeMode mode) | - | ||||||||||||||||||||||||||||||||||||
| 1846 | { | - | ||||||||||||||||||||||||||||||||||||
| 1847 | QRectF r = rect.normalized(); | - | ||||||||||||||||||||||||||||||||||||
| 1848 | - | |||||||||||||||||||||||||||||||||||||
| 1849 | if (r.isNull()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1850 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1851 | - | |||||||||||||||||||||||||||||||||||||
| 1852 | if (mode == Qt::AbsoluteSize
| 0 | ||||||||||||||||||||||||||||||||||||
| 1853 | qreal w = r.width() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 1854 | qreal h = r.height() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 1855 | - | |||||||||||||||||||||||||||||||||||||
| 1856 | if (w == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1857 | xRadius = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1858 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1859 | xRadius = 100 * qMin(xRadius, w) / w; | - | ||||||||||||||||||||||||||||||||||||
| 1860 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1861 | if (h == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1862 | yRadius = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1863 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1864 | yRadius = 100 * qMin(yRadius, h) / h; | - | ||||||||||||||||||||||||||||||||||||
| 1865 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1866 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1867 | if (xRadius > 100
| 0 | ||||||||||||||||||||||||||||||||||||
| 1868 | xRadius = 100; never executed: xRadius = 100; | 0 | ||||||||||||||||||||||||||||||||||||
| 1869 | - | |||||||||||||||||||||||||||||||||||||
| 1870 | if (yRadius > 100
| 0 | ||||||||||||||||||||||||||||||||||||
| 1871 | yRadius = 100; never executed: yRadius = 100; | 0 | ||||||||||||||||||||||||||||||||||||
| 1872 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1873 | - | |||||||||||||||||||||||||||||||||||||
| 1874 | if (xRadius <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1875 | addRect(r); | - | ||||||||||||||||||||||||||||||||||||
| 1876 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1877 | } | - | ||||||||||||||||||||||||||||||||||||
| 1878 | - | |||||||||||||||||||||||||||||||||||||
| 1879 | qreal x = r.x(); | - | ||||||||||||||||||||||||||||||||||||
| 1880 | qreal y = r.y(); | - | ||||||||||||||||||||||||||||||||||||
| 1881 | qreal w = r.width(); | - | ||||||||||||||||||||||||||||||||||||
| 1882 | qreal h = r.height(); | - | ||||||||||||||||||||||||||||||||||||
| 1883 | qreal rxx2 = w*xRadius/100; | - | ||||||||||||||||||||||||||||||||||||
| 1884 | qreal ryy2 = h*yRadius/100; | - | ||||||||||||||||||||||||||||||||||||
| 1885 | - | |||||||||||||||||||||||||||||||||||||
| 1886 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 1887 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 1888 | - | |||||||||||||||||||||||||||||||||||||
| 1889 | bool first = d_func()->elements.size() < 2; | - | ||||||||||||||||||||||||||||||||||||
| 1890 | - | |||||||||||||||||||||||||||||||||||||
| 1891 | arcMoveTo(x, y, rxx2, ryy2, 180); | - | ||||||||||||||||||||||||||||||||||||
| 1892 | arcTo(x, y, rxx2, ryy2, 180, -90); | - | ||||||||||||||||||||||||||||||||||||
| 1893 | arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90); | - | ||||||||||||||||||||||||||||||||||||
| 1894 | arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90); | - | ||||||||||||||||||||||||||||||||||||
| 1895 | arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90); | - | ||||||||||||||||||||||||||||||||||||
| 1896 | closeSubpath(); | - | ||||||||||||||||||||||||||||||||||||
| 1897 | - | |||||||||||||||||||||||||||||||||||||
| 1898 | d_func()->require_moveTo = true; | - | ||||||||||||||||||||||||||||||||||||
| 1899 | d_func()->convex = first; | - | ||||||||||||||||||||||||||||||||||||
| 1900 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1901 | void QPainterPath::addRoundRect(const QRectF &r, int xRnd, int yRnd) | - | ||||||||||||||||||||||||||||||||||||
| 1902 | { | - | ||||||||||||||||||||||||||||||||||||
| 1903 | if(xRnd >= 100
| 0 | ||||||||||||||||||||||||||||||||||||
| 1904 | xRnd = 99; never executed: xRnd = 99; | 0 | ||||||||||||||||||||||||||||||||||||
| 1905 | if(yRnd >= 100
| 0 | ||||||||||||||||||||||||||||||||||||
| 1906 | yRnd = 99; never executed: yRnd = 99; | 0 | ||||||||||||||||||||||||||||||||||||
| 1907 | if(xRnd <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1908 | addRect(r); | - | ||||||||||||||||||||||||||||||||||||
| 1909 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1910 | } | - | ||||||||||||||||||||||||||||||||||||
| 1911 | - | |||||||||||||||||||||||||||||||||||||
| 1912 | QRectF rect = r.normalized(); | - | ||||||||||||||||||||||||||||||||||||
| 1913 | - | |||||||||||||||||||||||||||||||||||||
| 1914 | if (rect.isNull()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1915 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1916 | - | |||||||||||||||||||||||||||||||||||||
| 1917 | qreal x = rect.x(); | - | ||||||||||||||||||||||||||||||||||||
| 1918 | qreal y = rect.y(); | - | ||||||||||||||||||||||||||||||||||||
| 1919 | qreal w = rect.width(); | - | ||||||||||||||||||||||||||||||||||||
| 1920 | qreal h = rect.height(); | - | ||||||||||||||||||||||||||||||||||||
| 1921 | qreal rxx2 = w*xRnd/100; | - | ||||||||||||||||||||||||||||||||||||
| 1922 | qreal ryy2 = h*yRnd/100; | - | ||||||||||||||||||||||||||||||||||||
| 1923 | - | |||||||||||||||||||||||||||||||||||||
| 1924 | ensureData(); | - | ||||||||||||||||||||||||||||||||||||
| 1925 | detach(); | - | ||||||||||||||||||||||||||||||||||||
| 1926 | - | |||||||||||||||||||||||||||||||||||||
| 1927 | bool first = d_func()->elements.size() < 2; | - | ||||||||||||||||||||||||||||||||||||
| 1928 | - | |||||||||||||||||||||||||||||||||||||
| 1929 | arcMoveTo(x, y, rxx2, ryy2, 180); | - | ||||||||||||||||||||||||||||||||||||
| 1930 | arcTo(x, y, rxx2, ryy2, 180, -90); | - | ||||||||||||||||||||||||||||||||||||
| 1931 | arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90); | - | ||||||||||||||||||||||||||||||||||||
| 1932 | arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90); | - | ||||||||||||||||||||||||||||||||||||
| 1933 | arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90); | - | ||||||||||||||||||||||||||||||||||||
| 1934 | closeSubpath(); | - | ||||||||||||||||||||||||||||||||||||
| 1935 | - | |||||||||||||||||||||||||||||||||||||
| 1936 | d_func()->require_moveTo = true; | - | ||||||||||||||||||||||||||||||||||||
| 1937 | d_func()->convex = first; | - | ||||||||||||||||||||||||||||||||||||
| 1938 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1939 | QPainterPath QPainterPath::united(const QPainterPath &p) const | - | ||||||||||||||||||||||||||||||||||||
| 1940 | { | - | ||||||||||||||||||||||||||||||||||||
| 1941 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1942 | return never executed: isEmpty()return isEmpty() ? p : *this;
never executed: return isEmpty() ? p : *this; | 0 | ||||||||||||||||||||||||||||||||||||
| 1943 | QPathClipper clipper(*this, p); | - | ||||||||||||||||||||||||||||||||||||
| 1944 | return never executed: clipper.clip(QPathClipper::BoolOr);return clipper.clip(QPathClipper::BoolOr);never executed: return clipper.clip(QPathClipper::BoolOr); | 0 | ||||||||||||||||||||||||||||||||||||
| 1945 | } | - | ||||||||||||||||||||||||||||||||||||
| 1946 | QPainterPath QPainterPath::intersected(const QPainterPath &p) const | - | ||||||||||||||||||||||||||||||||||||
| 1947 | { | - | ||||||||||||||||||||||||||||||||||||
| 1948 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1949 | return never executed: QPainterPath();return QPainterPath();never executed: return QPainterPath(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1950 | QPathClipper clipper(*this, p); | - | ||||||||||||||||||||||||||||||||||||
| 1951 | return never executed: clipper.clip(QPathClipper::BoolAnd);return clipper.clip(QPathClipper::BoolAnd);never executed: return clipper.clip(QPathClipper::BoolAnd); | 0 | ||||||||||||||||||||||||||||||||||||
| 1952 | } | - | ||||||||||||||||||||||||||||||||||||
| 1953 | QPainterPath QPainterPath::subtracted(const QPainterPath &p) const | - | ||||||||||||||||||||||||||||||||||||
| 1954 | { | - | ||||||||||||||||||||||||||||||||||||
| 1955 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1956 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||||||||||||||||||||
| 1957 | QPathClipper clipper(*this, p); | - | ||||||||||||||||||||||||||||||||||||
| 1958 | return never executed: clipper.clip(QPathClipper::BoolSub);return clipper.clip(QPathClipper::BoolSub);never executed: return clipper.clip(QPathClipper::BoolSub); | 0 | ||||||||||||||||||||||||||||||||||||
| 1959 | } | - | ||||||||||||||||||||||||||||||||||||
| 1960 | QPainterPath QPainterPath::subtractedInverted(const QPainterPath &p) const | - | ||||||||||||||||||||||||||||||||||||
| 1961 | { | - | ||||||||||||||||||||||||||||||||||||
| 1962 | return never executed: p.subtracted(*this);return p.subtracted(*this);never executed: return p.subtracted(*this); | 0 | ||||||||||||||||||||||||||||||||||||
| 1963 | } | - | ||||||||||||||||||||||||||||||||||||
| 1964 | QPainterPath QPainterPath::simplified() const | - | ||||||||||||||||||||||||||||||||||||
| 1965 | { | - | ||||||||||||||||||||||||||||||||||||
| 1966 | if(isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1967 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||||||||||||||||||||
| 1968 | QPathClipper clipper(*this, QPainterPath()); | - | ||||||||||||||||||||||||||||||||||||
| 1969 | return never executed: clipper.clip(QPathClipper::Simplify);return clipper.clip(QPathClipper::Simplify);never executed: return clipper.clip(QPathClipper::Simplify); | 0 | ||||||||||||||||||||||||||||||||||||
| 1970 | } | - | ||||||||||||||||||||||||||||||||||||
| 1971 | bool QPainterPath::intersects(const QPainterPath &p) const | - | ||||||||||||||||||||||||||||||||||||
| 1972 | { | - | ||||||||||||||||||||||||||||||||||||
| 1973 | if (p.elementCount() == 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1974 | return never executed: contains(p.elementAt(0));return contains(p.elementAt(0));never executed: return contains(p.elementAt(0)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1975 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1976 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1977 | QPathClipper clipper(*this, p); | - | ||||||||||||||||||||||||||||||||||||
| 1978 | return never executed: clipper.intersect();return clipper.intersect();never executed: return clipper.intersect(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1979 | } | - | ||||||||||||||||||||||||||||||||||||
| 1980 | bool QPainterPath::contains(const QPainterPath &p) const | - | ||||||||||||||||||||||||||||||||||||
| 1981 | { | - | ||||||||||||||||||||||||||||||||||||
| 1982 | if (p.elementCount() == 1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1983 | return never executed: contains(p.elementAt(0));return contains(p.elementAt(0));never executed: return contains(p.elementAt(0)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1984 | if (isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1985 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
| 1986 | QPathClipper clipper(*this, p); | - | ||||||||||||||||||||||||||||||||||||
| 1987 | return never executed: clipper.contains();return clipper.contains();never executed: return clipper.contains(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1988 | } | - | ||||||||||||||||||||||||||||||||||||
| 1989 | - | |||||||||||||||||||||||||||||||||||||
| 1990 | void QPainterPath::setDirty(bool dirty) | - | ||||||||||||||||||||||||||||||||||||
| 1991 | { | - | ||||||||||||||||||||||||||||||||||||
| 1992 | d_func()->dirtyBounds = dirty; | - | ||||||||||||||||||||||||||||||||||||
| 1993 | d_func()->dirtyControlBounds = dirty; | - | ||||||||||||||||||||||||||||||||||||
| 1994 | delete d_func()->pathConverter; | - | ||||||||||||||||||||||||||||||||||||
| 1995 | d_func()->pathConverter = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1996 | d_func()->convex = false; | - | ||||||||||||||||||||||||||||||||||||
| 1997 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1998 | - | |||||||||||||||||||||||||||||||||||||
| 1999 | void QPainterPath::computeBoundingRect() const | - | ||||||||||||||||||||||||||||||||||||
| 2000 | { | - | ||||||||||||||||||||||||||||||||||||
| 2001 | QPainterPathData *d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 2002 | d->dirtyBounds = false; | - | ||||||||||||||||||||||||||||||||||||
| 2003 | if (!d_ptr
| 0 | ||||||||||||||||||||||||||||||||||||
| 2004 | d->bounds = QRect(); | - | ||||||||||||||||||||||||||||||||||||
| 2005 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 2006 | } | - | ||||||||||||||||||||||||||||||||||||
| 2007 | - | |||||||||||||||||||||||||||||||||||||
| 2008 | qreal minx, maxx, miny, maxy; | - | ||||||||||||||||||||||||||||||||||||
| 2009 | minx = maxx = d->elements.at(0).x; | - | ||||||||||||||||||||||||||||||||||||
| 2010 | miny = maxy = d->elements.at(0).y; | - | ||||||||||||||||||||||||||||||||||||
| 2011 | for (int i=1; i<d->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 2012 | const Element &e = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 2013 | - | |||||||||||||||||||||||||||||||||||||
| 2014 | switch (e.type) { | - | ||||||||||||||||||||||||||||||||||||
| 2015 | case never executed: MoveToElement:case MoveToElement:never executed: case MoveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 2016 | case never executed: LineToElement:case LineToElement:never executed: case LineToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 2017 | if (e.x > maxx
never executed: maxx = e.x; | 0 | ||||||||||||||||||||||||||||||||||||
| 2018 | else if (e.x < minx
never executed: minx = e.x; | 0 | ||||||||||||||||||||||||||||||||||||
| 2019 | if (e.y > maxy
never executed: maxy = e.y; | 0 | ||||||||||||||||||||||||||||||||||||
| 2020 | else if (e.y < miny
never executed: miny = e.y; | 0 | ||||||||||||||||||||||||||||||||||||
| 2021 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2022 | case never executed: CurveToElement:case CurveToElement:never executed: case CurveToElement: | 0 | ||||||||||||||||||||||||||||||||||||
| 2023 | { | - | ||||||||||||||||||||||||||||||||||||
| 2024 | QBezier b = QBezier::fromPoints(d->elements.at(i-1), | - | ||||||||||||||||||||||||||||||||||||
| 2025 | e, | - | ||||||||||||||||||||||||||||||||||||
| 2026 | d->elements.at(i+1), | - | ||||||||||||||||||||||||||||||||||||
| 2027 | d->elements.at(i+2)); | - | ||||||||||||||||||||||||||||||||||||
| 2028 | QRectF r = qt_painterpath_bezier_extrema(b); | - | ||||||||||||||||||||||||||||||||||||
| 2029 | qreal right = r.right(); | - | ||||||||||||||||||||||||||||||||||||
| 2030 | qreal bottom = r.bottom(); | - | ||||||||||||||||||||||||||||||||||||
| 2031 | if (r.x() < minx
never executed: minx = r.x(); | 0 | ||||||||||||||||||||||||||||||||||||
| 2032 | if (right > maxx
never executed: maxx = right; | 0 | ||||||||||||||||||||||||||||||||||||
| 2033 | if (r.y() < miny
never executed: miny = r.y(); | 0 | ||||||||||||||||||||||||||||||||||||
| 2034 | if (bottom > maxy
never executed: maxy = bottom; | 0 | ||||||||||||||||||||||||||||||||||||
| 2035 | i += 2; | - | ||||||||||||||||||||||||||||||||||||
| 2036 | } | - | ||||||||||||||||||||||||||||||||||||
| 2037 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2038 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 2039 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2040 | } | - | ||||||||||||||||||||||||||||||||||||
| 2041 | } | - | ||||||||||||||||||||||||||||||||||||
| 2042 | d->bounds = QRectF(minx, miny, maxx - minx, maxy - miny); | - | ||||||||||||||||||||||||||||||||||||
| 2043 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2044 | - | |||||||||||||||||||||||||||||||||||||
| 2045 | - | |||||||||||||||||||||||||||||||||||||
| 2046 | void QPainterPath::computeControlPointRect() const | - | ||||||||||||||||||||||||||||||||||||
| 2047 | { | - | ||||||||||||||||||||||||||||||||||||
| 2048 | QPainterPathData *d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 2049 | d->dirtyControlBounds = false; | - | ||||||||||||||||||||||||||||||||||||
| 2050 | if (!d_ptr
| 0 | ||||||||||||||||||||||||||||||||||||
| 2051 | d->controlBounds = QRect(); | - | ||||||||||||||||||||||||||||||||||||
| 2052 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 2053 | } | - | ||||||||||||||||||||||||||||||||||||
| 2054 | - | |||||||||||||||||||||||||||||||||||||
| 2055 | qreal minx, maxx, miny, maxy; | - | ||||||||||||||||||||||||||||||||||||
| 2056 | minx = maxx = d->elements.at(0).x; | - | ||||||||||||||||||||||||||||||||||||
| 2057 | miny = maxy = d->elements.at(0).y; | - | ||||||||||||||||||||||||||||||||||||
| 2058 | for (int i=1; i<d->elements.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 2059 | const Element &e = d->elements.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 2060 | if (e.x > maxx
never executed: maxx = e.x; | 0 | ||||||||||||||||||||||||||||||||||||
| 2061 | else if (e.x < minx
never executed: minx = e.x; | 0 | ||||||||||||||||||||||||||||||||||||
| 2062 | if (e.y > maxy
never executed: maxy = e.y; | 0 | ||||||||||||||||||||||||||||||||||||
| 2063 | else if (e.y < miny
never executed: miny = e.y; | 0 | ||||||||||||||||||||||||||||||||||||
| 2064 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2065 | d->controlBounds = QRectF(minx, miny, maxx - minx, maxy - miny); | - | ||||||||||||||||||||||||||||||||||||
| 2066 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2067 | - | |||||||||||||||||||||||||||||||||||||
| 2068 | - | |||||||||||||||||||||||||||||||||||||
| 2069 | QDebug operator<<(QDebug s, const QPainterPath &p) | - | ||||||||||||||||||||||||||||||||||||
| 2070 | { | - | ||||||||||||||||||||||||||||||||||||
| 2071 | s.nospace() << "QPainterPath: Element count=" << p.elementCount() << endl; | - | ||||||||||||||||||||||||||||||||||||
| 2072 | const char *types[] = {"MoveTo", "LineTo", "CurveTo", "CurveToData"}; | - | ||||||||||||||||||||||||||||||||||||
| 2073 | for (int i=0; i<p.elementCount()
| 0 | ||||||||||||||||||||||||||||||||||||
| 2074 | s.nospace() << " -> " << types[p.elementAt(i).type] << "(x=" << p.elementAt(i).x << ", y=" << p.elementAt(i).y << ')' << endl; | - | ||||||||||||||||||||||||||||||||||||
| 2075 | - | |||||||||||||||||||||||||||||||||||||
| 2076 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2077 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||||||||||||||
| 2078 | } | - | ||||||||||||||||||||||||||||||||||||
| 2079 | - | |||||||||||||||||||||||||||||||||||||
| 2080 | - | |||||||||||||||||||||||||||||||||||||
| 2081 | - | |||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |