diff options
author | Morten Sørvig <morten.sorvig@qt.io> | 2023-11-09 14:57:02 +0100 |
---|---|---|
committer | Morten Sørvig <morten.sorvig@qt.io> | 2023-11-23 19:26:49 +0100 |
commit | 9e740c7266fb72c3e9dfcfde9912510180b600c2 (patch) | |
tree | 7492dd91944319aebf563e6b3172bad652373df3 /src/gui/painting/qpainter.cpp | |
parent | 67fa2585ac48e64972d1c0a20b3add5c3ef72e51 (diff) |
QPainter: support painting at DPR < 1
QPainter was clamping the DPR at 1, which makes Qt paint
a blank window when the DPR is less than 1. Fix by
not clamping and treating only DPR == 1 as a special
case.
This is particularly relevant on Qt for WebAssembly
where the user can set the page scale to a value less
than 100%.
Fixes: QTBUG-111787
Change-Id: Iaa1f7a9b7837dd933c28380b5049422dc1ce9657
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/painting/qpainter.cpp')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 5e3842cbcc..70bcd92fdd 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -221,7 +221,7 @@ qreal QPainterPrivate::effectiveDevicePixelRatio() const if (device->devType() == QInternal::Printer) return qreal(1); - return qMax(qreal(1), device->devicePixelRatio()); + return device->devicePixelRatio(); } QTransform QPainterPrivate::hidpiScaleTransform() const @@ -1824,7 +1824,7 @@ bool QPainter::begin(QPaintDevice *pd) Q_ASSERT(d->engine->isActive()); - if (!d->state->redirectionMatrix.isIdentity() || d->effectiveDevicePixelRatio() > 1) + if (!d->state->redirectionMatrix.isIdentity() || !qFuzzyCompare(d->effectiveDevicePixelRatio(), qreal(1.0))) d->updateMatrix(); Q_ASSERT(d->engine->isActive()); |