diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2018-08-31 15:13:28 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2018-09-25 12:32:24 +0000 |
commit | b233ce66d3c25acff514157cfe5c7a4edd9ca7c9 (patch) | |
tree | 1a7b41fb478ea01aeb0688b51d9b5e24ac82a94a /src/gui/painting | |
parent | 213cfc3faee121411fcaac9f99bb5ffd94429384 (diff) |
QPainter cosmetic stroker: Fix painting error for FlatCap lines
Initialize the lastDir properly, to avoid the stroking algorithm doing
direction-change handling for a single line. That could cause a cap to
be painted for a single FlatCap line.
Also fixes a bug in tst_qpainter, revealed by the above fix. The
result drawPolyline was erroneously compared to the result of drawing
the lines individually, for a case where the former correctly paints
the pixel of the join point in the corner, while the latter by
coincidence used to paint the same pixel as a cap because of the bug
above.
Task-number: QTBUG-70101
Change-Id: Ie20eda33214cfe9e7627f17ef4c7a5b3835c9c24
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qcosmeticstroker_p.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h index 68f4e00cdc..082ddee30f 100644 --- a/src/gui/painting/qcosmeticstroker_p.h +++ b/src/gui/painting/qcosmeticstroker_p.h @@ -85,6 +85,7 @@ public: // used to avoid drop outs or duplicated points enum Direction { + NoDirection = 0, TopToBottom = 0x1, BottomToTop = 0x2, LeftToRight = 0x4, @@ -104,7 +105,7 @@ public: patternOffset(0), legacyRounding(false), current_span(0), - lastDir(LeftToRight), + lastDir(NoDirection), lastAxisAligned(false) { setup(); } |