diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2017-08-18 10:19:48 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-08-22 18:42:07 +0000 |
commit | 29d29cb250c043eeefbac59f94813dcb5e21ec03 (patch) | |
tree | 968e8e8c8b3f04afb07461d38cb1d8e54cb85d8e | |
parent | c86a75e9e5fac56f0a9c87ce87264f8f020791ce (diff) |
Fix huge painting artefact of certain dashed lines
The artefacts appeared for square-capped dashed pens when the end of
the line fell a tiny fraction into the start of a new dash. At that
point in the dashing algorithm, accumulated precision errors in the
'length' variable could make it slightly differ from the actual length
between the start and end points of the line fragment. Although both
values would be "almost zero", the rasterizeLine() function's square
capping would make the error very visible; see the bug report.
Fix by calculating the precise length of the last line fragment.
Task-number: QTBUG-56969
Change-Id: I7b69c0d465649be61fb87ac7b8348f0c299486ee
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 73573fce295caef35da706a8c8c796ec18e6baf1)
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 6a5bf4d537..6ad8533481 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3164,7 +3164,7 @@ void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line, QLineF l = line; if (dash >= length) { - dash = length; + dash = line.length(); // Avoid accumulated precision error in 'length' *dashOffset += dash / width; length = 0; } else { |