| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qcosmeticstroker.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | static inline uint sourceOver(uint d, uint color) | - | ||||||||||||||||||||||||
| 4 | { | - | ||||||||||||||||||||||||
| 5 | return never executed: color + BYTE_MUL(d, qAlpha(~color));return color + BYTE_MUL(d, qAlpha(~color));never executed: return color + BYTE_MUL(d, qAlpha(~color)); | 0 | ||||||||||||||||||||||||
| 6 | } | - | ||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | inline static int F16Dot16FixedDiv(int x, int y) | - | ||||||||||||||||||||||||
| 9 | { | - | ||||||||||||||||||||||||
| 10 | if (qAbs(x) > 0x7fff
| 0 | ||||||||||||||||||||||||
| 11 | return never executed: qlonglong(x) * (1<<16) / y;return qlonglong(x) * (1<<16) / y;never executed: return qlonglong(x) * (1<<16) / y; | 0 | ||||||||||||||||||||||||
| 12 | return never executed: x * (1<<16) / y;return x * (1<<16) / y;never executed: return x * (1<<16) / y; | 0 | ||||||||||||||||||||||||
| 13 | } | - | ||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | typedef void (*DrawPixel)(QCosmeticStroker *stroker, int x, int y, int coverage); | - | ||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | namespace { | - | ||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||
| 19 | struct Dasher { | - | ||||||||||||||||||||||||
| 20 | QCosmeticStroker *stroker; | - | ||||||||||||||||||||||||
| 21 | int *pattern; | - | ||||||||||||||||||||||||
| 22 | int offset; | - | ||||||||||||||||||||||||
| 23 | int dashIndex; | - | ||||||||||||||||||||||||
| 24 | int dashOn; | - | ||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||
| 26 | Dasher(QCosmeticStroker *s, bool reverse, int start, int stop) | - | ||||||||||||||||||||||||
| 27 | : stroker(s) | - | ||||||||||||||||||||||||
| 28 | { | - | ||||||||||||||||||||||||
| 29 | int delta = stop - start; | - | ||||||||||||||||||||||||
| 30 | if (reverse
| 0 | ||||||||||||||||||||||||
| 31 | pattern = stroker->reversePattern; | - | ||||||||||||||||||||||||
| 32 | offset = stroker->patternLength - stroker->patternOffset - delta - ((start & 63) - 32); | - | ||||||||||||||||||||||||
| 33 | dashOn = 0; | - | ||||||||||||||||||||||||
| 34 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 35 | pattern = stroker->pattern; | - | ||||||||||||||||||||||||
| 36 | offset = stroker->patternOffset - ((start & 63) - 32); | - | ||||||||||||||||||||||||
| 37 | dashOn = 1; | - | ||||||||||||||||||||||||
| 38 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 39 | offset %= stroker->patternLength; | - | ||||||||||||||||||||||||
| 40 | if (offset < 0
| 0 | ||||||||||||||||||||||||
| 41 | offset += stroker->patternLength; never executed: offset += stroker->patternLength; | 0 | ||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | dashIndex = 0; | - | ||||||||||||||||||||||||
| 44 | while (offset>= pattern[dashIndex]
| 0 | ||||||||||||||||||||||||
| 45 | ++ never executed: dashIndex;++dashIndex;never executed: ++dashIndex; | 0 | ||||||||||||||||||||||||
| 46 | - | |||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | stroker->patternOffset += delta; | - | ||||||||||||||||||||||||
| 49 | stroker->patternOffset %= stroker->patternLength; | - | ||||||||||||||||||||||||
| 50 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | bool on() const { | - | ||||||||||||||||||||||||
| 53 | return never executed: (dashIndex + dashOn) & 1;return (dashIndex + dashOn) & 1;never executed: return (dashIndex + dashOn) & 1; | 0 | ||||||||||||||||||||||||
| 54 | } | - | ||||||||||||||||||||||||
| 55 | void adjust() { | - | ||||||||||||||||||||||||
| 56 | offset += 64; | - | ||||||||||||||||||||||||
| 57 | if (offset >= pattern[dashIndex]
| 0 | ||||||||||||||||||||||||
| 58 | ++dashIndex; | - | ||||||||||||||||||||||||
| 59 | dashIndex %= stroker->patternSize; | - | ||||||||||||||||||||||||
| 60 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 61 | offset %= stroker->patternLength; | - | ||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 64 | }; | - | ||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | struct NoDasher { | - | ||||||||||||||||||||||||
| 67 | NoDasher(QCosmeticStroker *, bool, int, int) {} | - | ||||||||||||||||||||||||
| 68 | bool on() const { return never executed: true;return true;never executed: }return true; | 0 | ||||||||||||||||||||||||
| 69 | void adjust(int = 0) {} | - | ||||||||||||||||||||||||
| 70 | }; | - | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | }; | - | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | template<DrawPixel drawPixel, class Dasher> | - | ||||||||||||||||||||||||
| 80 | static bool drawLine(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); | - | ||||||||||||||||||||||||
| 81 | template<DrawPixel drawPixel, class Dasher> | - | ||||||||||||||||||||||||
| 82 | static bool drawLineAA(QCosmeticStroker *stroker, qreal x1, qreal y1, qreal x2, qreal y2, int caps); | - | ||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||
| 84 | inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) | - | ||||||||||||||||||||||||
| 85 | { | - | ||||||||||||||||||||||||
| 86 | const QRect &cl = stroker->clip; | - | ||||||||||||||||||||||||
| 87 | if (x < cl.x()
| 0 | ||||||||||||||||||||||||
| 88 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||
| 90 | if (stroker->current_span > 0
| 0 | ||||||||||||||||||||||||
| 91 | const int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; | - | ||||||||||||||||||||||||
| 92 | const int lasty = stroker->spans[stroker->current_span-1].y; | - | ||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | if (stroker->current_span == QCosmeticStroker::NSPANS
| 0 | ||||||||||||||||||||||||
| 95 | stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); | - | ||||||||||||||||||||||||
| 96 | stroker->current_span = 0; | - | ||||||||||||||||||||||||
| 97 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 98 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | stroker->spans[stroker->current_span].x = ushort(x); | - | ||||||||||||||||||||||||
| 101 | stroker->spans[stroker->current_span].len = 1; | - | ||||||||||||||||||||||||
| 102 | stroker->spans[stroker->current_span].y = y; | - | ||||||||||||||||||||||||
| 103 | stroker->spans[stroker->current_span].coverage = coverage*stroker->opacity >> 8; | - | ||||||||||||||||||||||||
| 104 | ++stroker->current_span; | - | ||||||||||||||||||||||||
| 105 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | inline void drawPixelARGB32(QCosmeticStroker *stroker, int x, int y, int coverage) | - | ||||||||||||||||||||||||
| 108 | { | - | ||||||||||||||||||||||||
| 109 | const QRect &cl = stroker->clip; | - | ||||||||||||||||||||||||
| 110 | if (x < cl.x()
| 0 | ||||||||||||||||||||||||
| 111 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||
| 113 | int offset = x + stroker->ppl*y; | - | ||||||||||||||||||||||||
| 114 | uint c = BYTE_MUL(stroker->color, coverage); | - | ||||||||||||||||||||||||
| 115 | stroker->pixels[offset] = sourceOver(stroker->pixels[offset], c); | - | ||||||||||||||||||||||||
| 116 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | inline void drawPixelARGB32Opaque(QCosmeticStroker *stroker, int x, int y, int) | - | ||||||||||||||||||||||||
| 119 | { | - | ||||||||||||||||||||||||
| 120 | const QRect &cl = stroker->clip; | - | ||||||||||||||||||||||||
| 121 | if (x < cl.x()
| 0 | ||||||||||||||||||||||||
| 122 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | int offset = x + stroker->ppl*y; | - | ||||||||||||||||||||||||
| 125 | stroker->pixels[offset] = sourceOver(stroker->pixels[offset], stroker->color); | - | ||||||||||||||||||||||||
| 126 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | enum StrokeSelection { | - | ||||||||||||||||||||||||
| 129 | Aliased = 0, | - | ||||||||||||||||||||||||
| 130 | AntiAliased = 1, | - | ||||||||||||||||||||||||
| 131 | Solid = 0, | - | ||||||||||||||||||||||||
| 132 | Dashed = 2, | - | ||||||||||||||||||||||||
| 133 | RegularDraw = 0, | - | ||||||||||||||||||||||||
| 134 | FastDraw = 4 | - | ||||||||||||||||||||||||
| 135 | }; | - | ||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | static StrokeLine strokeLine(int strokeSelection) | - | ||||||||||||||||||||||||
| 138 | { | - | ||||||||||||||||||||||||
| 139 | StrokeLine stroke; | - | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | switch (strokeSelection) { | - | ||||||||||||||||||||||||
| 142 | case never executed: Aliased|Solid|RegularDraw:case Aliased|Solid|RegularDraw:never executed: case Aliased|Solid|RegularDraw: | 0 | ||||||||||||||||||||||||
| 143 | stroke = &::drawLine<drawPixel, NoDasher>; | - | ||||||||||||||||||||||||
| 144 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 145 | case never executed: Aliased|Solid|FastDraw:case Aliased|Solid|FastDraw:never executed: case Aliased|Solid|FastDraw: | 0 | ||||||||||||||||||||||||
| 146 | stroke = &::drawLine<drawPixelARGB32Opaque, NoDasher>; | - | ||||||||||||||||||||||||
| 147 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 148 | case never executed: Aliased|Dashed|RegularDraw:case Aliased|Dashed|RegularDraw:never executed: case Aliased|Dashed|RegularDraw: | 0 | ||||||||||||||||||||||||
| 149 | stroke = &::drawLine<drawPixel, Dasher>; | - | ||||||||||||||||||||||||
| 150 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 151 | case never executed: Aliased|Dashed|FastDraw:case Aliased|Dashed|FastDraw:never executed: case Aliased|Dashed|FastDraw: | 0 | ||||||||||||||||||||||||
| 152 | stroke = &::drawLine<drawPixelARGB32Opaque, Dasher>; | - | ||||||||||||||||||||||||
| 153 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 154 | case never executed: AntiAliased|Solid|RegularDraw:case AntiAliased|Solid|RegularDraw:never executed: case AntiAliased|Solid|RegularDraw: | 0 | ||||||||||||||||||||||||
| 155 | stroke = &::drawLineAA<drawPixel, NoDasher>; | - | ||||||||||||||||||||||||
| 156 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 157 | case never executed: AntiAliased|Solid|FastDraw:case AntiAliased|Solid|FastDraw:never executed: case AntiAliased|Solid|FastDraw: | 0 | ||||||||||||||||||||||||
| 158 | stroke = &::drawLineAA<drawPixelARGB32, NoDasher>; | - | ||||||||||||||||||||||||
| 159 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 160 | case never executed: AntiAliased|Dashed|RegularDraw:case AntiAliased|Dashed|RegularDraw:never executed: case AntiAliased|Dashed|RegularDraw: | 0 | ||||||||||||||||||||||||
| 161 | stroke = &::drawLineAA<drawPixel, Dasher>; | - | ||||||||||||||||||||||||
| 162 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 163 | case never executed: AntiAliased|Dashed|FastDraw:case AntiAliased|Dashed|FastDraw:never executed: case AntiAliased|Dashed|FastDraw: | 0 | ||||||||||||||||||||||||
| 164 | stroke = &::drawLineAA<drawPixelARGB32, Dasher>; | - | ||||||||||||||||||||||||
| 165 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 166 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 167 | ((!(false)) ? qt_assert("false",__FILE__,227) : qt_noop()); | - | ||||||||||||||||||||||||
| 168 | stroke = 0; | - | ||||||||||||||||||||||||
| 169 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 170 | return never executed: stroke;return stroke;never executed: return stroke; | 0 | ||||||||||||||||||||||||
| 171 | } | - | ||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | void QCosmeticStroker::setup() | - | ||||||||||||||||||||||||
| 174 | { | - | ||||||||||||||||||||||||
| 175 | blend = state->penData.blend; | - | ||||||||||||||||||||||||
| 176 | if (state->clip
| 0 | ||||||||||||||||||||||||
| 177 | clip &= state->clip->clipRect; | - | ||||||||||||||||||||||||
| 178 | blend = state->penData.unclipped_blend; | - | ||||||||||||||||||||||||
| 179 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | int strokeSelection = 0; | - | ||||||||||||||||||||||||
| 182 | if (blend == state->penData.unclipped_blend
| 0 | ||||||||||||||||||||||||
| 183 | && state->penData.type == QSpanData::Solid
| 0 | ||||||||||||||||||||||||
| 184 | && (state->penData.rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
| 0 | ||||||||||||||||||||||||
| 185 | || state->penData.rasterBuffer->format == QImage::Format_RGB32
| 0 | ||||||||||||||||||||||||
| 186 | && state->compositionMode() == QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||||||||
| 187 | strokeSelection |= FastDraw; never executed: strokeSelection |= FastDraw; | 0 | ||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||
| 189 | if (state->renderHints & QPainter::Antialiasing
| 0 | ||||||||||||||||||||||||
| 190 | strokeSelection |= AntiAliased; never executed: strokeSelection |= AntiAliased; | 0 | ||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | const QVector<qreal> &penPattern = state->lastPen.dashPattern(); | - | ||||||||||||||||||||||||
| 193 | if (penPattern.isEmpty()
| 0 | ||||||||||||||||||||||||
| 194 | ((!(!pattern && !reversePattern)) ? qt_assert("!pattern && !reversePattern",__FILE__,254) : qt_noop()); | - | ||||||||||||||||||||||||
| 195 | pattern = 0; | - | ||||||||||||||||||||||||
| 196 | reversePattern = 0; | - | ||||||||||||||||||||||||
| 197 | patternLength = 0; | - | ||||||||||||||||||||||||
| 198 | patternSize = 0; | - | ||||||||||||||||||||||||
| 199 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 200 | pattern = (int *)malloc(penPattern.size()*sizeof(int)); | - | ||||||||||||||||||||||||
| 201 | reversePattern = (int *)malloc(penPattern.size()*sizeof(int)); | - | ||||||||||||||||||||||||
| 202 | patternSize = penPattern.size(); | - | ||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||
| 204 | patternLength = 0; | - | ||||||||||||||||||||||||
| 205 | for (int i = 0; i < patternSize
| 0 | ||||||||||||||||||||||||
| 206 | patternLength += (int) qMax(1. , penPattern.at(i)*64.); | - | ||||||||||||||||||||||||
| 207 | pattern[i] = patternLength; | - | ||||||||||||||||||||||||
| 208 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 209 | patternLength = 0; | - | ||||||||||||||||||||||||
| 210 | for (int i = 0; i < patternSize
| 0 | ||||||||||||||||||||||||
| 211 | patternLength += (int) qMax(1., penPattern.at(patternSize - 1 - i)*64.); | - | ||||||||||||||||||||||||
| 212 | reversePattern[i] = patternLength; | - | ||||||||||||||||||||||||
| 213 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 214 | strokeSelection |= Dashed; | - | ||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | stroke = strokeLine(strokeSelection); | - | ||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | qreal width = state->lastPen.widthF(); | - | ||||||||||||||||||||||||
| 221 | if (width == 0
| 0 | ||||||||||||||||||||||||
| 222 | opacity = 256; never executed: opacity = 256; | 0 | ||||||||||||||||||||||||
| 223 | else if (qt_pen_is_cosmetic(state->lastPen, state->renderHints)
| 0 | ||||||||||||||||||||||||
| 224 | opacity = (int) 256*width; never executed: opacity = (int) 256*width; | 0 | ||||||||||||||||||||||||
| 225 | else | - | ||||||||||||||||||||||||
| 226 | opacity = (int) 256*width*state->txscale; never executed: opacity = (int) 256*width*state->txscale; | 0 | ||||||||||||||||||||||||
| 227 | opacity = qBound(0, opacity, 256); | - | ||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||
| 229 | drawCaps = state->lastPen.capStyle() != Qt::FlatCap; | - | ||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | if (strokeSelection & FastDraw
| 0 | ||||||||||||||||||||||||
| 232 | color = multiplyAlpha256(state->penData.solid.color, opacity).toArgb32(); | - | ||||||||||||||||||||||||
| 233 | QRasterBuffer *buffer = state->penData.rasterBuffer; | - | ||||||||||||||||||||||||
| 234 | pixels = (uint *)buffer->buffer(); | - | ||||||||||||||||||||||||
| 235 | ppl = buffer->bytesPerLine()>>2; | - | ||||||||||||||||||||||||
| 236 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||
| 242 | xmin = deviceRect.left() - 1; | - | ||||||||||||||||||||||||
| 243 | xmax = deviceRect.right() + 2; | - | ||||||||||||||||||||||||
| 244 | ymin = deviceRect.top() - 1; | - | ||||||||||||||||||||||||
| 245 | ymax = deviceRect.bottom() + 2; | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | lastPixel.x = -1; | - | ||||||||||||||||||||||||
| 248 | lastPixel.y = -1; | - | ||||||||||||||||||||||||
| 249 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | bool QCosmeticStroker::clipLine(qreal &x1, qreal &y1, qreal &x2, qreal &y2) | - | ||||||||||||||||||||||||
| 253 | { | - | ||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||
| 256 | if (x1 < xmin
| 0 | ||||||||||||||||||||||||
| 257 | if (x2 <= xmin
| 0 | ||||||||||||||||||||||||
| 258 | goto never executed: clipped;goto clipped;never executed: goto clipped; | 0 | ||||||||||||||||||||||||
| 259 | y1 += (y2 - y1)/(x2 - x1) * (xmin - x1); | - | ||||||||||||||||||||||||
| 260 | x1 = xmin; | - | ||||||||||||||||||||||||
| 261 | } never executed: else if (x1 > xmaxend of block
| 0 | ||||||||||||||||||||||||
| 262 | if (x2 >= xmax
| 0 | ||||||||||||||||||||||||
| 263 | goto never executed: clipped;goto clipped;never executed: goto clipped; | 0 | ||||||||||||||||||||||||
| 264 | y1 += (y2 - y1)/(x2 - x1) * (xmax - x1); | - | ||||||||||||||||||||||||
| 265 | x1 = xmax; | - | ||||||||||||||||||||||||
| 266 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 267 | if (x2 < xmin
| 0 | ||||||||||||||||||||||||
| 268 | lastPixel.x = -1; | - | ||||||||||||||||||||||||
| 269 | y2 += (y2 - y1)/(x2 - x1) * (xmin - x2); | - | ||||||||||||||||||||||||
| 270 | x2 = xmin; | - | ||||||||||||||||||||||||
| 271 | } never executed: else if (x2 > xmaxend of block
| 0 | ||||||||||||||||||||||||
| 272 | lastPixel.x = -1; | - | ||||||||||||||||||||||||
| 273 | y2 += (y2 - y1)/(x2 - x1) * (xmax - x2); | - | ||||||||||||||||||||||||
| 274 | x2 = xmax; | - | ||||||||||||||||||||||||
| 275 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||
| 277 | if (y1 < ymin
| 0 | ||||||||||||||||||||||||
| 278 | if (y2 <= ymin
| 0 | ||||||||||||||||||||||||
| 279 | goto never executed: clipped;goto clipped;never executed: goto clipped; | 0 | ||||||||||||||||||||||||
| 280 | x1 += (x2 - x1)/(y2 - y1) * (ymin - y1); | - | ||||||||||||||||||||||||
| 281 | y1 = ymin; | - | ||||||||||||||||||||||||
| 282 | } never executed: else if (y1 > ymaxend of block
| 0 | ||||||||||||||||||||||||
| 283 | if (y2 >= ymax
| 0 | ||||||||||||||||||||||||
| 284 | goto never executed: clipped;goto clipped;never executed: goto clipped; | 0 | ||||||||||||||||||||||||
| 285 | x1 += (x2 - x1)/(y2 - y1) * (ymax - y1); | - | ||||||||||||||||||||||||
| 286 | y1 = ymax; | - | ||||||||||||||||||||||||
| 287 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 288 | if (y2 < ymin
| 0 | ||||||||||||||||||||||||
| 289 | lastPixel.x = -1; | - | ||||||||||||||||||||||||
| 290 | x2 += (x2 - x1)/(y2 - y1) * (ymin - y2); | - | ||||||||||||||||||||||||
| 291 | y2 = ymin; | - | ||||||||||||||||||||||||
| 292 | } never executed: else if (y2 > ymaxend of block
| 0 | ||||||||||||||||||||||||
| 293 | lastPixel.x = -1; | - | ||||||||||||||||||||||||
| 294 | x2 += (x2 - x1)/(y2 - y1) * (ymax - y2); | - | ||||||||||||||||||||||||
| 295 | y2 = ymax; | - | ||||||||||||||||||||||||
| 296 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||
| 298 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||
| 300 | clipped: | - | ||||||||||||||||||||||||
| 301 | lastPixel.x = -1; | - | ||||||||||||||||||||||||
| 302 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 303 | } | - | ||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||
| 306 | void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2) | - | ||||||||||||||||||||||||
| 307 | { | - | ||||||||||||||||||||||||
| 308 | if (p1 == p2
| 0 | ||||||||||||||||||||||||
| 309 | drawPoints(&p1, 1); | - | ||||||||||||||||||||||||
| 310 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 311 | } | - | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | QPointF start = p1 * state->matrix; | - | ||||||||||||||||||||||||
| 314 | QPointF end = p2 * state->matrix; | - | ||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||
| 316 | patternOffset = state->lastPen.dashOffset()*64; | - | ||||||||||||||||||||||||
| 317 | lastPixel.x = -1; | - | ||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0); | - | ||||||||||||||||||||||||
| 320 | - | |||||||||||||||||||||||||
| 321 | blend(current_span, spans, &state->penData); | - | ||||||||||||||||||||||||
| 322 | current_span = 0; | - | ||||||||||||||||||||||||
| 323 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||
| 325 | void QCosmeticStroker::drawPoints(const QPoint *points, int num) | - | ||||||||||||||||||||||||
| 326 | { | - | ||||||||||||||||||||||||
| 327 | const QPoint *end = points + num; | - | ||||||||||||||||||||||||
| 328 | while (points < end
| 0 | ||||||||||||||||||||||||
| 329 | QPointF p = QPointF(*points) * state->matrix; | - | ||||||||||||||||||||||||
| 330 | drawPixel(this, qRound(p.x()), qRound(p.y()), 255); | - | ||||||||||||||||||||||||
| 331 | ++points; | - | ||||||||||||||||||||||||
| 332 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | blend(current_span, spans, &state->penData); | - | ||||||||||||||||||||||||
| 335 | current_span = 0; | - | ||||||||||||||||||||||||
| 336 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | void QCosmeticStroker::drawPoints(const QPointF *points, int num) | - | ||||||||||||||||||||||||
| 339 | { | - | ||||||||||||||||||||||||
| 340 | const QPointF *end = points + num; | - | ||||||||||||||||||||||||
| 341 | while (points < end
| 0 | ||||||||||||||||||||||||
| 342 | QPointF p = (*points) * state->matrix; | - | ||||||||||||||||||||||||
| 343 | drawPixel(this, qRound(p.x()), qRound(p.y()), 255); | - | ||||||||||||||||||||||||
| 344 | ++points; | - | ||||||||||||||||||||||||
| 345 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | blend(current_span, spans, &state->penData); | - | ||||||||||||||||||||||||
| 348 | current_span = 0; | - | ||||||||||||||||||||||||
| 349 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||
| 351 | void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal ry2) | - | ||||||||||||||||||||||||
| 352 | { | - | ||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | - | |||||||||||||||||||||||||
| 360 | lastPixel.x = -1; | - | ||||||||||||||||||||||||
| 361 | lastPixel.y = -1; | - | ||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 | if (clipLine(rx1, ry1, rx2, ry2)
| 0 | ||||||||||||||||||||||||
| 364 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | const int half = legacyRounding
| 0 | ||||||||||||||||||||||||
| 367 | int x1 = ((int)((rx1)*64.)) + half; | - | ||||||||||||||||||||||||
| 368 | int y1 = ((int)((ry1)*64.)) + half; | - | ||||||||||||||||||||||||
| 369 | int x2 = ((int)((rx2)*64.)) + half; | - | ||||||||||||||||||||||||
| 370 | int y2 = ((int)((ry2)*64.)) + half; | - | ||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||
| 372 | int dx = qAbs(x2 - x1); | - | ||||||||||||||||||||||||
| 373 | int dy = qAbs(y2 - y1); | - | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | if (dx < dy
| 0 | ||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | bool swapped = false; | - | ||||||||||||||||||||||||
| 378 | if (y1 > y2
| 0 | ||||||||||||||||||||||||
| 379 | swapped = true; | - | ||||||||||||||||||||||||
| 380 | qSwap(y1, y2); | - | ||||||||||||||||||||||||
| 381 | qSwap(x1, x2); | - | ||||||||||||||||||||||||
| 382 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 383 | int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); | - | ||||||||||||||||||||||||
| 384 | int x = x1 * (1<<10); | - | ||||||||||||||||||||||||
| 385 | - | |||||||||||||||||||||||||
| 386 | int y = (y1 + 32) >> 6; | - | ||||||||||||||||||||||||
| 387 | int ys = (y2 + 32) >> 6; | - | ||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | int round = (
| 0 | ||||||||||||||||||||||||
| 390 | if (y != ys
| 0 | ||||||||||||||||||||||||
| 391 | x += ((y * (1<<6)) + round - y1) * xinc >> 6; | - | ||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | if (swapped
| 0 | ||||||||||||||||||||||||
| 394 | lastPixel.x = x >> 16; | - | ||||||||||||||||||||||||
| 395 | lastPixel.y = y; | - | ||||||||||||||||||||||||
| 396 | lastDir = QCosmeticStroker::BottomToTop; | - | ||||||||||||||||||||||||
| 397 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 398 | lastPixel.x = (x + (ys - y - 1)*xinc) >> 16; | - | ||||||||||||||||||||||||
| 399 | lastPixel.y = ys - 1; | - | ||||||||||||||||||||||||
| 400 | lastDir = QCosmeticStroker::TopToBottom; | - | ||||||||||||||||||||||||
| 401 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 402 | lastAxisAligned = qAbs(xinc) < (1 << 14); | - | ||||||||||||||||||||||||
| 403 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 404 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | if (!dx
| 0 | ||||||||||||||||||||||||
| 407 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||
| 409 | bool swapped = false; | - | ||||||||||||||||||||||||
| 410 | if (x1 > x2
| 0 | ||||||||||||||||||||||||
| 411 | swapped = true; | - | ||||||||||||||||||||||||
| 412 | qSwap(x1, x2); | - | ||||||||||||||||||||||||
| 413 | qSwap(y1, y2); | - | ||||||||||||||||||||||||
| 414 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 415 | int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); | - | ||||||||||||||||||||||||
| 416 | int y = y1 << 10; | - | ||||||||||||||||||||||||
| 417 | - | |||||||||||||||||||||||||
| 418 | int x = (x1 + 32) >> 6; | - | ||||||||||||||||||||||||
| 419 | int xs = (x2 + 32) >> 6; | - | ||||||||||||||||||||||||
| 420 | - | |||||||||||||||||||||||||
| 421 | int round = (
| 0 | ||||||||||||||||||||||||
| 422 | if (x != xs
| 0 | ||||||||||||||||||||||||
| 423 | y += ((x * (1<<6)) + round - x1) * yinc >> 6; | - | ||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | if (swapped
| 0 | ||||||||||||||||||||||||
| 426 | lastPixel.x = x; | - | ||||||||||||||||||||||||
| 427 | lastPixel.y = y >> 16; | - | ||||||||||||||||||||||||
| 428 | lastDir = QCosmeticStroker::RightToLeft; | - | ||||||||||||||||||||||||
| 429 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 430 | lastPixel.x = xs - 1; | - | ||||||||||||||||||||||||
| 431 | lastPixel.y = (y + (xs - x - 1)*yinc) >> 16; | - | ||||||||||||||||||||||||
| 432 | lastDir = QCosmeticStroker::LeftToRight; | - | ||||||||||||||||||||||||
| 433 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 434 | lastAxisAligned = qAbs(yinc) < (1 << 14); | - | ||||||||||||||||||||||||
| 435 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 436 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | } | - | ||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | static inline const QPainterPath::ElementType *subPath(const QPainterPath::ElementType *t, const QPainterPath::ElementType *end, | - | ||||||||||||||||||||||||
| 441 | const qreal *points, bool *closed) | - | ||||||||||||||||||||||||
| 442 | { | - | ||||||||||||||||||||||||
| 443 | const QPainterPath::ElementType *start = t; | - | ||||||||||||||||||||||||
| 444 | ++t; | - | ||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||
| 446 | - | |||||||||||||||||||||||||
| 447 | while (t < end
| 0 | ||||||||||||||||||||||||
| 448 | if (*
| 0 | ||||||||||||||||||||||||
| 449 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 450 | ++t; | - | ||||||||||||||||||||||||
| 451 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||
| 453 | int offset = t - start - 1; | - | ||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||
| 455 | *closed = (points[0] == points[2*offset]
| 0 | ||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | return never executed: t;return t;never executed: return t; | 0 | ||||||||||||||||||||||||
| 458 | } | - | ||||||||||||||||||||||||
| 459 | - | |||||||||||||||||||||||||
| 460 | void QCosmeticStroker::drawPath(const QVectorPath &path) | - | ||||||||||||||||||||||||
| 461 | { | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||
| 464 | if (path.isEmpty()
| 0 | ||||||||||||||||||||||||
| 465 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||
| 467 | const qreal *points = path.points(); | - | ||||||||||||||||||||||||
| 468 | const QPainterPath::ElementType *type = path.elements(); | - | ||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||
| 470 | if (type
| 0 | ||||||||||||||||||||||||
| 471 | const QPainterPath::ElementType *end = type + path.elementCount(); | - | ||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | while (type < end
| 0 | ||||||||||||||||||||||||
| 474 | ((!(type == path.elements() || *type == QPainterPath::MoveToElement)) ? qt_assert("type == path.elements() || *type == QPainterPath::MoveToElement",__FILE__,534) : qt_noop()); | - | ||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | QPointF p = QPointF(points[0], points[1]) * state->matrix; | - | ||||||||||||||||||||||||
| 477 | patternOffset = state->lastPen.dashOffset()*64; | - | ||||||||||||||||||||||||
| 478 | lastPixel.x = (-2147483647 - 1); | - | ||||||||||||||||||||||||
| 479 | lastPixel.y = (-2147483647 - 1); | - | ||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||
| 481 | bool closed; | - | ||||||||||||||||||||||||
| 482 | const QPainterPath::ElementType *e = subPath(type, end, points, &closed); | - | ||||||||||||||||||||||||
| 483 | if (closed
| 0 | ||||||||||||||||||||||||
| 484 | const qreal *p = points + 2*(e-type); | - | ||||||||||||||||||||||||
| 485 | QPointF p1 = QPointF(p[-4], p[-3]) * state->matrix; | - | ||||||||||||||||||||||||
| 486 | QPointF p2 = QPointF(p[-2], p[-1]) * state->matrix; | - | ||||||||||||||||||||||||
| 487 | calculateLastPoint(p1.x(), p1.y(), p2.x(), p2.y()); | - | ||||||||||||||||||||||||
| 488 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 489 | int caps = (!closed
| 0 | ||||||||||||||||||||||||
| 490 | - | |||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||
| 492 | points += 2; | - | ||||||||||||||||||||||||
| 493 | ++type; | - | ||||||||||||||||||||||||
| 494 | - | |||||||||||||||||||||||||
| 495 | while (type < e
| 0 | ||||||||||||||||||||||||
| 496 | QPointF p2 = QPointF(points[0], points[1]) * state->matrix; | - | ||||||||||||||||||||||||
| 497 | switch (*type) { | - | ||||||||||||||||||||||||
| 498 | case never executed: QPainterPath::MoveToElement:case QPainterPath::MoveToElement:never executed: case QPainterPath::MoveToElement: | 0 | ||||||||||||||||||||||||
| 499 | ((!(!"Logic error")) ? qt_assert("!\"Logic error\"",__FILE__,559) : qt_noop()); | - | ||||||||||||||||||||||||
| 500 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 501 | - | |||||||||||||||||||||||||
| 502 | case never executed: QPainterPath::LineToElement:case QPainterPath::LineToElement:never executed: case QPainterPath::LineToElement: | 0 | ||||||||||||||||||||||||
| 503 | if (!closed
| 0 | ||||||||||||||||||||||||
| 504 | caps |= CapEnd; never executed: caps |= CapEnd; | 0 | ||||||||||||||||||||||||
| 505 | stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); | - | ||||||||||||||||||||||||
| 506 | p = p2; | - | ||||||||||||||||||||||||
| 507 | points += 2; | - | ||||||||||||||||||||||||
| 508 | ++type; | - | ||||||||||||||||||||||||
| 509 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||
| 511 | case never executed: QPainterPath::CurveToElement:case QPainterPath::CurveToElement:never executed: {case QPainterPath::CurveToElement: | 0 | ||||||||||||||||||||||||
| 512 | if (!closed
| 0 | ||||||||||||||||||||||||
| 513 | caps |= CapEnd; never executed: caps |= CapEnd; | 0 | ||||||||||||||||||||||||
| 514 | QPointF p3 = QPointF(points[2], points[3]) * state->matrix; | - | ||||||||||||||||||||||||
| 515 | QPointF p4 = QPointF(points[4], points[5]) * state->matrix; | - | ||||||||||||||||||||||||
| 516 | renderCubic(p, p2, p3, p4, caps); | - | ||||||||||||||||||||||||
| 517 | p = p4; | - | ||||||||||||||||||||||||
| 518 | type += 3; | - | ||||||||||||||||||||||||
| 519 | points += 6; | - | ||||||||||||||||||||||||
| 520 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 521 | } | - | ||||||||||||||||||||||||
| 522 | case never executed: QPainterPath::CurveToDataElement:case QPainterPath::CurveToDataElement:never executed: case QPainterPath::CurveToDataElement: | 0 | ||||||||||||||||||||||||
| 523 | ((!(!"QPainterPath::toSubpathPolygons(), bad element type")) ? qt_assert("!\"QPainterPath::toSubpathPolygons(), bad element type\"",__FILE__,583) : qt_noop()); | - | ||||||||||||||||||||||||
| 524 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 525 | } | - | ||||||||||||||||||||||||
| 526 | caps = NoCaps; | - | ||||||||||||||||||||||||
| 527 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 528 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 529 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 530 | QPointF p = QPointF(points[0], points[1]) * state->matrix; | - | ||||||||||||||||||||||||
| 531 | QPointF movedTo = p; | - | ||||||||||||||||||||||||
| 532 | patternOffset = state->lastPen.dashOffset()*64; | - | ||||||||||||||||||||||||
| 533 | lastPixel.x = (-2147483647 - 1); | - | ||||||||||||||||||||||||
| 534 | lastPixel.y = (-2147483647 - 1); | - | ||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||
| 536 | const qreal *begin = points; | - | ||||||||||||||||||||||||
| 537 | const qreal *end = points + 2*path.elementCount(); | - | ||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | bool closed = path.hasImplicitClose()
| 0 | ||||||||||||||||||||||||
| 540 | int caps = (!closed
| 0 | ||||||||||||||||||||||||
| 541 | if (closed
| 0 | ||||||||||||||||||||||||
| 542 | QPointF p2 = QPointF(end[-2], end[-1]) * state->matrix; | - | ||||||||||||||||||||||||
| 543 | calculateLastPoint(p2.x(), p2.y(), p.x(), p.y()); | - | ||||||||||||||||||||||||
| 544 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||
| 546 | bool fastPenAliased = (state->flags.fast_pen
| 0 | ||||||||||||||||||||||||
| 547 | points += 2; | - | ||||||||||||||||||||||||
| 548 | while (points < end
| 0 | ||||||||||||||||||||||||
| 549 | QPointF p2 = QPointF(points[0], points[1]) * state->matrix; | - | ||||||||||||||||||||||||
| 550 | - | |||||||||||||||||||||||||
| 551 | if (!closed
| 0 | ||||||||||||||||||||||||
| 552 | caps |= CapEnd; never executed: caps |= CapEnd; | 0 | ||||||||||||||||||||||||
| 553 | - | |||||||||||||||||||||||||
| 554 | bool moveNextStart = stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); | - | ||||||||||||||||||||||||
| 555 | if (!fastPenAliased
| 0 | ||||||||||||||||||||||||
| 556 | p = p2; never executed: p = p2; | 0 | ||||||||||||||||||||||||
| 557 | points += 2; | - | ||||||||||||||||||||||||
| 558 | caps = NoCaps; | - | ||||||||||||||||||||||||
| 559 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 560 | if (path.hasImplicitClose()
| 0 | ||||||||||||||||||||||||
| 561 | stroke(this, p.x(), p.y(), movedTo.x(), movedTo.y(), NoCaps); never executed: stroke(this, p.x(), p.y(), movedTo.x(), movedTo.y(), NoCaps); | 0 | ||||||||||||||||||||||||
| 562 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||
| 565 | blend(current_span, spans, &state->penData); | - | ||||||||||||||||||||||||
| 566 | current_span = 0; | - | ||||||||||||||||||||||||
| 567 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||
| 569 | void QCosmeticStroker::renderCubic(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4, int caps) | - | ||||||||||||||||||||||||
| 570 | { | - | ||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||
| 572 | const int maxSubDivisions = 6; | - | ||||||||||||||||||||||||
| 573 | PointF points[3*maxSubDivisions + 4]; | - | ||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | points[3].x = p1.x(); | - | ||||||||||||||||||||||||
| 576 | points[3].y = p1.y(); | - | ||||||||||||||||||||||||
| 577 | points[2].x = p2.x(); | - | ||||||||||||||||||||||||
| 578 | points[2].y = p2.y(); | - | ||||||||||||||||||||||||
| 579 | points[1].x = p3.x(); | - | ||||||||||||||||||||||||
| 580 | points[1].y = p3.y(); | - | ||||||||||||||||||||||||
| 581 | points[0].x = p4.x(); | - | ||||||||||||||||||||||||
| 582 | points[0].y = p4.y(); | - | ||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||
| 584 | PointF *p = points; | - | ||||||||||||||||||||||||
| 585 | int level = maxSubDivisions; | - | ||||||||||||||||||||||||
| 586 | - | |||||||||||||||||||||||||
| 587 | renderCubicSubdivision(p, level, caps); | - | ||||||||||||||||||||||||
| 588 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | static void splitCubic(QCosmeticStroker::PointF *points) | - | ||||||||||||||||||||||||
| 591 | { | - | ||||||||||||||||||||||||
| 592 | const qreal half = .5; | - | ||||||||||||||||||||||||
| 593 | qreal a, b, c, d; | - | ||||||||||||||||||||||||
| 594 | - | |||||||||||||||||||||||||
| 595 | points[6].x = points[3].x; | - | ||||||||||||||||||||||||
| 596 | c = points[1].x; | - | ||||||||||||||||||||||||
| 597 | d = points[2].x; | - | ||||||||||||||||||||||||
| 598 | points[1].x = a = ( points[0].x + c ) * half; | - | ||||||||||||||||||||||||
| 599 | points[5].x = b = ( points[3].x + d ) * half; | - | ||||||||||||||||||||||||
| 600 | c = ( c + d ) * half; | - | ||||||||||||||||||||||||
| 601 | points[2].x = a = ( a + c ) * half; | - | ||||||||||||||||||||||||
| 602 | points[4].x = b = ( b + c ) * half; | - | ||||||||||||||||||||||||
| 603 | points[3].x = ( a + b ) * half; | - | ||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||
| 605 | points[6].y = points[3].y; | - | ||||||||||||||||||||||||
| 606 | c = points[1].y; | - | ||||||||||||||||||||||||
| 607 | d = points[2].y; | - | ||||||||||||||||||||||||
| 608 | points[1].y = a = ( points[0].y + c ) * half; | - | ||||||||||||||||||||||||
| 609 | points[5].y = b = ( points[3].y + d ) * half; | - | ||||||||||||||||||||||||
| 610 | c = ( c + d ) * half; | - | ||||||||||||||||||||||||
| 611 | points[2].y = a = ( a + c ) * half; | - | ||||||||||||||||||||||||
| 612 | points[4].y = b = ( b + c ) * half; | - | ||||||||||||||||||||||||
| 613 | points[3].y = ( a + b ) * half; | - | ||||||||||||||||||||||||
| 614 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||
| 616 | void QCosmeticStroker::renderCubicSubdivision(QCosmeticStroker::PointF *points, int level, int caps) | - | ||||||||||||||||||||||||
| 617 | { | - | ||||||||||||||||||||||||
| 618 | if (level
| 0 | ||||||||||||||||||||||||
| 619 | qreal dx = points[3].x - points[0].x; | - | ||||||||||||||||||||||||
| 620 | qreal dy = points[3].y - points[0].y; | - | ||||||||||||||||||||||||
| 621 | qreal len = ((qreal).25) * (qAbs(dx) + qAbs(dy)); | - | ||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||
| 623 | if (qAbs(dx * (points[0].y - points[2].y) - dy * (points[0].x - points[2].x)) >= len
| 0 | ||||||||||||||||||||||||
| 624 | qAbs(dx * (points[0].y - points[1].y) - dy * (points[0].x - points[1].x)) >= len
| 0 | ||||||||||||||||||||||||
| 625 | splitCubic(points); | - | ||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||
| 627 | --level; | - | ||||||||||||||||||||||||
| 628 | renderCubicSubdivision(points + 3, level, caps & CapBegin); | - | ||||||||||||||||||||||||
| 629 | renderCubicSubdivision(points, level, caps & CapEnd); | - | ||||||||||||||||||||||||
| 630 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 631 | } | - | ||||||||||||||||||||||||
| 632 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | stroke(this, points[3].x, points[3].y, points[0].x, points[0].y, caps); | - | ||||||||||||||||||||||||
| 635 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||
| 637 | static inline int swapCaps(int caps) | - | ||||||||||||||||||||||||
| 638 | { | - | ||||||||||||||||||||||||
| 639 | return never executed: ((caps & QCosmeticStroker::CapBegin) << 1) |return ((caps & QCosmeticStroker::CapBegin) << 1) | ((caps & QCosmeticStroker::CapEnd) >> 1);never executed: return ((caps & QCosmeticStroker::CapBegin) << 1) | ((caps & QCosmeticStroker::CapEnd) >> 1); | 0 | ||||||||||||||||||||||||
| 640 | ((caps & QCosmeticStroker::CapEnd) >> 1); never executed: return ((caps & QCosmeticStroker::CapBegin) << 1) | ((caps & QCosmeticStroker::CapEnd) >> 1); | 0 | ||||||||||||||||||||||||
| 641 | } | - | ||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||
| 643 | - | |||||||||||||||||||||||||
| 644 | static inline void capAdjust(int caps, int &x1, int &x2, int &y, int yinc) | - | ||||||||||||||||||||||||
| 645 | { | - | ||||||||||||||||||||||||
| 646 | if (caps & QCosmeticStroker::CapBegin
| 0 | ||||||||||||||||||||||||
| 647 | x1 -= 32; | - | ||||||||||||||||||||||||
| 648 | y -= yinc >> 1; | - | ||||||||||||||||||||||||
| 649 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 650 | if (caps & QCosmeticStroker::CapEnd
| 0 | ||||||||||||||||||||||||
| 651 | x2 += 32; | - | ||||||||||||||||||||||||
| 652 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 653 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||
| 657 | - | |||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||
| 659 | template<DrawPixel drawPixel, class Dasher> | - | ||||||||||||||||||||||||
| 660 | static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) | - | ||||||||||||||||||||||||
| 661 | { | - | ||||||||||||||||||||||||
| 662 | bool didDraw = qAbs(rx2 - rx1) + qAbs(ry2 - ry1) >= 1.0; | - | ||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||
| 664 | if (stroker->clipLine(rx1, ry1, rx2, ry2)
| 0 | ||||||||||||||||||||||||
| 665 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 666 | - | |||||||||||||||||||||||||
| 667 | const int half = stroker->legacyRounding ? 31 : 0; | - | ||||||||||||||||||||||||
| 668 | int x1 = ((int)((rx1)*64.)) + half; | - | ||||||||||||||||||||||||
| 669 | int y1 = ((int)((ry1)*64.)) + half; | - | ||||||||||||||||||||||||
| 670 | int x2 = ((int)((rx2)*64.)) + half; | - | ||||||||||||||||||||||||
| 671 | int y2 = ((int)((ry2)*64.)) + half; | - | ||||||||||||||||||||||||
| 672 | - | |||||||||||||||||||||||||
| 673 | int dx = qAbs(x2 - x1); | - | ||||||||||||||||||||||||
| 674 | int dy = qAbs(y2 - y1); | - | ||||||||||||||||||||||||
| 675 | - | |||||||||||||||||||||||||
| 676 | QCosmeticStroker::Point last = stroker->lastPixel; | - | ||||||||||||||||||||||||
| 677 | - | |||||||||||||||||||||||||
| 678 | - | |||||||||||||||||||||||||
| 679 | - | |||||||||||||||||||||||||
| 680 | if (dx < dy
| 0 | ||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||
| 682 | QCosmeticStroker::Direction dir = QCosmeticStroker::TopToBottom; | - | ||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||
| 684 | bool swapped = false; | - | ||||||||||||||||||||||||
| 685 | if (y1 > y2
| 0 | ||||||||||||||||||||||||
| 686 | swapped = true; | - | ||||||||||||||||||||||||
| 687 | qSwap(y1, y2); | - | ||||||||||||||||||||||||
| 688 | qSwap(x1, x2); | - | ||||||||||||||||||||||||
| 689 | caps = swapCaps(caps); | - | ||||||||||||||||||||||||
| 690 | dir = QCosmeticStroker::BottomToTop; | - | ||||||||||||||||||||||||
| 691 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 692 | int xinc = F16Dot16FixedDiv(x2 - x1, y2 - y1); | - | ||||||||||||||||||||||||
| 693 | int x = x1 * (1<<10); | - | ||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||
| 695 | if ((
| 0 | ||||||||||||||||||||||||
| 696 | caps |= swapped
never executed: caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; | 0 | ||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||
| 698 | capAdjust(caps, y1, y2, x, xinc); | - | ||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | int y = (y1 + 32) >> 6; | - | ||||||||||||||||||||||||
| 701 | int ys = (y2 + 32) >> 6; | - | ||||||||||||||||||||||||
| 702 | int round = (
| 0 | ||||||||||||||||||||||||
| 703 | - | |||||||||||||||||||||||||
| 704 | if (y != ys
| 0 | ||||||||||||||||||||||||
| 705 | x += ((y * (1<<6)) + round - y1) * xinc >> 6; | - | ||||||||||||||||||||||||
| 706 | - | |||||||||||||||||||||||||
| 707 | - | |||||||||||||||||||||||||
| 708 | QCosmeticStroker::Point first; | - | ||||||||||||||||||||||||
| 709 | first.x = x >> 16; | - | ||||||||||||||||||||||||
| 710 | first.y = y; | - | ||||||||||||||||||||||||
| 711 | last.x = (x + (ys - y - 1)*xinc) >> 16; | - | ||||||||||||||||||||||||
| 712 | last.y = ys - 1; | - | ||||||||||||||||||||||||
| 713 | if (swapped
| 0 | ||||||||||||||||||||||||
| 714 | qSwap(first, last); never executed: qSwap(first, last); | 0 | ||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||
| 716 | bool axisAligned = qAbs(xinc) < (1 << 14); | - | ||||||||||||||||||||||||
| 717 | if (stroker->lastPixel.x >= 0
| 0 | ||||||||||||||||||||||||
| 718 | if (first.x == stroker->lastPixel.x
| 0 | ||||||||||||||||||||||||
| 719 | first.y == stroker->lastPixel.y
| 0 | ||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||
| 721 | if (swapped
| 0 | ||||||||||||||||||||||||
| 722 | --ys; | - | ||||||||||||||||||||||||
| 723 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 724 | ++y; | - | ||||||||||||||||||||||||
| 725 | x += xinc; | - | ||||||||||||||||||||||||
| 726 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 727 | } else if (stroker->lastDir != dir
| 0 | ||||||||||||||||||||||||
| 728 | (((axisAligned
| 0 | ||||||||||||||||||||||||
| 729 | stroker->lastPixel.x != first.x
| 0 | ||||||||||||||||||||||||
| 730 | (qAbs(stroker->lastPixel.x - first.x) > 1
| 0 | ||||||||||||||||||||||||
| 731 | qAbs(stroker->lastPixel.y - first.y) > 1
| 0 | ||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||
| 733 | if (swapped
| 0 | ||||||||||||||||||||||||
| 734 | ++ys; | - | ||||||||||||||||||||||||
| 735 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 736 | --y; | - | ||||||||||||||||||||||||
| 737 | x -= xinc; | - | ||||||||||||||||||||||||
| 738 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 739 | } | - | ||||||||||||||||||||||||
| 740 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 741 | stroker->lastDir = dir; | - | ||||||||||||||||||||||||
| 742 | stroker->lastAxisAligned = axisAligned; | - | ||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||
| 744 | Dasher dasher(stroker, swapped, y * (1<<6), ys * (1<<6)); | - | ||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||
| 746 | do { | - | ||||||||||||||||||||||||
| 747 | if (dasher.on()
| 0 | ||||||||||||||||||||||||
| 748 | drawPixel(stroker, x >> 16, y, 255); never executed: drawPixel(stroker, x >> 16, y, 255); | 0 | ||||||||||||||||||||||||
| 749 | dasher.adjust(); | - | ||||||||||||||||||||||||
| 750 | x += xinc; | - | ||||||||||||||||||||||||
| 751 | } never executed: while (++end of block
| 0 | ||||||||||||||||||||||||
| 752 | didDraw = true; | - | ||||||||||||||||||||||||
| 753 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 754 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||
| 756 | if (!dx
| 0 | ||||||||||||||||||||||||
| 757 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 758 | - | |||||||||||||||||||||||||
| 759 | QCosmeticStroker::Direction dir = QCosmeticStroker::LeftToRight; | - | ||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||
| 761 | bool swapped = false; | - | ||||||||||||||||||||||||
| 762 | if (x1 > x2
| 0 | ||||||||||||||||||||||||
| 763 | swapped = true; | - | ||||||||||||||||||||||||
| 764 | qSwap(x1, x2); | - | ||||||||||||||||||||||||
| 765 | qSwap(y1, y2); | - | ||||||||||||||||||||||||
| 766 | caps = swapCaps(caps); | - | ||||||||||||||||||||||||
| 767 | dir = QCosmeticStroker::RightToLeft; | - | ||||||||||||||||||||||||
| 768 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 769 | int yinc = F16Dot16FixedDiv(y2 - y1, x2 - x1); | - | ||||||||||||||||||||||||
| 770 | int y = y1 * (1<<10); | - | ||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||
| 772 | if ((
| 0 | ||||||||||||||||||||||||
| 773 | caps |= swapped
never executed: caps |= swapped ? QCosmeticStroker::CapEnd : QCosmeticStroker::CapBegin; | 0 | ||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||
| 775 | capAdjust(caps, x1, x2, y, yinc); | - | ||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||
| 777 | int x = (x1 + 32) >> 6; | - | ||||||||||||||||||||||||
| 778 | int xs = (x2 + 32) >> 6; | - | ||||||||||||||||||||||||
| 779 | int round = (
| 0 | ||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||
| 781 | if (x != xs
| 0 | ||||||||||||||||||||||||
| 782 | y += ((x * (1<<6)) + round - x1) * yinc >> 6; | - | ||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||
| 785 | QCosmeticStroker::Point first; | - | ||||||||||||||||||||||||
| 786 | first.x = x; | - | ||||||||||||||||||||||||
| 787 | first.y = y >> 16; | - | ||||||||||||||||||||||||
| 788 | last.x = xs - 1; | - | ||||||||||||||||||||||||
| 789 | last.y = (y + (xs - x - 1)*yinc) >> 16; | - | ||||||||||||||||||||||||
| 790 | if (swapped
| 0 | ||||||||||||||||||||||||
| 791 | qSwap(first, last); never executed: qSwap(first, last); | 0 | ||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||
| 793 | bool axisAligned = qAbs(yinc) < (1 << 14); | - | ||||||||||||||||||||||||
| 794 | if (stroker->lastPixel.x >= 0
| 0 | ||||||||||||||||||||||||
| 795 | if (first.x == stroker->lastPixel.x
| 0 | ||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||
| 797 | if (swapped
| 0 | ||||||||||||||||||||||||
| 798 | --xs; | - | ||||||||||||||||||||||||
| 799 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 800 | ++x; | - | ||||||||||||||||||||||||
| 801 | y += yinc; | - | ||||||||||||||||||||||||
| 802 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 803 | } else if (stroker->lastDir != dir
| 0 | ||||||||||||||||||||||||
| 804 | (((axisAligned
| 0 | ||||||||||||||||||||||||
| 805 | stroker->lastPixel.x != first.x
| 0 | ||||||||||||||||||||||||
| 806 | (qAbs(stroker->lastPixel.x - first.x) > 1
| 0 | ||||||||||||||||||||||||
| 807 | qAbs(stroker->lastPixel.y - first.y) > 1
| 0 | ||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||
| 809 | if (swapped
| 0 | ||||||||||||||||||||||||
| 810 | ++xs; | - | ||||||||||||||||||||||||
| 811 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 812 | --x; | - | ||||||||||||||||||||||||
| 813 | y -= yinc; | - | ||||||||||||||||||||||||
| 814 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 815 | } | - | ||||||||||||||||||||||||
| 816 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 817 | stroker->lastDir = dir; | - | ||||||||||||||||||||||||
| 818 | stroker->lastAxisAligned = axisAligned; | - | ||||||||||||||||||||||||
| 819 | - | |||||||||||||||||||||||||
| 820 | Dasher dasher(stroker, swapped, x * (1<<6), xs * (1<<6)); | - | ||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||
| 822 | do { | - | ||||||||||||||||||||||||
| 823 | if (dasher.on()
| 0 | ||||||||||||||||||||||||
| 824 | drawPixel(stroker, x, y >> 16, 255); never executed: drawPixel(stroker, x, y >> 16, 255); | 0 | ||||||||||||||||||||||||
| 825 | dasher.adjust(); | - | ||||||||||||||||||||||||
| 826 | y += yinc; | - | ||||||||||||||||||||||||
| 827 | } never executed: while (++end of block
| 0 | ||||||||||||||||||||||||
| 828 | didDraw = true; | - | ||||||||||||||||||||||||
| 829 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 830 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 831 | stroker->lastPixel = last; | - | ||||||||||||||||||||||||
| 832 | return never executed: didDraw;return didDraw;never executed: return didDraw; | 0 | ||||||||||||||||||||||||
| 833 | } | - | ||||||||||||||||||||||||
| 834 | - | |||||||||||||||||||||||||
| 835 | - | |||||||||||||||||||||||||
| 836 | template<DrawPixel drawPixel, class Dasher> | - | ||||||||||||||||||||||||
| 837 | static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) | - | ||||||||||||||||||||||||
| 838 | { | - | ||||||||||||||||||||||||
| 839 | if (stroker->clipLine(rx1, ry1, rx2, ry2)
| 0 | ||||||||||||||||||||||||
| 840 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 841 | - | |||||||||||||||||||||||||
| 842 | int x1 = ((int)((rx1)*64.)); | - | ||||||||||||||||||||||||
| 843 | int y1 = ((int)((ry1)*64.)); | - | ||||||||||||||||||||||||
| 844 | int x2 = ((int)((rx2)*64.)); | - | ||||||||||||||||||||||||
| 845 | int y2 = ((int)((ry2)*64.)); | - | ||||||||||||||||||||||||
| 846 | - | |||||||||||||||||||||||||
| 847 | int dx = x2 - x1; | - | ||||||||||||||||||||||||
| 848 | int dy = y2 - y1; | - | ||||||||||||||||||||||||
| 849 | - | |||||||||||||||||||||||||
| 850 | if (qAbs(dx) < qAbs(dy)
| 0 | ||||||||||||||||||||||||
| 851 | - | |||||||||||||||||||||||||
| 852 | - | |||||||||||||||||||||||||
| 853 | int xinc = F16Dot16FixedDiv(dx, dy); | - | ||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||
| 855 | bool swapped = false; | - | ||||||||||||||||||||||||
| 856 | if (y1 > y2
| 0 | ||||||||||||||||||||||||
| 857 | qSwap(y1, y2); | - | ||||||||||||||||||||||||
| 858 | qSwap(x1, x2); | - | ||||||||||||||||||||||||
| 859 | swapped = true; | - | ||||||||||||||||||||||||
| 860 | caps = swapCaps(caps); | - | ||||||||||||||||||||||||
| 861 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 862 | - | |||||||||||||||||||||||||
| 863 | int x = (x1 - 32) * (1<<10); | - | ||||||||||||||||||||||||
| 864 | x -= ( ((y1 & 63) - 32) * xinc ) >> 6; | - | ||||||||||||||||||||||||
| 865 | - | |||||||||||||||||||||||||
| 866 | capAdjust(caps, y1, y2, x, xinc); | - | ||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||
| 868 | Dasher dasher(stroker, swapped, y1, y2); | - | ||||||||||||||||||||||||
| 869 | - | |||||||||||||||||||||||||
| 870 | int y = y1 >> 6; | - | ||||||||||||||||||||||||
| 871 | int ys = y2 >> 6; | - | ||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||
| 873 | int alphaStart, alphaEnd; | - | ||||||||||||||||||||||||
| 874 | if (y == ys
| 0 | ||||||||||||||||||||||||
| 875 | alphaStart = y2 - y1; | - | ||||||||||||||||||||||||
| 876 | ((!(alphaStart >= 0 && alphaStart < 64)) ? qt_assert("alphaStart >= 0 && alphaStart < 64",__FILE__,945) : qt_noop()); | - | ||||||||||||||||||||||||
| 877 | alphaEnd = 0; | - | ||||||||||||||||||||||||
| 878 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 879 | alphaStart = 64 - (y1 & 63); | - | ||||||||||||||||||||||||
| 880 | alphaEnd = (y2 & 63); | - | ||||||||||||||||||||||||
| 881 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||
| 883 | - | |||||||||||||||||||||||||
| 884 | - | |||||||||||||||||||||||||
| 885 | - | |||||||||||||||||||||||||
| 886 | if (dasher.on()
| 0 | ||||||||||||||||||||||||
| 887 | uint alpha = (quint8)(x >> 8); | - | ||||||||||||||||||||||||
| 888 | drawPixel(stroker, x>>16, y, (255-alpha) * alphaStart >> 6); | - | ||||||||||||||||||||||||
| 889 | drawPixel(stroker, (x>>16) + 1, y, alpha * alphaStart >> 6); | - | ||||||||||||||||||||||||
| 890 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 891 | dasher.adjust(); | - | ||||||||||||||||||||||||
| 892 | x += xinc; | - | ||||||||||||||||||||||||
| 893 | ++y; | - | ||||||||||||||||||||||||
| 894 | if (y < ys
| 0 | ||||||||||||||||||||||||
| 895 | do { | - | ||||||||||||||||||||||||
| 896 | if (dasher.on()
| 0 | ||||||||||||||||||||||||
| 897 | uint alpha = (quint8)(x >> 8); | - | ||||||||||||||||||||||||
| 898 | drawPixel(stroker, x>>16, y, (255-alpha)); | - | ||||||||||||||||||||||||
| 899 | drawPixel(stroker, (x>>16) + 1, y, alpha); | - | ||||||||||||||||||||||||
| 900 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 901 | dasher.adjust(); | - | ||||||||||||||||||||||||
| 902 | x += xinc; | - | ||||||||||||||||||||||||
| 903 | } never executed: while (++end of block
| 0 | ||||||||||||||||||||||||
| 904 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 905 | - | |||||||||||||||||||||||||
| 906 | if (alphaEnd
| 0 | ||||||||||||||||||||||||
| 907 | uint alpha = (quint8)(x >> 8); | - | ||||||||||||||||||||||||
| 908 | drawPixel(stroker, x>>16, y, (255-alpha) * alphaEnd >> 6); | - | ||||||||||||||||||||||||
| 909 | drawPixel(stroker, (x>>16) + 1, y, alpha * alphaEnd >> 6); | - | ||||||||||||||||||||||||
| 910 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 911 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||
| 913 | if (!dx
| 0 | ||||||||||||||||||||||||
| 914 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 915 | - | |||||||||||||||||||||||||
| 916 | int yinc = F16Dot16FixedDiv(dy, dx); | - | ||||||||||||||||||||||||
| 917 | - | |||||||||||||||||||||||||
| 918 | bool swapped = false; | - | ||||||||||||||||||||||||
| 919 | if (x1 > x2
| 0 | ||||||||||||||||||||||||
| 920 | qSwap(x1, x2); | - | ||||||||||||||||||||||||
| 921 | qSwap(y1, y2); | - | ||||||||||||||||||||||||
| 922 | swapped = true; | - | ||||||||||||||||||||||||
| 923 | caps = swapCaps(caps); | - | ||||||||||||||||||||||||
| 924 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||
| 926 | int y = (y1 - 32) * (1<<10); | - | ||||||||||||||||||||||||
| 927 | y -= ( ((x1 & 63) - 32) * yinc ) >> 6; | - | ||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||
| 929 | capAdjust(caps, x1, x2, y, yinc); | - | ||||||||||||||||||||||||
| 930 | - | |||||||||||||||||||||||||
| 931 | Dasher dasher(stroker, swapped, x1, x2); | - | ||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||
| 933 | int x = x1 >> 6; | - | ||||||||||||||||||||||||
| 934 | int xs = x2 >> 6; | - | ||||||||||||||||||||||||
| 935 | - | |||||||||||||||||||||||||
| 936 | - | |||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||
| 938 | int alphaStart, alphaEnd; | - | ||||||||||||||||||||||||
| 939 | if (x == xs
| 0 | ||||||||||||||||||||||||
| 940 | alphaStart = x2 - x1; | - | ||||||||||||||||||||||||
| 941 | ((!(alphaStart >= 0 && alphaStart < 64)) ? qt_assert("alphaStart >= 0 && alphaStart < 64",__FILE__,1010) : qt_noop()); | - | ||||||||||||||||||||||||
| 942 | alphaEnd = 0; | - | ||||||||||||||||||||||||
| 943 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 944 | alphaStart = 64 - (x1 & 63); | - | ||||||||||||||||||||||||
| 945 | alphaEnd = (x2 & 63); | - | ||||||||||||||||||||||||
| 946 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||
| 948 | - | |||||||||||||||||||||||||
| 949 | if (dasher.on()
| 0 | ||||||||||||||||||||||||
| 950 | uint alpha = (quint8)(y >> 8); | - | ||||||||||||||||||||||||
| 951 | drawPixel(stroker, x, y>>16, (255-alpha) * alphaStart >> 6); | - | ||||||||||||||||||||||||
| 952 | drawPixel(stroker, x, (y>>16) + 1, alpha * alphaStart >> 6); | - | ||||||||||||||||||||||||
| 953 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 954 | dasher.adjust(); | - | ||||||||||||||||||||||||
| 955 | y += yinc; | - | ||||||||||||||||||||||||
| 956 | ++x; | - | ||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | if (x < xs
| 0 | ||||||||||||||||||||||||
| 959 | do { | - | ||||||||||||||||||||||||
| 960 | if (dasher.on()
| 0 | ||||||||||||||||||||||||
| 961 | uint alpha = (quint8)(y >> 8); | - | ||||||||||||||||||||||||
| 962 | drawPixel(stroker, x, y>>16, (255-alpha)); | - | ||||||||||||||||||||||||
| 963 | drawPixel(stroker, x, (y>>16) + 1, alpha); | - | ||||||||||||||||||||||||
| 964 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 965 | dasher.adjust(); | - | ||||||||||||||||||||||||
| 966 | y += yinc; | - | ||||||||||||||||||||||||
| 967 | } never executed: while (++end of block
| 0 | ||||||||||||||||||||||||
| 968 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||
| 970 | if (alphaEnd
| 0 | ||||||||||||||||||||||||
| 971 | uint alpha = (quint8)(y >> 8); | - | ||||||||||||||||||||||||
| 972 | drawPixel(stroker, x, y>>16, (255-alpha) * alphaEnd >> 6); | - | ||||||||||||||||||||||||
| 973 | drawPixel(stroker, x, (y>>16) + 1, alpha * alphaEnd >> 6); | - | ||||||||||||||||||||||||
| 974 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 975 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 976 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 977 | } | - | ||||||||||||||||||||||||
| 978 | - | |||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |