diff options
| author | Mikolaj Boc <mikolaj.boc@qt.io> | 2022-10-24 13:34:29 +0200 |
|---|---|---|
| committer | Mikolaj Boc <mikolaj.boc@qt.io> | 2022-10-25 08:08:32 +0200 |
| commit | d553ec049d3496240a2af6b04be14cf124cb1a4d (patch) | |
| tree | fd6dd17f6109903222d6b9a23715c24d939ac840 /src/plugins/platforms/wasm/qwasmbackingstore.cpp | |
| parent | 739fb9823306adf69316dfce5c1f1a53c735677f (diff) | |
Make Qt on WASM correctly draw windows with QT_SCALE_FACTOR
The GUI scale factor was taken into account twice, once in
QBackingStore::resize and then again implicitly in
QWasmBackingStore::resize, through window()->devicePixelRatio(),
which contains it as one of its multipliers.
Fixes: QTBUG-80992
Pick-to: 6.4
Change-Id: I75ac8d85c14230207379b789834256de4254811b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmbackingstore.cpp')
| -rw-r--r-- | src/plugins/platforms/wasm/qwasmbackingstore.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/wasm/qwasmbackingstore.cpp b/src/plugins/platforms/wasm/qwasmbackingstore.cpp index 594dcaa8128..05a5a1bbdbd 100644 --- a/src/plugins/platforms/wasm/qwasmbackingstore.cpp +++ b/src/plugins/platforms/wasm/qwasmbackingstore.cpp @@ -126,7 +126,7 @@ void QWasmBackingStore::beginPaint(const QRegion ®ion) { m_dirty |= region; // Keep backing store device pixel ratio in sync with window - if (m_image.devicePixelRatio() != window()->devicePixelRatio()) + if (m_image.devicePixelRatio() != window()->handle()->devicePixelRatio()) resize(backingStore()->size(), backingStore()->staticContents()); QPainter painter(&m_image); @@ -145,8 +145,9 @@ void QWasmBackingStore::resize(const QSize &size, const QRegion &staticContents) QImage::Format format = window()->format().hasAlpha() ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; - m_image = QImage(size * window()->devicePixelRatio(), format); - m_image.setDevicePixelRatio(window()->devicePixelRatio()); + const auto platformScreenDPR = window()->handle()->devicePixelRatio(); + m_image = QImage(size * platformScreenDPR, format); + m_image.setDevicePixelRatio(platformScreenDPR); m_recreateTexture = true; } |
