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>
This commit is contained in:
parent
67fa2585ac
commit
9e740c7266
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user