summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-06-25 11:17:32 +0200
committerLiang Qi <liang.qi@qt.io>2019-06-25 13:04:27 +0200
commitef37ab9970ffb9347bc95a3e6006de956c0155c9 (patch)
tree4c6afb6d232c6ed8aab732763ef895e8bd85ec55 /src/gui/painting/qdrawhelper.cpp
parent79bdc7cf1daec75df59de9236599a9f24077511a (diff)
parent5b5e8f78fecbe2bd9279bfa9ef10015cef8b1bc7 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts: .qmake.conf src/gui/painting/qdrawhelper.cpp src/gui/text/qdistancefield.cpp src/gui/text/qdistancefield_p.h src/network/ssl/qsslsocket_openssl.cpp src/plugins/platforms/android/qandroidinputcontext.cpp src/widgets/styles/qstylesheetstyle.cpp Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: Ia7daad21f077ea889898f17734ec46303e71fe6b
Diffstat (limited to 'src/gui/painting/qdrawhelper.cpp')
-rw-r--r--src/gui/painting/qdrawhelper.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index ac15d8f4f4..006befea22 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -4566,7 +4566,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);
@@ -4579,13 +4581,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);
@@ -4617,7 +4620,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;
}
@@ -4634,6 +4636,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;
@@ -4790,7 +4797,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;
@@ -4818,7 +4827,6 @@ static void blend_untransformed_generic(int count, const QSpan *spans, void *use
}
}
}
- ++spans;
}
}
@@ -4840,7 +4848,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;
@@ -4868,7 +4878,6 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi
}
}
}
- ++spans;
}
}
#endif
@@ -4889,7 +4898,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;
@@ -4909,7 +4920,6 @@ static void blend_untransformed_argb(int count, const QSpan *spans, void *userDa
op.func(dest, src, length, coverage);
}
}
- ++spans;
}
}
@@ -4982,7 +4992,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;