Commit 5e1a83db authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid

Avoid division by zero in updateLineDash

Qt measures dash patterns in terms of line width.
This means that you have to divide by the width,
which doesn't work if the line width is 'cosmetic',
i.e., zero. The Qt documentation states that this
case should be treated as if the line width
was 1 pixel.

BUG: 695
parent 170aa09a
......@@ -268,10 +268,17 @@ void ArthurOutputDev::updateLineDash(GfxState *state)
QVector<qreal> pattern(dashLength);
double scaling = state->getLineWidth();
// Negative line widths are not allowed, width 0 counts as 'one pixel width'.
if (scaling <= 0) {
scaling = 1.0;
for (int i = 0; i < dashLength; ++i) {
// pdf measures the dash pattern in dots, but Qt uses the
// line width as the unit.
pattern[i] = dashPattern[i] / state->getLineWidth();
pattern[i] = dashPattern[i] / scaling;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment