From 4db44bc32f9a08e89391aa3d99a01060a4f10737 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 22 Jul 2020 12:50:00 +0200 Subject: [PATCH] Allow smooth curve stroking for very wide lines The earlier limit set on the curve threshold turned out to be too strict, leading to visibly bad rendering in reasonable use cases. Ref. 5322998a0ba80b1e095340245ddb00aaf5947be9 As a drive-by, add a missing fixed-to-real conversion. (This is a no-op in a default build, where qfixed==qreal.) Fixes: QTBUG-85193 Pick-to: 5.15 5.12 Change-Id: I7cc3543d7aa4e90643b275686372400879decef2 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qstroker_p.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h index 0a9f55f222..28b55f8431 100644 --- a/src/gui/painting/qstroker_p.h +++ b/src/gui/painting/qstroker_p.h @@ -209,7 +209,11 @@ public: QStroker(); ~QStroker(); - void setStrokeWidth(qfixed width) { m_strokeWidth = width; m_curveThreshold = qt_real_to_fixed(qBound(0.025, 1.0/width, 0.25)); } + void setStrokeWidth(qfixed width) + { + m_strokeWidth = width; + m_curveThreshold = qt_real_to_fixed(qBound(0.00025, 1.0 / qt_fixed_to_real(width), 0.25)); + } qfixed strokeWidth() const { return m_strokeWidth; } void setCapStyle(Qt::PenCapStyle capStyle) { m_capStyle = joinModeForCap(capStyle); }