qt5/src/ArthurOutputDev.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
New commits: commit 5e1a83dbdc065504291528554cb11ab8fabeb5f6 Author: Oliver Sander <oliver.san...@tu-dresden.de> Date: Wed Mar 25 21:14:34 2020 +0100 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 diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc index 3ec78e06..3afe908a 100644 --- a/qt5/src/ArthurOutputDev.cc +++ b/qt5/src/ArthurOutputDev.cc @@ -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; } m_currentPen.setDashPattern(pattern); m_currentPen.setDashOffset(dashStart); _______________________________________________ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler