diff options
author | Liang Qi <liang.qi@qt.io> | 2019-06-20 07:50:44 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-06-20 07:50:44 +0200 |
commit | bd9959bde290168b0635cb878d7d189e1f9c4b4f (patch) | |
tree | 1a4d5a0eff8d6acaff26ae4ff4ded8ca71b76a06 /src/gui/painting | |
parent | b877285694501d16b2bb0dc8d1a92e185b079b87 (diff) | |
parent | 6398588338dfea4161704e01216ba70b216a7a0b (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
.qmake.conf
src/gui/painting/qdrawhelper.cpp
src/network/ssl/qsslsocket_openssl.cpp
src/widgets/styles/qstylesheetstyle.cpp
Change-Id: Ibe1cd40f46a823c9e5edbe0a3cd16be1e1686b17
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 37 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 50 | ||||
-rw-r--r-- | src/gui/painting/qstroker.cpp | 2 |
3 files changed, 55 insertions, 34 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 2dd18f6dfc..10d97556bc 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -4510,7 +4510,9 @@ static void blend_color_rgb16(int count, const QSpan *spans, void *userData) if (mode == QPainter::CompositionMode_Source) { // inline for performance ushort c = data->solidColor.toRgb16(); - while (count--) { + for (; count--; spans++) { + if (!spans->len) + continue; ushort *target = ((ushort *)data->rasterBuffer->scanLine(spans->y)) + spans->x; if (spans->coverage == 255) { qt_memfill(target, c, spans->len); @@ -4523,13 +4525,14 @@ static void blend_color_rgb16(int count, const QSpan *spans, void *userData) ++target; } } - ++spans; } return; } if (mode == QPainter::CompositionMode_SourceOver) { - while (count--) { + for (; count--; spans++) { + if (!spans->len) + continue; uint color = BYTE_MUL(data->solidColor.toArgb32(), spans->coverage); int ialpha = qAlpha(~color); ushort c = qConvertRgb32To16(color); @@ -4561,7 +4564,6 @@ static void blend_color_rgb16(int count, const QSpan *spans, void *userData) // one last pixel beyond a full word *target = c + BYTE_MUL_RGB16(*target, ialpha); } - ++spans; } return; } @@ -4578,6 +4580,11 @@ void handleSpans(int count, const QSpan *spans, const QSpanData *data, T &handle int coverage = 0; while (count) { + if (!spans->len) { + ++spans; + --count; + continue; + } int x = spans->x; const int y = spans->y; int right = x + spans->len; @@ -4730,7 +4737,9 @@ static void blend_untransformed_generic(int count, const QSpan *spans, void *use int xoff = -qRound(-data->dx); int yoff = -qRound(-data->dy); - while (count--) { + for (; count--; spans++) { + if (!spans->len) + continue; int x = spans->x; int length = spans->len; int sx = xoff + x; @@ -4758,7 +4767,6 @@ static void blend_untransformed_generic(int count, const QSpan *spans, void *use } } } - ++spans; } } @@ -4779,7 +4787,9 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi int xoff = -qRound(-data->dx); int yoff = -qRound(-data->dy); - while (count--) { + for (; count--; spans++) { + if (!spans->len) + continue; int x = spans->x; int length = spans->len; int sx = xoff + x; @@ -4807,7 +4817,6 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi } } } - ++spans; } } @@ -4827,7 +4836,9 @@ static void blend_untransformed_argb(int count, const QSpan *spans, void *userDa int xoff = -qRound(-data->dx); int yoff = -qRound(-data->dy); - while (count--) { + for (; count--; spans++) { + if (!spans->len) + continue; int x = spans->x; int length = spans->len; int sx = xoff + x; @@ -4847,7 +4858,6 @@ static void blend_untransformed_argb(int count, const QSpan *spans, void *userDa op.func(dest, src, length, coverage); } } - ++spans; } } @@ -4920,7 +4930,12 @@ static void blend_untransformed_rgb565(int count, const QSpan *spans, void *user int xoff = -qRound(-data->dx); int yoff = -qRound(-data->dy); - while (count--) { + const QSpan *end = spans + count; + while (spans < end) { + if (!spans->len) { + ++spans; + continue; + } const quint8 coverage = (data->texture.const_alpha * spans->coverage) >> 8; if (coverage == 0) { ++spans; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 65319c0804..2d2041c907 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -4183,7 +4183,7 @@ static void qt_span_fill_clipped(int spanCount, const QSpan *spans, void *userDa Clip spans to \a{clip}-rectangle. Returns number of unclipped spans */ -static int qt_intersect_spans(QT_FT_Span *spans, int numSpans, +static int qt_intersect_spans(QT_FT_Span *&spans, int numSpans, const QRect &clip) { const short minx = clip.left(); @@ -4191,29 +4191,32 @@ static int qt_intersect_spans(QT_FT_Span *spans, int numSpans, const short maxx = clip.right(); const short maxy = clip.bottom(); - int n = 0; - for (int i = 0; i < numSpans; ++i) { - if (spans[i].y > maxy) + QT_FT_Span *end = spans + numSpans; + while (spans < end) { + if (spans->y >= miny) break; - if (spans[i].y < miny - || spans[i].x > maxx - || spans[i].x + spans[i].len <= minx) { + ++spans; + } + + QT_FT_Span *s = spans; + while (s < end) { + if (s->y > maxy) + break; + if (s->x > maxx || s->x + s->len <= minx) { + s->len = 0; + ++s; continue; } - if (spans[i].x < minx) { - spans[n].len = qMin(spans[i].len - (minx - spans[i].x), maxx - minx + 1); - spans[n].x = minx; + if (s->x < minx) { + s->len = qMin(s->len - (minx - s->x), maxx - minx + 1); + s->x = minx; } else { - spans[n].x = spans[i].x; - spans[n].len = qMin(spans[i].len, ushort(maxx - spans[n].x + 1)); + s->len = qMin(s->len, ushort(maxx - s->x + 1)); } - if (spans[n].len == 0) - continue; - spans[n].y = spans[i].y; - spans[n].coverage = spans[i].coverage; - ++n; + ++s; } - return n; + + return s - spans; } @@ -4226,11 +4229,12 @@ static void qt_span_fill_clipRect(int count, const QSpan *spans, Q_ASSERT(fillData->clip); Q_ASSERT(!fillData->clip->clipRect.isEmpty()); + QSpan *s = const_cast<QSpan *>(spans); // hw: check if this const_cast<> is safe!!! - count = qt_intersect_spans(const_cast<QSpan*>(spans), count, + count = qt_intersect_spans(s, count, fillData->clip->clipRect); if (count > 0) - fillData->unclipped_blend(count, spans, fillData); + fillData->unclipped_blend(count, s, fillData); } static void qt_span_clip(int count, const QSpan *spans, void *userData) @@ -4843,7 +4847,8 @@ static inline void drawEllipsePoints(int x, int y, int length, if (length == 0) return; - QT_FT_Span outline[4]; + QT_FT_Span _outline[4]; + QT_FT_Span *outline = _outline; const int midx = rect.x() + (rect.width() + 1) / 2; const int midy = rect.y() + (rect.height() + 1) / 2; @@ -4875,7 +4880,8 @@ static inline void drawEllipsePoints(int x, int y, int length, outline[3].coverage = 255; if (brush_func && outline[0].x + outline[0].len < outline[1].x) { - QT_FT_Span fill[2]; + QT_FT_Span _fill[2]; + QT_FT_Span *fill = _fill; // top fill fill[0].x = outline[0].x + outline[0].len - 1; diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index 327190b678..90c06788e1 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -525,7 +525,7 @@ void QStroker::joinPoints(qfixed focal_x, qfixed focal_y, const QLineF &nextLine QLineF shortCut(prevLine.p2(), nextLine.p1()); qreal angle = shortCut.angleTo(prevLine); - if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { + if ((type == QLineF::BoundedIntersection || (angle > qreal(90.01))) && nextLine.length() > offset) { emitLineTo(focal_x, focal_y); emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); return; |