铃溪 |
2017-07-26 16:23 |
谢谢,学习了,
后面还是看不太明白,谢谢大神了
/*QRasterPaintEngine 画点函数*/ void QRasterPaintEngine::drawPoints(const QPointF *points, int pointCount) { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state();
ensurePen(); if (!s->penData.blend) return;
if (!s->flags.fast_pen) { QPaintEngineEx::drawPoints(points, pointCount); return; }
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); stroker.drawPoints(points, pointCount); }
void QCosmeticStroker::drawPoints(const QPoint *points, int num) { const QPoint *end = points + num; while (points < end) { QPointF p = QPointF(*points) * state->matrix; drawPixel(this, qRound(p.x()), qRound(p.y()), 255); ++points; }
blend(current_span, spans, &state->penData); current_span = 0; }
inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) { const QRect &cl = stroker->clip; if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom()) return;
int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; int lasty = stroker->spans[stroker->current_span-1].y;
if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); stroker->current_span = 0; }
stroker->spans[stroker->current_span].x = ushort(x); stroker->spans[stroker->current_span].len = 1; stroker->spans[stroker->current_span].y = y; stroker->spans[stroker->current_span].coverage = coverage*stroker->opacity >> 8; ++stroker->current_span; } |
|