| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qrasterizer.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | typedef int Q16Dot16; | - | ||||||||||||||||||||||||
| 9 | static inline QT_FT_Vector PointToVector(const QPointF &p) | - | ||||||||||||||||||||||||
| 10 | { | - | ||||||||||||||||||||||||
| 11 | QT_FT_Vector result = { QT_FT_Pos(p.x() * 64), QT_FT_Pos(p.y() * 64) }; | - | ||||||||||||||||||||||||
| 12 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||||||||||||||
| 13 | } | - | ||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | class QSpanBuffer { | - | ||||||||||||||||||||||||
| 16 | public: | - | ||||||||||||||||||||||||
| 17 | QSpanBuffer(ProcessSpans blend, void *data, const QRect &clipRect) | - | ||||||||||||||||||||||||
| 18 | : m_spanCount(0) | - | ||||||||||||||||||||||||
| 19 | , m_blend(blend) | - | ||||||||||||||||||||||||
| 20 | , m_data(data) | - | ||||||||||||||||||||||||
| 21 | , m_clipRect(clipRect) | - | ||||||||||||||||||||||||
| 22 | { | - | ||||||||||||||||||||||||
| 23 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||
| 25 | ~QSpanBuffer() | - | ||||||||||||||||||||||||
| 26 | { | - | ||||||||||||||||||||||||
| 27 | flushSpans(); | - | ||||||||||||||||||||||||
| 28 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||
| 30 | void addSpan(int x, unsigned int len, int y, unsigned char coverage) | - | ||||||||||||||||||||||||
| 31 | { | - | ||||||||||||||||||||||||
| 32 | if (!coverage
| 0 | ||||||||||||||||||||||||
| 33 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | ((!(y >= m_clipRect.top())) ? qt_assert("y >= m_clipRect.top()",__FILE__,94) : qt_noop()); | - | ||||||||||||||||||||||||
| 36 | ((!(y <= m_clipRect.bottom())) ? qt_assert("y <= m_clipRect.bottom()",__FILE__,95) : qt_noop()); | - | ||||||||||||||||||||||||
| 37 | ((!(x >= m_clipRect.left())) ? qt_assert("x >= m_clipRect.left()",__FILE__,96) : qt_noop()); | - | ||||||||||||||||||||||||
| 38 | ((!(x + int(len) - 1 <= m_clipRect.right())) ? qt_assert("x + int(len) - 1 <= m_clipRect.right()",__FILE__,97) : qt_noop()); | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | m_spans[m_spanCount].x = x; | - | ||||||||||||||||||||||||
| 41 | m_spans[m_spanCount].len = len; | - | ||||||||||||||||||||||||
| 42 | m_spans[m_spanCount].y = y; | - | ||||||||||||||||||||||||
| 43 | m_spans[m_spanCount].coverage = coverage; | - | ||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||
| 45 | if (++
| 0 | ||||||||||||||||||||||||
| 46 | flushSpans(); never executed: flushSpans(); | 0 | ||||||||||||||||||||||||
| 47 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | private: | - | ||||||||||||||||||||||||
| 50 | void flushSpans() | - | ||||||||||||||||||||||||
| 51 | { | - | ||||||||||||||||||||||||
| 52 | m_blend(m_spanCount, m_spans, m_data); | - | ||||||||||||||||||||||||
| 53 | m_spanCount = 0; | - | ||||||||||||||||||||||||
| 54 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | QT_FT_Span m_spans[256]; | - | ||||||||||||||||||||||||
| 57 | int m_spanCount; | - | ||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | ProcessSpans m_blend; | - | ||||||||||||||||||||||||
| 60 | void *m_data; | - | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | QRect m_clipRect; | - | ||||||||||||||||||||||||
| 63 | }; | - | ||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | class QScanConverter | - | ||||||||||||||||||||||||
| 67 | { | - | ||||||||||||||||||||||||
| 68 | public: | - | ||||||||||||||||||||||||
| 69 | QScanConverter(); | - | ||||||||||||||||||||||||
| 70 | ~QScanConverter(); | - | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | void begin(int top, int bottom, int left, int right, | - | ||||||||||||||||||||||||
| 73 | Qt::FillRule fillRule, bool legacyRounding, QSpanBuffer *spanBuffer); | - | ||||||||||||||||||||||||
| 74 | void end(); | - | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | void mergeCurve(const QT_FT_Vector &a, const QT_FT_Vector &b, | - | ||||||||||||||||||||||||
| 77 | const QT_FT_Vector &c, const QT_FT_Vector &d); | - | ||||||||||||||||||||||||
| 78 | void mergeLine(QT_FT_Vector a, QT_FT_Vector b); | - | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | struct Line | - | ||||||||||||||||||||||||
| 81 | { | - | ||||||||||||||||||||||||
| 82 | Q16Dot16 x; | - | ||||||||||||||||||||||||
| 83 | Q16Dot16 delta; | - | ||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | int top, bottom; | - | ||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | int winding; | - | ||||||||||||||||||||||||
| 88 | }; | - | ||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | private: | - | ||||||||||||||||||||||||
| 91 | struct Intersection | - | ||||||||||||||||||||||||
| 92 | { | - | ||||||||||||||||||||||||
| 93 | int x; | - | ||||||||||||||||||||||||
| 94 | int winding; | - | ||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | int left, right; | - | ||||||||||||||||||||||||
| 97 | }; | - | ||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | inline bool clip(Q16Dot16 &xFP, int &iTop, int &iBottom, Q16Dot16 slopeFP, Q16Dot16 edgeFP, int winding); | - | ||||||||||||||||||||||||
| 100 | inline void mergeIntersection(Intersection *head, const Intersection &isect); | - | ||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||
| 102 | void prepareChunk(); | - | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | void emitNode(const Intersection *node); | - | ||||||||||||||||||||||||
| 105 | void emitSpans(int chunk); | - | ||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | inline void allocate(int size); | - | ||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||
| 109 | QDataBuffer<Line> m_lines; | - | ||||||||||||||||||||||||
| 110 | - | |||||||||||||||||||||||||
| 111 | int m_alloc; | - | ||||||||||||||||||||||||
| 112 | int m_size; | - | ||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||
| 114 | int m_top; | - | ||||||||||||||||||||||||
| 115 | int m_bottom; | - | ||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | Q16Dot16 m_leftFP; | - | ||||||||||||||||||||||||
| 118 | Q16Dot16 m_rightFP; | - | ||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | int m_fillRuleMask; | - | ||||||||||||||||||||||||
| 121 | bool m_legacyRounding; | - | ||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | int m_x; | - | ||||||||||||||||||||||||
| 124 | int m_y; | - | ||||||||||||||||||||||||
| 125 | int m_winding; | - | ||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||
| 127 | Intersection *m_intersections; | - | ||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | QSpanBuffer *m_spanBuffer; | - | ||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | QDataBuffer<Line *> m_active; | - | ||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | template <typename T> | - | ||||||||||||||||||||||||
| 134 | friend void qScanConvert(QScanConverter &d, T allVertical); | - | ||||||||||||||||||||||||
| 135 | }; | - | ||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | class QRasterizerPrivate | - | ||||||||||||||||||||||||
| 138 | { | - | ||||||||||||||||||||||||
| 139 | public: | - | ||||||||||||||||||||||||
| 140 | bool antialiased; | - | ||||||||||||||||||||||||
| 141 | bool legacyRounding; | - | ||||||||||||||||||||||||
| 142 | ProcessSpans blend; | - | ||||||||||||||||||||||||
| 143 | void *data; | - | ||||||||||||||||||||||||
| 144 | QRect clipRect; | - | ||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | QScanConverter scanConverter; | - | ||||||||||||||||||||||||
| 147 | }; | - | ||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||
| 149 | QScanConverter::QScanConverter() | - | ||||||||||||||||||||||||
| 150 | : m_lines(0) | - | ||||||||||||||||||||||||
| 151 | , m_alloc(0) | - | ||||||||||||||||||||||||
| 152 | , m_size(0) | - | ||||||||||||||||||||||||
| 153 | , m_intersections(0) | - | ||||||||||||||||||||||||
| 154 | , m_active(0) | - | ||||||||||||||||||||||||
| 155 | { | - | ||||||||||||||||||||||||
| 156 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||
| 158 | QScanConverter::~QScanConverter() | - | ||||||||||||||||||||||||
| 159 | { | - | ||||||||||||||||||||||||
| 160 | if (m_intersections
| 0 | ||||||||||||||||||||||||
| 161 | free(m_intersections); never executed: free(m_intersections); | 0 | ||||||||||||||||||||||||
| 162 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | void QScanConverter::begin(int top, int bottom, int left, int right, | - | ||||||||||||||||||||||||
| 165 | Qt::FillRule fillRule, bool legacyRounding, | - | ||||||||||||||||||||||||
| 166 | QSpanBuffer *spanBuffer) | - | ||||||||||||||||||||||||
| 167 | { | - | ||||||||||||||||||||||||
| 168 | m_top = top; | - | ||||||||||||||||||||||||
| 169 | m_bottom = bottom; | - | ||||||||||||||||||||||||
| 170 | m_leftFP = ((left) * (1 << 16)); | - | ||||||||||||||||||||||||
| 171 | m_rightFP = ((right + 1) * (1 << 16)); | - | ||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | m_lines.reset(); | - | ||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 | m_fillRuleMask = fillRule == Qt::WindingFill
| 0 | ||||||||||||||||||||||||
| 176 | m_legacyRounding = legacyRounding; | - | ||||||||||||||||||||||||
| 177 | m_spanBuffer = spanBuffer; | - | ||||||||||||||||||||||||
| 178 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | void QScanConverter::prepareChunk() | - | ||||||||||||||||||||||||
| 181 | { | - | ||||||||||||||||||||||||
| 182 | m_size = 64; | - | ||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | allocate(64); | - | ||||||||||||||||||||||||
| 185 | memset(m_intersections, 0, 64 * sizeof(Intersection)); | - | ||||||||||||||||||||||||
| 186 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||
| 188 | void QScanConverter::emitNode(const Intersection *node) | - | ||||||||||||||||||||||||
| 189 | { | - | ||||||||||||||||||||||||
| 190 | tail_call: | - | ||||||||||||||||||||||||
| 191 | if (node->left
| 0 | ||||||||||||||||||||||||
| 192 | emitNode(node + node->left); never executed: emitNode(node + node->left); | 0 | ||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||
| 194 | if (m_winding & m_fillRuleMask
| 0 | ||||||||||||||||||||||||
| 195 | m_spanBuffer->addSpan(m_x, node->x - m_x, m_y, 0xff); never executed: m_spanBuffer->addSpan(m_x, node->x - m_x, m_y, 0xff); | 0 | ||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | m_x = node->x; | - | ||||||||||||||||||||||||
| 198 | m_winding += node->winding; | - | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | if (node->right
| 0 | ||||||||||||||||||||||||
| 201 | node += node->right; | - | ||||||||||||||||||||||||
| 202 | goto never executed: tail_call;goto tail_call;never executed: goto tail_call; | 0 | ||||||||||||||||||||||||
| 203 | } | - | ||||||||||||||||||||||||
| 204 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | void QScanConverter::emitSpans(int chunk) | - | ||||||||||||||||||||||||
| 207 | { | - | ||||||||||||||||||||||||
| 208 | for (int dy = 0; dy < 64
| 0 | ||||||||||||||||||||||||
| 209 | m_x = 0; | - | ||||||||||||||||||||||||
| 210 | m_y = chunk + dy; | - | ||||||||||||||||||||||||
| 211 | m_winding = 0; | - | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | emitNode(&m_intersections[dy]); | - | ||||||||||||||||||||||||
| 214 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 215 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | static void split(QT_FT_Vector *b) | - | ||||||||||||||||||||||||
| 220 | { | - | ||||||||||||||||||||||||
| 221 | b[6] = b[3]; | - | ||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | { | - | ||||||||||||||||||||||||
| 224 | const QT_FT_Pos temp = (b[1].x + b[2].x)/2; | - | ||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | b[1].x = (b[0].x + b[1].x)/2; | - | ||||||||||||||||||||||||
| 227 | b[5].x = (b[2].x + b[3].x)/2; | - | ||||||||||||||||||||||||
| 228 | b[2].x = (b[1].x + temp)/2; | - | ||||||||||||||||||||||||
| 229 | b[4].x = (b[5].x + temp)/2; | - | ||||||||||||||||||||||||
| 230 | b[3].x = (b[2].x + b[4].x)/2; | - | ||||||||||||||||||||||||
| 231 | } | - | ||||||||||||||||||||||||
| 232 | { | - | ||||||||||||||||||||||||
| 233 | const QT_FT_Pos temp = (b[1].y + b[2].y)/2; | - | ||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | b[1].y = (b[0].y + b[1].y)/2; | - | ||||||||||||||||||||||||
| 236 | b[5].y = (b[2].y + b[3].y)/2; | - | ||||||||||||||||||||||||
| 237 | b[2].y = (b[1].y + temp)/2; | - | ||||||||||||||||||||||||
| 238 | b[4].y = (b[5].y + temp)/2; | - | ||||||||||||||||||||||||
| 239 | b[3].y = (b[2].y + b[4].y)/2; | - | ||||||||||||||||||||||||
| 240 | } | - | ||||||||||||||||||||||||
| 241 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||
| 243 | static inline bool topOrder(const QScanConverter::Line &a, const QScanConverter::Line &b) | - | ||||||||||||||||||||||||
| 244 | { | - | ||||||||||||||||||||||||
| 245 | return never executed: a.top < b.top;return a.top < b.top;never executed: return a.top < b.top; | 0 | ||||||||||||||||||||||||
| 246 | } | - | ||||||||||||||||||||||||
| 247 | - | |||||||||||||||||||||||||
| 248 | static inline bool xOrder(const QScanConverter::Line *a, const QScanConverter::Line *b) | - | ||||||||||||||||||||||||
| 249 | { | - | ||||||||||||||||||||||||
| 250 | return never executed: a->x < b->x;return a->x < b->x;never executed: return a->x < b->x; | 0 | ||||||||||||||||||||||||
| 251 | } | - | ||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | template <bool B> | - | ||||||||||||||||||||||||
| 254 | struct QBoolToType | - | ||||||||||||||||||||||||
| 255 | { | - | ||||||||||||||||||||||||
| 256 | inline bool operator()() const | - | ||||||||||||||||||||||||
| 257 | { | - | ||||||||||||||||||||||||
| 258 | return never executed: B;return B;never executed: return B; | 0 | ||||||||||||||||||||||||
| 259 | } | - | ||||||||||||||||||||||||
| 260 | }; | - | ||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | template <typename T> | - | ||||||||||||||||||||||||
| 264 | void qScanConvert(QScanConverter &d, T allVertical) | - | ||||||||||||||||||||||||
| 265 | { | - | ||||||||||||||||||||||||
| 266 | if (!d.m_lines.size()
| 0 | ||||||||||||||||||||||||
| 267 | d.m_active.reset(); | - | ||||||||||||||||||||||||
| 268 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 269 | } | - | ||||||||||||||||||||||||
| 270 | std::sort(d.m_lines.data(), d.m_lines.data() + d.m_lines.size(), ::topOrder); | - | ||||||||||||||||||||||||
| 271 | int line = 0; | - | ||||||||||||||||||||||||
| 272 | for (int y = d.m_lines.first().top; y <= d.m_bottom
| 0 | ||||||||||||||||||||||||
| 273 | for (; line < d.m_lines.size()
| 0 | ||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||
| 275 | if (allVertical()
| 0 | ||||||||||||||||||||||||
| 276 | QScanConverter::Line *l = &d.m_lines.at(line); | - | ||||||||||||||||||||||||
| 277 | d.m_active.resize(d.m_active.size() + 1); | - | ||||||||||||||||||||||||
| 278 | int j; | - | ||||||||||||||||||||||||
| 279 | for (j = d.m_active.size() - 2; j >= 0
| 0 | ||||||||||||||||||||||||
| 280 | d.m_active.at(j+1) = d.m_active.at(j); never executed: d.m_active.at(j+1) = d.m_active.at(j); | 0 | ||||||||||||||||||||||||
| 281 | d.m_active.at(j+1) = l; | - | ||||||||||||||||||||||||
| 282 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 283 | d.m_active << &d.m_lines.at(line); | - | ||||||||||||||||||||||||
| 284 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 285 | } | - | ||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | int numActive = d.m_active.size(); | - | ||||||||||||||||||||||||
| 288 | if (!allVertical()
| 0 | ||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | for (int i = 1; i < numActive
| 0 | ||||||||||||||||||||||||
| 292 | QScanConverter::Line *l = d.m_active.at(i); | - | ||||||||||||||||||||||||
| 293 | int j; | - | ||||||||||||||||||||||||
| 294 | for (j = i-1; j >= 0
| 0 | ||||||||||||||||||||||||
| 295 | d.m_active.at(j+1) = d.m_active.at(j); never executed: d.m_active.at(j+1) = d.m_active.at(j); | 0 | ||||||||||||||||||||||||
| 296 | d.m_active.at(j+1) = l; | - | ||||||||||||||||||||||||
| 297 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 298 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||
| 300 | int x = 0; | - | ||||||||||||||||||||||||
| 301 | int winding = 0; | - | ||||||||||||||||||||||||
| 302 | for (int i = 0; i < numActive
| 0 | ||||||||||||||||||||||||
| 303 | QScanConverter::Line *node = d.m_active.at(i); | - | ||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 | const int current = ((node->x) >> 16); | - | ||||||||||||||||||||||||
| 306 | if (winding & d.m_fillRuleMask
| 0 | ||||||||||||||||||||||||
| 307 | d.m_spanBuffer->addSpan(x, current - x, y, 0xff); never executed: d.m_spanBuffer->addSpan(x, current - x, y, 0xff); | 0 | ||||||||||||||||||||||||
| 308 | - | |||||||||||||||||||||||||
| 309 | x = current; | - | ||||||||||||||||||||||||
| 310 | winding += node->winding; | - | ||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||
| 312 | if (node->bottom == y
| 0 | ||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||
| 314 | for (int j = i; j < numActive - 1
| 0 | ||||||||||||||||||||||||
| 315 | d.m_active.at(j) = d.m_active.at(j+1); never executed: d.m_active.at(j) = d.m_active.at(j+1); | 0 | ||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||
| 317 | d.m_active.resize(--numActive); | - | ||||||||||||||||||||||||
| 318 | --i; | - | ||||||||||||||||||||||||
| 319 | } never executed: else if (!allVertical()end of block
| 0 | ||||||||||||||||||||||||
| 320 | node->x += node->delta; never executed: node->x += node->delta; | 0 | ||||||||||||||||||||||||
| 321 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 322 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 323 | d.m_active.reset(); | - | ||||||||||||||||||||||||
| 324 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||
| 326 | void QScanConverter::end() | - | ||||||||||||||||||||||||
| 327 | { | - | ||||||||||||||||||||||||
| 328 | if (m_lines.isEmpty()
| 0 | ||||||||||||||||||||||||
| 329 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | if (m_lines.size() <= 32
| 0 | ||||||||||||||||||||||||
| 332 | bool allVertical = true; | - | ||||||||||||||||||||||||
| 333 | for (int i = 0; i < m_lines.size()
| 0 | ||||||||||||||||||||||||
| 334 | if (m_lines.at(i).delta
| 0 | ||||||||||||||||||||||||
| 335 | allVertical = false; | - | ||||||||||||||||||||||||
| 336 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 337 | } | - | ||||||||||||||||||||||||
| 338 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 339 | if (allVertical
| 0 | ||||||||||||||||||||||||
| 340 | qScanConvert(*this, QBoolToType<true>()); never executed: qScanConvert(*this, QBoolToType<true>()); | 0 | ||||||||||||||||||||||||
| 341 | else | - | ||||||||||||||||||||||||
| 342 | qScanConvert(*this, QBoolToType<false>()); never executed: qScanConvert(*this, QBoolToType<false>()); | 0 | ||||||||||||||||||||||||
| 343 | } else { | - | ||||||||||||||||||||||||
| 344 | for (int chunkTop = m_top; chunkTop <= m_bottom
| 0 | ||||||||||||||||||||||||
| 345 | prepareChunk(); | - | ||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | Intersection isect = { 0, 0, 0, 0 }; | - | ||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||
| 349 | const int chunkBottom = chunkTop + 64; | - | ||||||||||||||||||||||||
| 350 | for (int i = 0; i < m_lines.size()
| 0 | ||||||||||||||||||||||||
| 351 | Line &line = m_lines.at(i); | - | ||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | if ((
| 0 | ||||||||||||||||||||||||
| 354 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | const int top = qMax(0, line.top - chunkTop); | - | ||||||||||||||||||||||||
| 357 | const int bottom = qMin(64, line.bottom + 1 - chunkTop); | - | ||||||||||||||||||||||||
| 358 | allocate(m_size + bottom - top); | - | ||||||||||||||||||||||||
| 359 | - | |||||||||||||||||||||||||
| 360 | isect.winding = line.winding; | - | ||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||
| 362 | Intersection *it = m_intersections + top; | - | ||||||||||||||||||||||||
| 363 | Intersection *end = m_intersections + bottom; | - | ||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | if (line.delta
| 0 | ||||||||||||||||||||||||
| 366 | for (; it != end
| 0 | ||||||||||||||||||||||||
| 367 | isect.x = ((line.x) >> 16); | - | ||||||||||||||||||||||||
| 368 | line.x += line.delta; | - | ||||||||||||||||||||||||
| 369 | mergeIntersection(it, isect); | - | ||||||||||||||||||||||||
| 370 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 371 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 372 | isect.x = ((line.x) >> 16); | - | ||||||||||||||||||||||||
| 373 | for (; it != end
| 0 | ||||||||||||||||||||||||
| 374 | mergeIntersection(it, isect); never executed: mergeIntersection(it, isect); | 0 | ||||||||||||||||||||||||
| 375 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 376 | } | - | ||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | emitSpans(chunkTop); | - | ||||||||||||||||||||||||
| 379 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 380 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||
| 382 | if (m_alloc > 1024
| 0 | ||||||||||||||||||||||||
| 383 | free(m_intersections); | - | ||||||||||||||||||||||||
| 384 | m_alloc = 0; | - | ||||||||||||||||||||||||
| 385 | m_size = 0; | - | ||||||||||||||||||||||||
| 386 | m_intersections = 0; | - | ||||||||||||||||||||||||
| 387 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | if (m_lines.size() > 1024
| 0 | ||||||||||||||||||||||||
| 390 | m_lines.shrink(1024); never executed: m_lines.shrink(1024); | 0 | ||||||||||||||||||||||||
| 391 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | inline void QScanConverter::allocate(int size) | - | ||||||||||||||||||||||||
| 394 | { | - | ||||||||||||||||||||||||
| 395 | if (m_alloc < size
| 0 | ||||||||||||||||||||||||
| 396 | int newAlloc = qMax(size, 2 * m_alloc); | - | ||||||||||||||||||||||||
| 397 | m_intersections = q_check_ptr((Intersection *)realloc(m_intersections, newAlloc * sizeof(Intersection))); | - | ||||||||||||||||||||||||
| 398 | m_alloc = newAlloc; | - | ||||||||||||||||||||||||
| 399 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 400 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | inline void QScanConverter::mergeIntersection(Intersection *it, const Intersection &isect) | - | ||||||||||||||||||||||||
| 403 | { | - | ||||||||||||||||||||||||
| 404 | Intersection *current = it; | - | ||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | while (isect.x != current->x
| 0 | ||||||||||||||||||||||||
| 407 | int &next = isect.x < current->x
| 0 | ||||||||||||||||||||||||
| 408 | if (next
| 0 | ||||||||||||||||||||||||
| 409 | current += next; never executed: current += next; | 0 | ||||||||||||||||||||||||
| 410 | else { | - | ||||||||||||||||||||||||
| 411 | Intersection *last = m_intersections + m_size; | - | ||||||||||||||||||||||||
| 412 | next = last - current; | - | ||||||||||||||||||||||||
| 413 | *last = isect; | - | ||||||||||||||||||||||||
| 414 | ++m_size; | - | ||||||||||||||||||||||||
| 415 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 416 | } | - | ||||||||||||||||||||||||
| 417 | } | - | ||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | current->winding += isect.winding; | - | ||||||||||||||||||||||||
| 420 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | void QScanConverter::mergeCurve(const QT_FT_Vector &pa, const QT_FT_Vector &pb, | - | ||||||||||||||||||||||||
| 423 | const QT_FT_Vector &pc, const QT_FT_Vector &pd) | - | ||||||||||||||||||||||||
| 424 | { | - | ||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | QT_FT_Vector beziers[4 + 3 * 32]; | - | ||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||
| 428 | QT_FT_Vector *b = beziers; | - | ||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | b[0] = pa; | - | ||||||||||||||||||||||||
| 431 | b[1] = pb; | - | ||||||||||||||||||||||||
| 432 | b[2] = pc; | - | ||||||||||||||||||||||||
| 433 | b[3] = pd; | - | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | const QT_FT_Pos flatness = 16; | - | ||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||
| 437 | while (b >= beziers
| 0 | ||||||||||||||||||||||||
| 438 | QT_FT_Vector delta = { b[3].x - b[0].x, b[3].y - b[0].y }; | - | ||||||||||||||||||||||||
| 439 | QT_FT_Pos l = qAbs(delta.x) + qAbs(delta.y); | - | ||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||
| 441 | bool belowThreshold; | - | ||||||||||||||||||||||||
| 442 | if (l > 64
| 0 | ||||||||||||||||||||||||
| 443 | qlonglong d2 = qAbs(qlonglong(b[1].x-b[0].x) * qlonglong(delta.y) - | - | ||||||||||||||||||||||||
| 444 | qlonglong(b[1].y-b[0].y) * qlonglong(delta.x)); | - | ||||||||||||||||||||||||
| 445 | qlonglong d3 = qAbs(qlonglong(b[2].x-b[0].x) * qlonglong(delta.y) - | - | ||||||||||||||||||||||||
| 446 | qlonglong(b[2].y-b[0].y) * qlonglong(delta.x)); | - | ||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||
| 448 | qlonglong d = d2 + d3; | - | ||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||
| 450 | belowThreshold = (d <= qlonglong(flatness) * qlonglong(l)); | - | ||||||||||||||||||||||||
| 451 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 452 | QT_FT_Pos d = qAbs(b[0].x-b[1].x) + qAbs(b[0].y-b[1].y) + | - | ||||||||||||||||||||||||
| 453 | qAbs(b[0].x-b[2].x) + qAbs(b[0].y-b[2].y); | - | ||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||
| 455 | belowThreshold = (d <= flatness); | - | ||||||||||||||||||||||||
| 456 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | if (belowThreshold
| 0 | ||||||||||||||||||||||||
| 459 | mergeLine(b[0], b[3]); | - | ||||||||||||||||||||||||
| 460 | b -= 3; | - | ||||||||||||||||||||||||
| 461 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 462 | } | - | ||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||
| 464 | split(b); | - | ||||||||||||||||||||||||
| 465 | b += 3; | - | ||||||||||||||||||||||||
| 466 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 467 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||
| 469 | inline bool QScanConverter::clip(Q16Dot16 &xFP, int &iTop, int &iBottom, Q16Dot16 slopeFP, Q16Dot16 edgeFP, int winding) | - | ||||||||||||||||||||||||
| 470 | { | - | ||||||||||||||||||||||||
| 471 | bool right = edgeFP == m_rightFP; | - | ||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | if (xFP == edgeFP
| 0 | ||||||||||||||||||||||||
| 474 | if ((
| 0 | ||||||||||||||||||||||||
| 475 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 476 | else { | - | ||||||||||||||||||||||||
| 477 | Line line = { edgeFP, 0, iTop, iBottom, winding }; | - | ||||||||||||||||||||||||
| 478 | m_lines.add(line); | - | ||||||||||||||||||||||||
| 479 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 480 | } | - | ||||||||||||||||||||||||
| 481 | } | - | ||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | Q16Dot16 lastFP = xFP + slopeFP * (iBottom - iTop); | - | ||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||
| 485 | if (lastFP == edgeFP
| 0 | ||||||||||||||||||||||||
| 486 | if ((
| 0 | ||||||||||||||||||||||||
| 487 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 488 | else { | - | ||||||||||||||||||||||||
| 489 | Line line = { edgeFP, 0, iTop, iBottom, winding }; | - | ||||||||||||||||||||||||
| 490 | m_lines.add(line); | - | ||||||||||||||||||||||||
| 491 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 492 | } | - | ||||||||||||||||||||||||
| 493 | } | - | ||||||||||||||||||||||||
| 494 | - | |||||||||||||||||||||||||
| 495 | - | |||||||||||||||||||||||||
| 496 | if ((
| 0 | ||||||||||||||||||||||||
| 497 | Q16Dot16 deltaY = Q16Dot16((edgeFP - xFP) / ((slopeFP)/65536.)); | - | ||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | if ((
| 0 | ||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||
| 501 | int iHeight = ((deltaY + 1) >> 16); | - | ||||||||||||||||||||||||
| 502 | int iMiddle = iTop + iHeight; | - | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | Line line = { edgeFP, 0, iTop, iMiddle, winding }; | - | ||||||||||||||||||||||||
| 505 | m_lines.add(line); | - | ||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||
| 507 | if (iMiddle != iBottom
| 0 | ||||||||||||||||||||||||
| 508 | xFP += slopeFP * (iHeight + 1); | - | ||||||||||||||||||||||||
| 509 | iTop = iMiddle + 1; | - | ||||||||||||||||||||||||
| 510 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 511 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 512 | } else { | - | ||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | int iHeight = ((deltaY) >> 16); | - | ||||||||||||||||||||||||
| 515 | int iMiddle = iTop + iHeight; | - | ||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | if (iMiddle != iBottom
| 0 | ||||||||||||||||||||||||
| 518 | Line line = { edgeFP, 0, iMiddle + 1, iBottom, winding }; | - | ||||||||||||||||||||||||
| 519 | m_lines.add(line); | - | ||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||
| 521 | iBottom = iMiddle; | - | ||||||||||||||||||||||||
| 522 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 523 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 524 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 525 | } else if ((
| 0 | ||||||||||||||||||||||||
| 526 | Line line = { edgeFP, 0, iTop, iBottom, winding }; | - | ||||||||||||||||||||||||
| 527 | m_lines.add(line); | - | ||||||||||||||||||||||||
| 528 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 529 | } | - | ||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||
| 531 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 532 | } | - | ||||||||||||||||||||||||
| 533 | - | |||||||||||||||||||||||||
| 534 | void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b) | - | ||||||||||||||||||||||||
| 535 | { | - | ||||||||||||||||||||||||
| 536 | int winding = 1; | - | ||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||
| 538 | if (a.y > b.y
| 0 | ||||||||||||||||||||||||
| 539 | qSwap(a, b); | - | ||||||||||||||||||||||||
| 540 | winding = -1; | - | ||||||||||||||||||||||||
| 541 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||
| 543 | if (m_legacyRounding
| 0 | ||||||||||||||||||||||||
| 544 | a.x += 32; | - | ||||||||||||||||||||||||
| 545 | a.y += 32; | - | ||||||||||||||||||||||||
| 546 | b.x += 32; | - | ||||||||||||||||||||||||
| 547 | b.y += 32; | - | ||||||||||||||||||||||||
| 548 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||
| 550 | int rounding = m_legacyRounding
| 0 | ||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||
| 552 | int iTop = qMax(m_top, int((a.y + 32 - rounding) >> 6)); | - | ||||||||||||||||||||||||
| 553 | int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6)); | - | ||||||||||||||||||||||||
| 554 | - | |||||||||||||||||||||||||
| 555 | if (iTop <= iBottom
| 0 | ||||||||||||||||||||||||
| 556 | Q16Dot16 aFP = 65536/2 + (a.x * (1 << 10)) - rounding; | - | ||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | if (b.x == a.x
| 0 | ||||||||||||||||||||||||
| 559 | Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding }; | - | ||||||||||||||||||||||||
| 560 | m_lines.add(line); | - | ||||||||||||||||||||||||
| 561 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 562 | const qreal slope = (b.x - a.x) / qreal(b.y - a.y); | - | ||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||
| 564 | const Q16Dot16 slopeFP = (int)((slope) * 65536.); | - | ||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||
| 566 | Q16Dot16 xFP = aFP + (int)((qlonglong(slopeFP) * qlonglong(((iTop) * (1 << 16)) + 65536/2 - (a.y * (1 << 10)))) >> 16) | - | ||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||
| 568 | ; | - | ||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||
| 570 | if (clip(xFP, iTop, iBottom, slopeFP, m_leftFP, winding)
| 0 | ||||||||||||||||||||||||
| 571 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||
| 573 | if (clip(xFP, iTop, iBottom, slopeFP, m_rightFP, winding)
| 0 | ||||||||||||||||||||||||
| 574 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 575 | - | |||||||||||||||||||||||||
| 576 | ((!(xFP >= m_leftFP)) ? qt_assert("xFP >= m_leftFP",__FILE__,635) : qt_noop()); | - | ||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||
| 578 | Line line = { xFP, slopeFP, iTop, iBottom, winding }; | - | ||||||||||||||||||||||||
| 579 | m_lines.add(line); | - | ||||||||||||||||||||||||
| 580 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 581 | } | - | ||||||||||||||||||||||||
| 582 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||
| 584 | QRasterizer::QRasterizer() | - | ||||||||||||||||||||||||
| 585 | : d(new QRasterizerPrivate) | - | ||||||||||||||||||||||||
| 586 | { | - | ||||||||||||||||||||||||
| 587 | d->legacyRounding = false; | - | ||||||||||||||||||||||||
| 588 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | QRasterizer::~QRasterizer() | - | ||||||||||||||||||||||||
| 591 | { | - | ||||||||||||||||||||||||
| 592 | delete d; | - | ||||||||||||||||||||||||
| 593 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 594 | - | |||||||||||||||||||||||||
| 595 | void QRasterizer::setAntialiased(bool antialiased) | - | ||||||||||||||||||||||||
| 596 | { | - | ||||||||||||||||||||||||
| 597 | d->antialiased = antialiased; | - | ||||||||||||||||||||||||
| 598 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | void QRasterizer::initialize(ProcessSpans blend, void *data) | - | ||||||||||||||||||||||||
| 601 | { | - | ||||||||||||||||||||||||
| 602 | d->blend = blend; | - | ||||||||||||||||||||||||
| 603 | d->data = data; | - | ||||||||||||||||||||||||
| 604 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||
| 606 | void QRasterizer::setClipRect(const QRect &clipRect) | - | ||||||||||||||||||||||||
| 607 | { | - | ||||||||||||||||||||||||
| 608 | d->clipRect = clipRect; | - | ||||||||||||||||||||||||
| 609 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||
| 611 | void QRasterizer::setLegacyRoundingEnabled(bool legacyRoundingEnabled) | - | ||||||||||||||||||||||||
| 612 | { | - | ||||||||||||||||||||||||
| 613 | d->legacyRounding = legacyRoundingEnabled; | - | ||||||||||||||||||||||||
| 614 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||
| 616 | static Q16Dot16 intersectPixelFP(int x, Q16Dot16 top, Q16Dot16 bottom, Q16Dot16 leftIntersectX, Q16Dot16 rightIntersectX, Q16Dot16 slope, Q16Dot16 invSlope) | - | ||||||||||||||||||||||||
| 617 | { | - | ||||||||||||||||||||||||
| 618 | Q16Dot16 leftX = ((x) * (1 << 16)); | - | ||||||||||||||||||||||||
| 619 | Q16Dot16 rightX = ((x) * (1 << 16)) + 65536; | - | ||||||||||||||||||||||||
| 620 | - | |||||||||||||||||||||||||
| 621 | Q16Dot16 leftIntersectY, rightIntersectY; | - | ||||||||||||||||||||||||
| 622 | if (slope > 0
| 0 | ||||||||||||||||||||||||
| 623 | leftIntersectY = top + (int)((qlonglong(leftX - leftIntersectX) * qlonglong(invSlope)) >> 16); | - | ||||||||||||||||||||||||
| 624 | rightIntersectY = leftIntersectY + invSlope; | - | ||||||||||||||||||||||||
| 625 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 626 | leftIntersectY = top + (int)((qlonglong(leftX - rightIntersectX) * qlonglong(invSlope)) >> 16); | - | ||||||||||||||||||||||||
| 627 | rightIntersectY = leftIntersectY + invSlope; | - | ||||||||||||||||||||||||
| 628 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||
| 630 | if (leftIntersectX >= leftX
| 0 | ||||||||||||||||||||||||
| 631 | return never executed: (int)((qlonglong(bottom - top) * qlonglong(leftIntersectX - leftX + ((rightIntersectX - leftIntersectX) >> 1))) >> 16);return (int)((qlonglong(bottom - top) * qlonglong(leftIntersectX - leftX + ((rightIntersectX - leftIntersectX) >> 1))) >> 16);never executed: return (int)((qlonglong(bottom - top) * qlonglong(leftIntersectX - leftX + ((rightIntersectX - leftIntersectX) >> 1))) >> 16); | 0 | ||||||||||||||||||||||||
| 632 | } else if (leftIntersectX >= rightX
| 0 | ||||||||||||||||||||||||
| 633 | return never executed: bottom - top;return bottom - top;never executed: return bottom - top; | 0 | ||||||||||||||||||||||||
| 634 | } else if (leftIntersectX >= leftX
| 0 | ||||||||||||||||||||||||
| 635 | if (slope > 0
| 0 | ||||||||||||||||||||||||
| 636 | return never executed: (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (rightIntersectY - top)) >> 16);return (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (rightIntersectY - top)) >> 16);never executed: return (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (rightIntersectY - top)) >> 16); | 0 | ||||||||||||||||||||||||
| 637 | } else { | - | ||||||||||||||||||||||||
| 638 | return never executed: (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (bottom - rightIntersectY)) >> 16);return (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (bottom - rightIntersectY)) >> 16);never executed: return (bottom - top) - ((((rightX - leftIntersectX) >> 1) * (bottom - rightIntersectY)) >> 16); | 0 | ||||||||||||||||||||||||
| 639 | } | - | ||||||||||||||||||||||||
| 640 | } else if (rightIntersectX <= leftX
| 0 | ||||||||||||||||||||||||
| 641 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 642 | } else if (rightIntersectX <= rightX
| 0 | ||||||||||||||||||||||||
| 643 | if (slope > 0
| 0 | ||||||||||||||||||||||||
| 644 | return never executed: ((((rightIntersectX - leftX) >> 1) * (bottom - leftIntersectY)) >> 16);return ((((rightIntersectX - leftX) >> 1) * (bottom - leftIntersectY)) >> 16);never executed: return ((((rightIntersectX - leftX) >> 1) * (bottom - leftIntersectY)) >> 16); | 0 | ||||||||||||||||||||||||
| 645 | } else { | - | ||||||||||||||||||||||||
| 646 | return never executed: ((((rightIntersectX - leftX) >> 1) * (leftIntersectY - top)) >> 16);return ((((rightIntersectX - leftX) >> 1) * (leftIntersectY - top)) >> 16);never executed: return ((((rightIntersectX - leftX) >> 1) * (leftIntersectY - top)) >> 16); | 0 | ||||||||||||||||||||||||
| 647 | } | - | ||||||||||||||||||||||||
| 648 | } else { | - | ||||||||||||||||||||||||
| 649 | if (slope > 0
| 0 | ||||||||||||||||||||||||
| 650 | return never executed: (bottom - rightIntersectY) + ((rightIntersectY - leftIntersectY) >> 1);return (bottom - rightIntersectY) + ((rightIntersectY - leftIntersectY) >> 1);never executed: return (bottom - rightIntersectY) + ((rightIntersectY - leftIntersectY) >> 1); | 0 | ||||||||||||||||||||||||
| 651 | } else { | - | ||||||||||||||||||||||||
| 652 | return never executed: (rightIntersectY - top) + ((leftIntersectY - rightIntersectY) >> 1);return (rightIntersectY - top) + ((leftIntersectY - rightIntersectY) >> 1);never executed: return (rightIntersectY - top) + ((leftIntersectY - rightIntersectY) >> 1); | 0 | ||||||||||||||||||||||||
| 653 | } | - | ||||||||||||||||||||||||
| 654 | } | - | ||||||||||||||||||||||||
| 655 | } | - | ||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||
| 657 | static inline bool q26Dot6Compare(qreal p1, qreal p2) | - | ||||||||||||||||||||||||
| 658 | { | - | ||||||||||||||||||||||||
| 659 | return never executed: int((p2 - p1) * 64.) == 0;return int((p2 - p1) * 64.) == 0;never executed: return int((p2 - p1) * 64.) == 0; | 0 | ||||||||||||||||||||||||
| 660 | } | - | ||||||||||||||||||||||||
| 661 | - | |||||||||||||||||||||||||
| 662 | static inline QPointF snapTo26Dot6Grid(const QPointF &p) | - | ||||||||||||||||||||||||
| 663 | { | - | ||||||||||||||||||||||||
| 664 | return never executed: QPointF(std::floor(p.x() * 64) * (1 / qreal(64)),return QPointF(std::floor(p.x() * 64) * (1 / qreal(64)), std::floor(p.y() * 64) * (1 / qreal(64)));never executed: return QPointF(std::floor(p.x() * 64) * (1 / qreal(64)), std::floor(p.y() * 64) * (1 / qreal(64))); | 0 | ||||||||||||||||||||||||
| 665 | std::floor(p.y() * 64) * (1 / qreal(64))); never executed: return QPointF(std::floor(p.x() * 64) * (1 / qreal(64)), std::floor(p.y() * 64) * (1 / qreal(64))); | 0 | ||||||||||||||||||||||||
| 666 | } | - | ||||||||||||||||||||||||
| 667 | static inline qreal qSafeDivide(qreal x, qreal y) | - | ||||||||||||||||||||||||
| 668 | { | - | ||||||||||||||||||||||||
| 669 | if (y == 0
| 0 | ||||||||||||||||||||||||
| 670 | return never executed: x > 0 ? 1e20 : -1e20;return x > 0 ? 1e20 : -1e20;never executed: return x > 0 ? 1e20 : -1e20; | 0 | ||||||||||||||||||||||||
| 671 | return never executed: x / y;return x / y;never executed: return x / y; | 0 | ||||||||||||||||||||||||
| 672 | } | - | ||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||
| 675 | - | |||||||||||||||||||||||||
| 676 | - | |||||||||||||||||||||||||
| 677 | - | |||||||||||||||||||||||||
| 678 | static inline int qSafeFloatToQ16Dot16(qreal x) | - | ||||||||||||||||||||||||
| 679 | { | - | ||||||||||||||||||||||||
| 680 | qreal tmp = x * 65536.; | - | ||||||||||||||||||||||||
| 681 | if (tmp > qreal(2147483647)
| 0 | ||||||||||||||||||||||||
| 682 | return never executed: 2147483647;return 2147483647;never executed: return 2147483647; | 0 | ||||||||||||||||||||||||
| 683 | else if (tmp < qreal((-2147483647 - 1))
| 0 | ||||||||||||||||||||||||
| 684 | return never executed: -2147483647;return -2147483647;never executed: return -2147483647; | 0 | ||||||||||||||||||||||||
| 685 | return never executed: int(tmp);return int(tmp);never executed: return int(tmp); | 0 | ||||||||||||||||||||||||
| 686 | } | - | ||||||||||||||||||||||||
| 687 | - | |||||||||||||||||||||||||
| 688 | void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) | - | ||||||||||||||||||||||||
| 689 | { | - | ||||||||||||||||||||||||
| 690 | if (a == b
| 0 | ||||||||||||||||||||||||
| 691 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 692 | - | |||||||||||||||||||||||||
| 693 | ((!(width > 0.0)) ? qt_assert("width > 0.0",__FILE__,761) : qt_noop()); | - | ||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||
| 695 | QPointF pa = a; | - | ||||||||||||||||||||||||
| 696 | QPointF pb = b; | - | ||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||
| 698 | if (squareCap
| 0 | ||||||||||||||||||||||||
| 699 | QPointF delta = pb - pa; | - | ||||||||||||||||||||||||
| 700 | pa -= (0.5f * width) * delta; | - | ||||||||||||||||||||||||
| 701 | pb += (0.5f * width) * delta; | - | ||||||||||||||||||||||||
| 702 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 703 | - | |||||||||||||||||||||||||
| 704 | QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; | - | ||||||||||||||||||||||||
| 705 | const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs); | - | ||||||||||||||||||||||||
| 706 | - | |||||||||||||||||||||||||
| 707 | if (!clip.contains(pa)
| 0 | ||||||||||||||||||||||||
| 708 | qreal t1 = 0; | - | ||||||||||||||||||||||||
| 709 | qreal t2 = 1; | - | ||||||||||||||||||||||||
| 710 | - | |||||||||||||||||||||||||
| 711 | const qreal o[2] = { pa.x(), pa.y() }; | - | ||||||||||||||||||||||||
| 712 | const qreal d[2] = { pb.x() - pa.x(), pb.y() - pa.y() }; | - | ||||||||||||||||||||||||
| 713 | - | |||||||||||||||||||||||||
| 714 | const qreal low[2] = { clip.left(), clip.top() }; | - | ||||||||||||||||||||||||
| 715 | const qreal high[2] = { clip.right(), clip.bottom() }; | - | ||||||||||||||||||||||||
| 716 | - | |||||||||||||||||||||||||
| 717 | for (int i = 0; i < 2
| 0 | ||||||||||||||||||||||||
| 718 | if (d[i] == 0
| 0 | ||||||||||||||||||||||||
| 719 | if (o[i] <= low[i]
| 0 | ||||||||||||||||||||||||
| 720 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 721 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 722 | } | - | ||||||||||||||||||||||||
| 723 | const qreal d_inv = 1 / d[i]; | - | ||||||||||||||||||||||||
| 724 | qreal t_low = (low[i] - o[i]) * d_inv; | - | ||||||||||||||||||||||||
| 725 | qreal t_high = (high[i] - o[i]) * d_inv; | - | ||||||||||||||||||||||||
| 726 | if (t_low > t_high
| 0 | ||||||||||||||||||||||||
| 727 | qSwap(t_low, t_high); never executed: qSwap(t_low, t_high); | 0 | ||||||||||||||||||||||||
| 728 | if (t1 < t_low
| 0 | ||||||||||||||||||||||||
| 729 | t1 = t_low; never executed: t1 = t_low; | 0 | ||||||||||||||||||||||||
| 730 | if (t2 > t_high
| 0 | ||||||||||||||||||||||||
| 731 | t2 = t_high; never executed: t2 = t_high; | 0 | ||||||||||||||||||||||||
| 732 | if (t1 >= t2
| 0 | ||||||||||||||||||||||||
| 733 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 734 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||
| 736 | QPointF npa = pa + (pb - pa) * t1; | - | ||||||||||||||||||||||||
| 737 | QPointF npb = pa + (pb - pa) * t2; | - | ||||||||||||||||||||||||
| 738 | - | |||||||||||||||||||||||||
| 739 | pa = npa; | - | ||||||||||||||||||||||||
| 740 | pb = npb; | - | ||||||||||||||||||||||||
| 741 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||
| 743 | if (!d->antialiased
| 0 | ||||||||||||||||||||||||
| 744 | pa.rx() += (32 - 1)/64.; | - | ||||||||||||||||||||||||
| 745 | pa.ry() += (32 - 1)/64.; | - | ||||||||||||||||||||||||
| 746 | pb.rx() += (32 - 1)/64.; | - | ||||||||||||||||||||||||
| 747 | pb.ry() += (32 - 1)/64.; | - | ||||||||||||||||||||||||
| 748 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 749 | - | |||||||||||||||||||||||||
| 750 | { | - | ||||||||||||||||||||||||
| 751 | - | |||||||||||||||||||||||||
| 752 | const QPointF d0 = a - b; | - | ||||||||||||||||||||||||
| 753 | const qreal w0 = d0.x() * d0.x() + d0.y() * d0.y(); | - | ||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||
| 756 | const QPointF d = pa - pb; | - | ||||||||||||||||||||||||
| 757 | const qreal w = d.x() * d.x() + d.y() * d.y(); | - | ||||||||||||||||||||||||
| 758 | - | |||||||||||||||||||||||||
| 759 | if (w == 0
| 0 | ||||||||||||||||||||||||
| 760 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||
| 762 | - | |||||||||||||||||||||||||
| 763 | width *= qSqrt(w0 / w); | - | ||||||||||||||||||||||||
| 764 | } | - | ||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||
| 766 | QSpanBuffer buffer(d->blend, d->data, d->clipRect); | - | ||||||||||||||||||||||||
| 767 | - | |||||||||||||||||||||||||
| 768 | if (q26Dot6Compare(pa.y(), pb.y())
| 0 | ||||||||||||||||||||||||
| 769 | const qreal x = (pa.x() + pb.x()) * 0.5f; | - | ||||||||||||||||||||||||
| 770 | const qreal dx = qAbs(pb.x() - pa.x()) * 0.5f; | - | ||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||
| 772 | const qreal y = pa.y(); | - | ||||||||||||||||||||||||
| 773 | const qreal dy = width * dx; | - | ||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||
| 775 | pa = QPointF(x, y - dy); | - | ||||||||||||||||||||||||
| 776 | pb = QPointF(x, y + dy); | - | ||||||||||||||||||||||||
| 777 | - | |||||||||||||||||||||||||
| 778 | width = 1 / width; | - | ||||||||||||||||||||||||
| 779 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||
| 781 | if (q26Dot6Compare(pa.x(), pb.x())
| 0 | ||||||||||||||||||||||||
| 782 | if (pa.y() > pb.y()
| 0 | ||||||||||||||||||||||||
| 783 | qSwap(pa, pb); never executed: qSwap(pa, pb); | 0 | ||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||
| 785 | const qreal dy = pb.y() - pa.y(); | - | ||||||||||||||||||||||||
| 786 | const qreal halfWidth = 0.5f * width * dy; | - | ||||||||||||||||||||||||
| 787 | - | |||||||||||||||||||||||||
| 788 | qreal left = pa.x() - halfWidth; | - | ||||||||||||||||||||||||
| 789 | qreal right = pa.x() + halfWidth; | - | ||||||||||||||||||||||||
| 790 | - | |||||||||||||||||||||||||
| 791 | left = qBound(qreal(d->clipRect.left()), left, qreal(d->clipRect.right() + 1)); | - | ||||||||||||||||||||||||
| 792 | right = qBound(qreal(d->clipRect.left()), right, qreal(d->clipRect.right() + 1)); | - | ||||||||||||||||||||||||
| 793 | - | |||||||||||||||||||||||||
| 794 | pa.ry() = qBound(qreal(d->clipRect.top()), pa.y(), qreal(d->clipRect.bottom() + 1)); | - | ||||||||||||||||||||||||
| 795 | pb.ry() = qBound(qreal(d->clipRect.top()), pb.y(), qreal(d->clipRect.bottom() + 1)); | - | ||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||
| 797 | if (q26Dot6Compare(left, right)
| 0 | ||||||||||||||||||||||||
| 798 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 799 | - | |||||||||||||||||||||||||
| 800 | if (d->antialiased
| 0 | ||||||||||||||||||||||||
| 801 | const Q16Dot16 iLeft = int(left); | - | ||||||||||||||||||||||||
| 802 | const Q16Dot16 iRight = int(right); | - | ||||||||||||||||||||||||
| 803 | const Q16Dot16 leftWidth = ((iLeft + 1) * (1 << 16)) | - | ||||||||||||||||||||||||
| 804 | - qSafeFloatToQ16Dot16(left); | - | ||||||||||||||||||||||||
| 805 | const Q16Dot16 rightWidth = qSafeFloatToQ16Dot16(right) | - | ||||||||||||||||||||||||
| 806 | - ((iRight) * (1 << 16)); | - | ||||||||||||||||||||||||
| 807 | - | |||||||||||||||||||||||||
| 808 | Q16Dot16 coverage[3]; | - | ||||||||||||||||||||||||
| 809 | int x[3]; | - | ||||||||||||||||||||||||
| 810 | int len[3]; | - | ||||||||||||||||||||||||
| 811 | - | |||||||||||||||||||||||||
| 812 | int n = 1; | - | ||||||||||||||||||||||||
| 813 | if (iLeft == iRight
| 0 | ||||||||||||||||||||||||
| 814 | coverage[0] = (leftWidth + rightWidth) * 255; | - | ||||||||||||||||||||||||
| 815 | x[0] = iLeft; | - | ||||||||||||||||||||||||
| 816 | len[0] = 1; | - | ||||||||||||||||||||||||
| 817 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 818 | coverage[0] = leftWidth * 255; | - | ||||||||||||||||||||||||
| 819 | x[0] = iLeft; | - | ||||||||||||||||||||||||
| 820 | len[0] = 1; | - | ||||||||||||||||||||||||
| 821 | if (leftWidth == 65536
| 0 | ||||||||||||||||||||||||
| 822 | len[0] = iRight - iLeft; | - | ||||||||||||||||||||||||
| 823 | } never executed: else if (iRight - iLeft > 1end of block
| 0 | ||||||||||||||||||||||||
| 824 | coverage[1] = ((255) * (1 << 16)); | - | ||||||||||||||||||||||||
| 825 | x[1] = iLeft + 1; | - | ||||||||||||||||||||||||
| 826 | len[1] = iRight - iLeft - 1; | - | ||||||||||||||||||||||||
| 827 | ++n; | - | ||||||||||||||||||||||||
| 828 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 829 | if (rightWidth
| 0 | ||||||||||||||||||||||||
| 830 | coverage[n] = rightWidth * 255; | - | ||||||||||||||||||||||||
| 831 | x[n] = iRight; | - | ||||||||||||||||||||||||
| 832 | len[n] = 1; | - | ||||||||||||||||||||||||
| 833 | ++n; | - | ||||||||||||||||||||||||
| 834 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 835 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 836 | - | |||||||||||||||||||||||||
| 837 | const Q16Dot16 iTopFP = ((int(pa.y())) * (1 << 16)); | - | ||||||||||||||||||||||||
| 838 | const Q16Dot16 iBottomFP = ((int(pb.y())) * (1 << 16)); | - | ||||||||||||||||||||||||
| 839 | const Q16Dot16 yPa = qSafeFloatToQ16Dot16(pa.y()); | - | ||||||||||||||||||||||||
| 840 | const Q16Dot16 yPb = qSafeFloatToQ16Dot16(pb.y()); | - | ||||||||||||||||||||||||
| 841 | for (Q16Dot16 yFP = iTopFP; yFP <= iBottomFP
| 0 | ||||||||||||||||||||||||
| 842 | const Q16Dot16 rowHeight = qMin(yFP + 65536, yPb) | - | ||||||||||||||||||||||||
| 843 | - qMax(yFP, yPa); | - | ||||||||||||||||||||||||
| 844 | const int y = ((yFP) >> 16); | - | ||||||||||||||||||||||||
| 845 | if (y > d->clipRect.bottom()
| 0 | ||||||||||||||||||||||||
| 846 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 847 | for (int i = 0; i < n
| 0 | ||||||||||||||||||||||||
| 848 | buffer.addSpan(x[i], len[i], y, | - | ||||||||||||||||||||||||
| 849 | (((int)((qlonglong(rowHeight) * qlonglong(coverage[i])) >> 16)) >> 16)); | - | ||||||||||||||||||||||||
| 850 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 851 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 852 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 853 | int iTop = int(pa.y() + 0.5f); | - | ||||||||||||||||||||||||
| 854 | int iBottom = pb.y() < 0.5f
| 0 | ||||||||||||||||||||||||
| 855 | int iLeft = int(left + 0.5f); | - | ||||||||||||||||||||||||
| 856 | int iRight = right < 0.5f
| 0 | ||||||||||||||||||||||||
| 857 | - | |||||||||||||||||||||||||
| 858 | int iWidth = iRight - iLeft + 1; | - | ||||||||||||||||||||||||
| 859 | for (int y = iTop; y <= iBottom
| 0 | ||||||||||||||||||||||||
| 860 | buffer.addSpan(iLeft, iWidth, y, 255); never executed: buffer.addSpan(iLeft, iWidth, y, 255); | 0 | ||||||||||||||||||||||||
| 861 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 862 | } else { | - | ||||||||||||||||||||||||
| 863 | if (pa.y() > pb.y()
| 0 | ||||||||||||||||||||||||
| 864 | qSwap(pa, pb); never executed: qSwap(pa, pb); | 0 | ||||||||||||||||||||||||
| 865 | - | |||||||||||||||||||||||||
| 866 | QPointF delta = pb - pa; | - | ||||||||||||||||||||||||
| 867 | delta *= 0.5f * width; | - | ||||||||||||||||||||||||
| 868 | const QPointF perp(delta.y(), -delta.x()); | - | ||||||||||||||||||||||||
| 869 | - | |||||||||||||||||||||||||
| 870 | QPointF top; | - | ||||||||||||||||||||||||
| 871 | QPointF left; | - | ||||||||||||||||||||||||
| 872 | QPointF right; | - | ||||||||||||||||||||||||
| 873 | QPointF bottom; | - | ||||||||||||||||||||||||
| 874 | - | |||||||||||||||||||||||||
| 875 | if (pa.x() < pb.x()
| 0 | ||||||||||||||||||||||||
| 876 | top = pa + perp; | - | ||||||||||||||||||||||||
| 877 | left = pa - perp; | - | ||||||||||||||||||||||||
| 878 | right = pb + perp; | - | ||||||||||||||||||||||||
| 879 | bottom = pb - perp; | - | ||||||||||||||||||||||||
| 880 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 881 | top = pa - perp; | - | ||||||||||||||||||||||||
| 882 | left = pb - perp; | - | ||||||||||||||||||||||||
| 883 | right = pa + perp; | - | ||||||||||||||||||||||||
| 884 | bottom = pb + perp; | - | ||||||||||||||||||||||||
| 885 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 886 | - | |||||||||||||||||||||||||
| 887 | top = snapTo26Dot6Grid(top); | - | ||||||||||||||||||||||||
| 888 | bottom = snapTo26Dot6Grid(bottom); | - | ||||||||||||||||||||||||
| 889 | left = snapTo26Dot6Grid(left); | - | ||||||||||||||||||||||||
| 890 | right = snapTo26Dot6Grid(right); | - | ||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||
| 892 | const qreal topBound = qBound(qreal(d->clipRect.top()), top.y(), qreal(d->clipRect.bottom())); | - | ||||||||||||||||||||||||
| 893 | const qreal bottomBound = qBound(qreal(d->clipRect.top()), bottom.y(), qreal(d->clipRect.bottom())); | - | ||||||||||||||||||||||||
| 894 | - | |||||||||||||||||||||||||
| 895 | const QPointF topLeftEdge = left - top; | - | ||||||||||||||||||||||||
| 896 | const QPointF topRightEdge = right - top; | - | ||||||||||||||||||||||||
| 897 | const QPointF bottomLeftEdge = bottom - left; | - | ||||||||||||||||||||||||
| 898 | const QPointF bottomRightEdge = bottom - right; | - | ||||||||||||||||||||||||
| 899 | - | |||||||||||||||||||||||||
| 900 | const qreal topLeftSlope = qSafeDivide(topLeftEdge.x(), topLeftEdge.y()); | - | ||||||||||||||||||||||||
| 901 | const qreal bottomLeftSlope = qSafeDivide(bottomLeftEdge.x(), bottomLeftEdge.y()); | - | ||||||||||||||||||||||||
| 902 | - | |||||||||||||||||||||||||
| 903 | const qreal topRightSlope = qSafeDivide(topRightEdge.x(), topRightEdge.y()); | - | ||||||||||||||||||||||||
| 904 | const qreal bottomRightSlope = qSafeDivide(bottomRightEdge.x(), bottomRightEdge.y()); | - | ||||||||||||||||||||||||
| 905 | - | |||||||||||||||||||||||||
| 906 | const Q16Dot16 topLeftSlopeFP = qSafeFloatToQ16Dot16(topLeftSlope); | - | ||||||||||||||||||||||||
| 907 | const Q16Dot16 topRightSlopeFP = qSafeFloatToQ16Dot16(topRightSlope); | - | ||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||
| 909 | const Q16Dot16 bottomLeftSlopeFP = qSafeFloatToQ16Dot16(bottomLeftSlope); | - | ||||||||||||||||||||||||
| 910 | const Q16Dot16 bottomRightSlopeFP = qSafeFloatToQ16Dot16(bottomRightSlope); | - | ||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||
| 912 | const Q16Dot16 invTopLeftSlopeFP = qSafeFloatToQ16Dot16(qSafeDivide(1, topLeftSlope)); | - | ||||||||||||||||||||||||
| 913 | const Q16Dot16 invTopRightSlopeFP = qSafeFloatToQ16Dot16(qSafeDivide(1, topRightSlope)); | - | ||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||
| 915 | const Q16Dot16 invBottomLeftSlopeFP = qSafeFloatToQ16Dot16(qSafeDivide(1, bottomLeftSlope)); | - | ||||||||||||||||||||||||
| 916 | const Q16Dot16 invBottomRightSlopeFP = qSafeFloatToQ16Dot16(qSafeDivide(1, bottomRightSlope)); | - | ||||||||||||||||||||||||
| 917 | - | |||||||||||||||||||||||||
| 918 | if (d->antialiased
| 0 | ||||||||||||||||||||||||
| 919 | const Q16Dot16 iTopFP = ((int(topBound)) * (1 << 16)); | - | ||||||||||||||||||||||||
| 920 | const Q16Dot16 iLeftFP = ((int(left.y())) * (1 << 16)); | - | ||||||||||||||||||||||||
| 921 | const Q16Dot16 iRightFP = ((int(right.y())) * (1 << 16)); | - | ||||||||||||||||||||||||
| 922 | const Q16Dot16 iBottomFP = ((int(bottomBound)) * (1 << 16)); | - | ||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||
| 924 | Q16Dot16 leftIntersectAf = qSafeFloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topLeftSlope); | - | ||||||||||||||||||||||||
| 925 | Q16Dot16 rightIntersectAf = qSafeFloatToQ16Dot16(top.x() + (int(topBound) - top.y()) * topRightSlope); | - | ||||||||||||||||||||||||
| 926 | Q16Dot16 leftIntersectBf = 0; | - | ||||||||||||||||||||||||
| 927 | Q16Dot16 rightIntersectBf = 0; | - | ||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||
| 929 | if (iLeftFP < iTopFP
| 0 | ||||||||||||||||||||||||
| 930 | leftIntersectBf = qSafeFloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * bottomLeftSlope); never executed: leftIntersectBf = qSafeFloatToQ16Dot16(left.x() + (int(topBound) - left.y()) * bottomLeftSlope); | 0 | ||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||
| 932 | if (iRightFP < iTopFP
| 0 | ||||||||||||||||||||||||
| 933 | rightIntersectBf = qSafeFloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * bottomRightSlope); never executed: rightIntersectBf = qSafeFloatToQ16Dot16(right.x() + (int(topBound) - right.y()) * bottomRightSlope); | 0 | ||||||||||||||||||||||||
| 934 | - | |||||||||||||||||||||||||
| 935 | Q16Dot16 rowTop, rowBottomLeft, rowBottomRight, rowTopLeft, rowTopRight, rowBottom; | - | ||||||||||||||||||||||||
| 936 | Q16Dot16 topLeftIntersectAf, topLeftIntersectBf, topRightIntersectAf, topRightIntersectBf; | - | ||||||||||||||||||||||||
| 937 | Q16Dot16 bottomLeftIntersectAf, bottomLeftIntersectBf, bottomRightIntersectAf, bottomRightIntersectBf; | - | ||||||||||||||||||||||||
| 938 | - | |||||||||||||||||||||||||
| 939 | int leftMin, leftMax, rightMin, rightMax; | - | ||||||||||||||||||||||||
| 940 | - | |||||||||||||||||||||||||
| 941 | const Q16Dot16 yTopFP = qSafeFloatToQ16Dot16(top.y()); | - | ||||||||||||||||||||||||
| 942 | const Q16Dot16 yLeftFP = qSafeFloatToQ16Dot16(left.y()); | - | ||||||||||||||||||||||||
| 943 | const Q16Dot16 yRightFP = qSafeFloatToQ16Dot16(right.y()); | - | ||||||||||||||||||||||||
| 944 | const Q16Dot16 yBottomFP = qSafeFloatToQ16Dot16(bottom.y()); | - | ||||||||||||||||||||||||
| 945 | - | |||||||||||||||||||||||||
| 946 | rowTop = qMax(iTopFP, yTopFP); | - | ||||||||||||||||||||||||
| 947 | topLeftIntersectAf = leftIntersectAf + | - | ||||||||||||||||||||||||
| 948 | (int)((qlonglong(topLeftSlopeFP) * qlonglong(rowTop - iTopFP)) >> 16); | - | ||||||||||||||||||||||||
| 949 | topRightIntersectAf = rightIntersectAf + | - | ||||||||||||||||||||||||
| 950 | (int)((qlonglong(topRightSlopeFP) * qlonglong(rowTop - iTopFP)) >> 16); | - | ||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||
| 952 | Q16Dot16 yFP = iTopFP; | - | ||||||||||||||||||||||||
| 953 | while (yFP <= iBottomFP
| 0 | ||||||||||||||||||||||||
| 954 | rowBottomLeft = qMin(yFP + 65536, yLeftFP); | - | ||||||||||||||||||||||||
| 955 | rowBottomRight = qMin(yFP + 65536, yRightFP); | - | ||||||||||||||||||||||||
| 956 | rowTopLeft = qMax(yFP, yLeftFP); | - | ||||||||||||||||||||||||
| 957 | rowTopRight = qMax(yFP, yRightFP); | - | ||||||||||||||||||||||||
| 958 | rowBottom = qMin(yFP + 65536, yBottomFP); | - | ||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||
| 960 | if (yFP == iLeftFP
| 0 | ||||||||||||||||||||||||
| 961 | const int y = ((yFP) >> 16); | - | ||||||||||||||||||||||||
| 962 | leftIntersectBf = qSafeFloatToQ16Dot16(left.x() + (y - left.y()) * bottomLeftSlope); | - | ||||||||||||||||||||||||
| 963 | topLeftIntersectBf = leftIntersectBf + (int)((qlonglong(bottomLeftSlopeFP) * qlonglong(rowTopLeft - yFP)) >> 16); | - | ||||||||||||||||||||||||
| 964 | bottomLeftIntersectAf = leftIntersectAf + (int)((qlonglong(topLeftSlopeFP) * qlonglong(rowBottomLeft - yFP)) >> 16); | - | ||||||||||||||||||||||||
| 965 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 966 | topLeftIntersectBf = leftIntersectBf; | - | ||||||||||||||||||||||||
| 967 | bottomLeftIntersectAf = leftIntersectAf + topLeftSlopeFP; | - | ||||||||||||||||||||||||
| 968 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||
| 970 | if (yFP == iRightFP
| 0 | ||||||||||||||||||||||||
| 971 | const int y = ((yFP) >> 16); | - | ||||||||||||||||||||||||
| 972 | rightIntersectBf = qSafeFloatToQ16Dot16(right.x() + (y - right.y()) * bottomRightSlope); | - | ||||||||||||||||||||||||
| 973 | topRightIntersectBf = rightIntersectBf + (int)((qlonglong(bottomRightSlopeFP) * qlonglong(rowTopRight - yFP)) >> 16); | - | ||||||||||||||||||||||||
| 974 | bottomRightIntersectAf = rightIntersectAf + (int)((qlonglong(topRightSlopeFP) * qlonglong(rowBottomRight - yFP)) >> 16); | - | ||||||||||||||||||||||||
| 975 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 976 | topRightIntersectBf = rightIntersectBf; | - | ||||||||||||||||||||||||
| 977 | bottomRightIntersectAf = rightIntersectAf + topRightSlopeFP; | - | ||||||||||||||||||||||||
| 978 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||
| 980 | if (yFP == iBottomFP
| 0 | ||||||||||||||||||||||||
| 981 | bottomLeftIntersectBf = leftIntersectBf + (int)((qlonglong(bottomLeftSlopeFP) * qlonglong(rowBottom - yFP)) >> 16); | - | ||||||||||||||||||||||||
| 982 | bottomRightIntersectBf = rightIntersectBf + (int)((qlonglong(bottomRightSlopeFP) * qlonglong(rowBottom - yFP)) >> 16); | - | ||||||||||||||||||||||||
| 983 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 984 | bottomLeftIntersectBf = leftIntersectBf + bottomLeftSlopeFP; | - | ||||||||||||||||||||||||
| 985 | bottomRightIntersectBf = rightIntersectBf + bottomRightSlopeFP; | - | ||||||||||||||||||||||||
| 986 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||
| 988 | if (yFP < iLeftFP
| 0 | ||||||||||||||||||||||||
| 989 | leftMin = ((bottomLeftIntersectAf) >> 16); | - | ||||||||||||||||||||||||
| 990 | leftMax = ((topLeftIntersectAf) >> 16); | - | ||||||||||||||||||||||||
| 991 | } never executed: else if (yFP == iLeftFPend of block
| 0 | ||||||||||||||||||||||||
| 992 | leftMin = ((qMax(bottomLeftIntersectAf, topLeftIntersectBf)) >> 16); | - | ||||||||||||||||||||||||
| 993 | leftMax = ((qMax(topLeftIntersectAf, bottomLeftIntersectBf)) >> 16); | - | ||||||||||||||||||||||||
| 994 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 995 | leftMin = ((topLeftIntersectBf) >> 16); | - | ||||||||||||||||||||||||
| 996 | leftMax = ((bottomLeftIntersectBf) >> 16); | - | ||||||||||||||||||||||||
| 997 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 998 | - | |||||||||||||||||||||||||
| 999 | leftMin = qBound(d->clipRect.left(), leftMin, d->clipRect.right()); | - | ||||||||||||||||||||||||
| 1000 | leftMax = qBound(d->clipRect.left(), leftMax, d->clipRect.right()); | - | ||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||
| 1002 | if (yFP < iRightFP
| 0 | ||||||||||||||||||||||||
| 1003 | rightMin = ((topRightIntersectAf) >> 16); | - | ||||||||||||||||||||||||
| 1004 | rightMax = ((bottomRightIntersectAf) >> 16); | - | ||||||||||||||||||||||||
| 1005 | } never executed: else if (yFP == iRightFPend of block
| 0 | ||||||||||||||||||||||||
| 1006 | rightMin = ((qMin(topRightIntersectAf, bottomRightIntersectBf)) >> 16); | - | ||||||||||||||||||||||||
| 1007 | rightMax = ((qMin(bottomRightIntersectAf, topRightIntersectBf)) >> 16); | - | ||||||||||||||||||||||||
| 1008 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1009 | rightMin = ((bottomRightIntersectBf) >> 16); | - | ||||||||||||||||||||||||
| 1010 | rightMax = ((topRightIntersectBf) >> 16); | - | ||||||||||||||||||||||||
| 1011 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||
| 1013 | rightMin = qBound(d->clipRect.left(), rightMin, d->clipRect.right()); | - | ||||||||||||||||||||||||
| 1014 | rightMax = qBound(d->clipRect.left(), rightMax, d->clipRect.right()); | - | ||||||||||||||||||||||||
| 1015 | - | |||||||||||||||||||||||||
| 1016 | if (leftMax > rightMax
| 0 | ||||||||||||||||||||||||
| 1017 | leftMax = rightMax; never executed: leftMax = rightMax; | 0 | ||||||||||||||||||||||||
| 1018 | if (rightMin < leftMin
| 0 | ||||||||||||||||||||||||
| 1019 | rightMin = leftMin; never executed: rightMin = leftMin; | 0 | ||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||
| 1021 | Q16Dot16 rowHeight = rowBottom - rowTop; | - | ||||||||||||||||||||||||
| 1022 | - | |||||||||||||||||||||||||
| 1023 | int x = leftMin; | - | ||||||||||||||||||||||||
| 1024 | while (x <= leftMax
| 0 | ||||||||||||||||||||||||
| 1025 | Q16Dot16 excluded = 0; | - | ||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||
| 1027 | if (yFP <= iLeftFP
| 0 | ||||||||||||||||||||||||
| 1028 | excluded += intersectPixelFP(x, rowTop, rowBottomLeft, never executed: excluded += intersectPixelFP(x, rowTop, rowBottomLeft, bottomLeftIntersectAf, topLeftIntersectAf, topLeftSlopeFP, invTopLeftSlopeFP); | 0 | ||||||||||||||||||||||||
| 1029 | bottomLeftIntersectAf, topLeftIntersectAf, never executed: excluded += intersectPixelFP(x, rowTop, rowBottomLeft, bottomLeftIntersectAf, topLeftIntersectAf, topLeftSlopeFP, invTopLeftSlopeFP); | 0 | ||||||||||||||||||||||||
| 1030 | topLeftSlopeFP, invTopLeftSlopeFP); never executed: excluded += intersectPixelFP(x, rowTop, rowBottomLeft, bottomLeftIntersectAf, topLeftIntersectAf, topLeftSlopeFP, invTopLeftSlopeFP); | 0 | ||||||||||||||||||||||||
| 1031 | if (yFP >= iLeftFP
| 0 | ||||||||||||||||||||||||
| 1032 | excluded += intersectPixelFP(x, rowTopLeft, rowBottom, never executed: excluded += intersectPixelFP(x, rowTopLeft, rowBottom, topLeftIntersectBf, bottomLeftIntersectBf, bottomLeftSlopeFP, invBottomLeftSlopeFP); | 0 | ||||||||||||||||||||||||
| 1033 | topLeftIntersectBf, bottomLeftIntersectBf, never executed: excluded += intersectPixelFP(x, rowTopLeft, rowBottom, topLeftIntersectBf, bottomLeftIntersectBf, bottomLeftSlopeFP, invBottomLeftSlopeFP); | 0 | ||||||||||||||||||||||||
| 1034 | bottomLeftSlopeFP, invBottomLeftSlopeFP); never executed: excluded += intersectPixelFP(x, rowTopLeft, rowBottom, topLeftIntersectBf, bottomLeftIntersectBf, bottomLeftSlopeFP, invBottomLeftSlopeFP); | 0 | ||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||
| 1036 | if (x >= rightMin
| 0 | ||||||||||||||||||||||||
| 1037 | if (yFP <= iRightFP
| 0 | ||||||||||||||||||||||||
| 1038 | excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, never executed: excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1039 | topRightIntersectAf, bottomRightIntersectAf, never executed: excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1040 | topRightSlopeFP, invTopRightSlopeFP); never executed: excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1041 | if (yFP >= iRightFP
| 0 | ||||||||||||||||||||||||
| 1042 | excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, never executed: excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1043 | bottomRightIntersectBf, topRightIntersectBf, never executed: excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1044 | bottomRightSlopeFP, invBottomRightSlopeFP); never executed: excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1045 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1046 | - | |||||||||||||||||||||||||
| 1047 | Q16Dot16 coverage = rowHeight - excluded; | - | ||||||||||||||||||||||||
| 1048 | buffer.addSpan(x, 1, ((yFP) >> 16), | - | ||||||||||||||||||||||||
| 1049 | ((255 * coverage) >> 16)); | - | ||||||||||||||||||||||||
| 1050 | ++x; | - | ||||||||||||||||||||||||
| 1051 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1052 | if (x < rightMin
| 0 | ||||||||||||||||||||||||
| 1053 | buffer.addSpan(x, rightMin - x, ((yFP) >> 16), | - | ||||||||||||||||||||||||
| 1054 | ((255 * rowHeight) >> 16)); | - | ||||||||||||||||||||||||
| 1055 | x = rightMin; | - | ||||||||||||||||||||||||
| 1056 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1057 | while (x <= rightMax
| 0 | ||||||||||||||||||||||||
| 1058 | Q16Dot16 excluded = 0; | - | ||||||||||||||||||||||||
| 1059 | if (yFP <= iRightFP
| 0 | ||||||||||||||||||||||||
| 1060 | excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, never executed: excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1061 | topRightIntersectAf, bottomRightIntersectAf, never executed: excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1062 | topRightSlopeFP, invTopRightSlopeFP); never executed: excluded += (rowBottomRight - rowTop) - intersectPixelFP(x, rowTop, rowBottomRight, topRightIntersectAf, bottomRightIntersectAf, topRightSlopeFP, invTopRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1063 | if (yFP >= iRightFP
| 0 | ||||||||||||||||||||||||
| 1064 | excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, never executed: excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1065 | bottomRightIntersectBf, topRightIntersectBf, never executed: excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1066 | bottomRightSlopeFP, invBottomRightSlopeFP); never executed: excluded += (rowBottom - rowTopRight) - intersectPixelFP(x, rowTopRight, rowBottom, bottomRightIntersectBf, topRightIntersectBf, bottomRightSlopeFP, invBottomRightSlopeFP); | 0 | ||||||||||||||||||||||||
| 1067 | - | |||||||||||||||||||||||||
| 1068 | Q16Dot16 coverage = rowHeight - excluded; | - | ||||||||||||||||||||||||
| 1069 | buffer.addSpan(x, 1, ((yFP) >> 16), | - | ||||||||||||||||||||||||
| 1070 | ((255 * coverage) >> 16)); | - | ||||||||||||||||||||||||
| 1071 | ++x; | - | ||||||||||||||||||||||||
| 1072 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1073 | - | |||||||||||||||||||||||||
| 1074 | leftIntersectAf += topLeftSlopeFP; | - | ||||||||||||||||||||||||
| 1075 | leftIntersectBf += bottomLeftSlopeFP; | - | ||||||||||||||||||||||||
| 1076 | rightIntersectAf += topRightSlopeFP; | - | ||||||||||||||||||||||||
| 1077 | rightIntersectBf += bottomRightSlopeFP; | - | ||||||||||||||||||||||||
| 1078 | topLeftIntersectAf = leftIntersectAf; | - | ||||||||||||||||||||||||
| 1079 | topRightIntersectAf = rightIntersectAf; | - | ||||||||||||||||||||||||
| 1080 | - | |||||||||||||||||||||||||
| 1081 | yFP += 65536; | - | ||||||||||||||||||||||||
| 1082 | rowTop = yFP; | - | ||||||||||||||||||||||||
| 1083 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1084 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1085 | int iTop = int(top.y() + 0.5f); | - | ||||||||||||||||||||||||
| 1086 | int iLeft = left.y() < 0.5f
| 0 | ||||||||||||||||||||||||
| 1087 | int iRight = right.y() < 0.5f
| 0 | ||||||||||||||||||||||||
| 1088 | int iBottom = bottom.y() < 0.5f
| 0 | ||||||||||||||||||||||||
| 1089 | int iMiddle = qMin(iLeft, iRight); | - | ||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||
| 1091 | Q16Dot16 leftIntersectAf = qSafeFloatToQ16Dot16(top.x() + 0.5f + (iTop + 0.5f - top.y()) * topLeftSlope); | - | ||||||||||||||||||||||||
| 1092 | Q16Dot16 leftIntersectBf = qSafeFloatToQ16Dot16(left.x() + 0.5f + (iLeft + 1.5f - left.y()) * bottomLeftSlope); | - | ||||||||||||||||||||||||
| 1093 | Q16Dot16 rightIntersectAf = qSafeFloatToQ16Dot16(top.x() - 0.5f + (iTop + 0.5f - top.y()) * topRightSlope); | - | ||||||||||||||||||||||||
| 1094 | Q16Dot16 rightIntersectBf = qSafeFloatToQ16Dot16(right.x() - 0.5f + (iRight + 1.5f - right.y()) * bottomRightSlope); | - | ||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||
| 1096 | int ny; | - | ||||||||||||||||||||||||
| 1097 | int y = iTop; | - | ||||||||||||||||||||||||
| 1098 | ny = qMin(iMiddle + 1, d->clipRect.top()); if (y < ny
never executed: if (iMiddle > d->clipRect.bottom()end of block
never executed: for (; y <= iMiddleiMiddle = d->clipRect.bottom();
never executed: leftIntersectAf += topLeftSlopeFP; rightIntersectAf += topRightSlopeFP; }buffer.addSpan(x1, x2 - x1 + 1, y, 255);never executed: end of block | 0 | ||||||||||||||||||||||||
| 1099 | ny = qMin(iRight + 1, d->clipRect.top()); if (y < ny
never executed: if (iRight > d->clipRect.bottom()end of block
never executed: for (; y <= iRightiRight = d->clipRect.bottom();
never executed: leftIntersectBf += bottomLeftSlopeFP; rightIntersectAf += topRightSlopeFP; }buffer.addSpan(x1, x2 - x1 + 1, y, 255);never executed: end of block | 0 | ||||||||||||||||||||||||
| 1100 | ny = qMin(iLeft + 1, d->clipRect.top()); if (y < ny
never executed: if (iLeft > d->clipRect.bottom()end of block
never executed: for (; y <= iLeftiLeft = d->clipRect.bottom();
never executed: leftIntersectAf += topLeftSlopeFP; rightIntersectBf += bottomRightSlopeFP; }buffer.addSpan(x1, x2 - x1 + 1, y, 255);never executed: ;end of block | 0 | ||||||||||||||||||||||||
| 1101 | ny = qMin(iBottom + 1, d->clipRect.top()); if (y < ny
never executed: if (iBottom > d->clipRect.bottom()end of block
never executed: for (; y <= iBottomiBottom = d->clipRect.bottom();
never executed: leftIntersectBf += bottomLeftSlopeFP; rightIntersectBf += bottomRightSlopeFP; }buffer.addSpan(x1, x2 - x1 + 1, y, 255);never executed: ;end of block | 0 | ||||||||||||||||||||||||
| 1102 | - | |||||||||||||||||||||||||
| 1103 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1104 | } | - | ||||||||||||||||||||||||
| 1105 | } | - | ||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||
| 1107 | void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule) | - | ||||||||||||||||||||||||
| 1108 | { | - | ||||||||||||||||||||||||
| 1109 | if (outline->n_points < 3
| 0 | ||||||||||||||||||||||||
| 1110 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||
| 1112 | const QT_FT_Vector *points = outline->points; | - | ||||||||||||||||||||||||
| 1113 | - | |||||||||||||||||||||||||
| 1114 | QSpanBuffer buffer(d->blend, d->data, d->clipRect); | - | ||||||||||||||||||||||||
| 1115 | - | |||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||
| 1117 | - | |||||||||||||||||||||||||
| 1118 | - | |||||||||||||||||||||||||
| 1119 | QT_FT_Pos min_y = points[0].y, max_y = points[0].y; | - | ||||||||||||||||||||||||
| 1120 | for (int i = 1; i < outline->n_points
| 0 | ||||||||||||||||||||||||
| 1121 | const QT_FT_Vector &p = points[i]; | - | ||||||||||||||||||||||||
| 1122 | min_y = qMin(p.y, min_y); | - | ||||||||||||||||||||||||
| 1123 | max_y = qMax(p.y, max_y); | - | ||||||||||||||||||||||||
| 1124 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1125 | - | |||||||||||||||||||||||||
| 1126 | int rounding = d->legacyRounding
| 0 | ||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||
| 1128 | int iTopBound = qMax(d->clipRect.top(), int((min_y + 32 + rounding) >> 6)); | - | ||||||||||||||||||||||||
| 1129 | int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32 + rounding) >> 6)); | - | ||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||
| 1131 | if (iTopBound > iBottomBound
| 0 | ||||||||||||||||||||||||
| 1132 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1133 | - | |||||||||||||||||||||||||
| 1134 | d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer); | - | ||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||
| 1136 | int first = 0; | - | ||||||||||||||||||||||||
| 1137 | for (int i = 0; i < outline->n_contours
| 0 | ||||||||||||||||||||||||
| 1138 | const int last = outline->contours[i]; | - | ||||||||||||||||||||||||
| 1139 | for (int j = first; j < last
| 0 | ||||||||||||||||||||||||
| 1140 | if (outline->tags[j+1] == 2
| 0 | ||||||||||||||||||||||||
| 1141 | ((!(outline->tags[j+2] == 2)) ? qt_assert("outline->tags[j+2] == QT_FT_CURVE_TAG_CUBIC",__FILE__,1227) : qt_noop()); | - | ||||||||||||||||||||||||
| 1142 | d->scanConverter.mergeCurve(points[j], points[j+1], points[j+2], points[j+3]); | - | ||||||||||||||||||||||||
| 1143 | j += 2; | - | ||||||||||||||||||||||||
| 1144 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1145 | d->scanConverter.mergeLine(points[j], points[j+1]); | - | ||||||||||||||||||||||||
| 1146 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1147 | } | - | ||||||||||||||||||||||||
| 1148 | - | |||||||||||||||||||||||||
| 1149 | first = last + 1; | - | ||||||||||||||||||||||||
| 1150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1151 | - | |||||||||||||||||||||||||
| 1152 | d->scanConverter.end(); | - | ||||||||||||||||||||||||
| 1153 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule) | - | ||||||||||||||||||||||||
| 1156 | { | - | ||||||||||||||||||||||||
| 1157 | if (path.isEmpty()
| 0 | ||||||||||||||||||||||||
| 1158 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1159 | - | |||||||||||||||||||||||||
| 1160 | QSpanBuffer buffer(d->blend, d->data, d->clipRect); | - | ||||||||||||||||||||||||
| 1161 | - | |||||||||||||||||||||||||
| 1162 | QRectF bounds = path.controlPointRect(); | - | ||||||||||||||||||||||||
| 1163 | - | |||||||||||||||||||||||||
| 1164 | double rounding = d->legacyRounding
| 0 | ||||||||||||||||||||||||
| 1165 | - | |||||||||||||||||||||||||
| 1166 | int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + rounding)); | - | ||||||||||||||||||||||||
| 1167 | int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + rounding)); | - | ||||||||||||||||||||||||
| 1168 | - | |||||||||||||||||||||||||
| 1169 | if (iTopBound > iBottomBound
| 0 | ||||||||||||||||||||||||
| 1170 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1171 | - | |||||||||||||||||||||||||
| 1172 | d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer); | - | ||||||||||||||||||||||||
| 1173 | - | |||||||||||||||||||||||||
| 1174 | int subpathStart = 0; | - | ||||||||||||||||||||||||
| 1175 | QT_FT_Vector last = { 0, 0 }; | - | ||||||||||||||||||||||||
| 1176 | for (int i = 0; i < path.elementCount()
| 0 | ||||||||||||||||||||||||
| 1177 | switch (path.elementAt(i).type) { | - | ||||||||||||||||||||||||
| 1178 | case never executed: QPainterPath::LineToElement:case QPainterPath::LineToElement:never executed: case QPainterPath::LineToElement: | 0 | ||||||||||||||||||||||||
| 1179 | { | - | ||||||||||||||||||||||||
| 1180 | QT_FT_Vector p1 = last; | - | ||||||||||||||||||||||||
| 1181 | QT_FT_Vector p2 = PointToVector(path.elementAt(i)); | - | ||||||||||||||||||||||||
| 1182 | d->scanConverter.mergeLine(p1, p2); | - | ||||||||||||||||||||||||
| 1183 | last = p2; | - | ||||||||||||||||||||||||
| 1184 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1185 | } | - | ||||||||||||||||||||||||
| 1186 | case never executed: QPainterPath::MoveToElement:case QPainterPath::MoveToElement:never executed: case QPainterPath::MoveToElement: | 0 | ||||||||||||||||||||||||
| 1187 | { | - | ||||||||||||||||||||||||
| 1188 | if (i != 0
| 0 | ||||||||||||||||||||||||
| 1189 | QT_FT_Vector first = PointToVector(path.elementAt(subpathStart)); | - | ||||||||||||||||||||||||
| 1190 | - | |||||||||||||||||||||||||
| 1191 | if (first.x != last.x
| 0 | ||||||||||||||||||||||||
| 1192 | d->scanConverter.mergeLine(last, first); never executed: d->scanConverter.mergeLine(last, first); | 0 | ||||||||||||||||||||||||
| 1193 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1194 | subpathStart = i; | - | ||||||||||||||||||||||||
| 1195 | last = PointToVector(path.elementAt(i)); | - | ||||||||||||||||||||||||
| 1196 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1197 | } | - | ||||||||||||||||||||||||
| 1198 | case never executed: QPainterPath::CurveToElement:case QPainterPath::CurveToElement:never executed: case QPainterPath::CurveToElement: | 0 | ||||||||||||||||||||||||
| 1199 | { | - | ||||||||||||||||||||||||
| 1200 | QT_FT_Vector p1 = last; | - | ||||||||||||||||||||||||
| 1201 | QT_FT_Vector p2 = PointToVector(path.elementAt(i)); | - | ||||||||||||||||||||||||
| 1202 | QT_FT_Vector p3 = PointToVector(path.elementAt(++i)); | - | ||||||||||||||||||||||||
| 1203 | QT_FT_Vector p4 = PointToVector(path.elementAt(++i)); | - | ||||||||||||||||||||||||
| 1204 | d->scanConverter.mergeCurve(p1, p2, p3, p4); | - | ||||||||||||||||||||||||
| 1205 | last = p4; | - | ||||||||||||||||||||||||
| 1206 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1207 | } | - | ||||||||||||||||||||||||
| 1208 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 1209 | ((!(false)) ? qt_assert("false",__FILE__,1295) : qt_noop()); | - | ||||||||||||||||||||||||
| 1210 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1211 | } | - | ||||||||||||||||||||||||
| 1212 | } | - | ||||||||||||||||||||||||
| 1213 | - | |||||||||||||||||||||||||
| 1214 | QT_FT_Vector first = PointToVector(path.elementAt(subpathStart)); | - | ||||||||||||||||||||||||
| 1215 | - | |||||||||||||||||||||||||
| 1216 | - | |||||||||||||||||||||||||
| 1217 | if (first.x != last.x
| 0 | ||||||||||||||||||||||||
| 1218 | d->scanConverter.mergeLine(last, first); never executed: d->scanConverter.mergeLine(last, first); | 0 | ||||||||||||||||||||||||
| 1219 | - | |||||||||||||||||||||||||
| 1220 | d->scanConverter.end(); | - | ||||||||||||||||||||||||
| 1221 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1222 | - | |||||||||||||||||||||||||
| 1223 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |