summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qcosmeticstroker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qcosmeticstroker.cpp')
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index 5cbcdf83d4..ba0d1871d1 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -147,12 +147,14 @@ inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage)
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 > 0) {
+ const int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ;
+ const 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;
+ 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);