Fix QT_WIDGETS_HIGHDPI_DOWNSCALE
The source rect scaling implemented in79bead6c
was incorrect for child windows with an offset, and was reverted in commitd59b2fde
, after causing QTBUG-107814. Scale the window rect by the source device pixel ratio to get the source rect. This source DPR can be different from the (target) DPR when HIGHDPI_DOWNSCALE is enabled and will then be a rounded DPR value. Pick-to: 6.5 Fixes: QTBUG-111102 Task-number: QTBUG-107814 Change-Id: I59801bc22c47fc83d63ae4d96e509ab7fffeb760 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
parent
f8dba0395f
commit
2d76f991d0
@ -522,14 +522,16 @@ QPlatformBackingStore::FlushResult QBackingStoreDefaultCompositor::flush(QPlatfo
|
||||
|
||||
const qreal dpr = window->devicePixelRatio();
|
||||
const QRect deviceWindowRect = scaledRect(QRect(QPoint(), window->size()), dpr);
|
||||
const QPoint deviceWindowOffset = scaledOffset(offset, dpr);
|
||||
|
||||
const bool invertTargetY = rhi->clipSpaceCorrMatrix().data()[5] < 0.0f;
|
||||
const bool invertSource = rhi->isYUpInFramebuffer() != rhi->isYUpInNDC();
|
||||
if (m_texture) {
|
||||
// The backingstore is for the entire tlw.
|
||||
// In case of native children offset tells the position relative to the tlw.
|
||||
const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(deviceWindowOffset), m_texture->pixelSize().height());
|
||||
// The backingstore is for the entire tlw. In case of native children, offset tells the position
|
||||
// relative to the tlw. The window rect is scaled by the source device pixel ratio to get
|
||||
// the source rect.
|
||||
const QRect sourceWindowRect = scaledRect(QRect(QPoint(), window->size()), sourceDevicePixelRatio);
|
||||
const QPoint sourceWindowOffset = scaledOffset(offset, sourceDevicePixelRatio);
|
||||
const QRect srcRect = toBottomLeftRect(sourceWindowRect.translated(sourceWindowOffset), m_texture->pixelSize().height());
|
||||
const QMatrix3x3 source = sourceTransform(srcRect, m_texture->pixelSize(), origin);
|
||||
QMatrix4x4 target; // identity
|
||||
if (invertTargetY)
|
||||
|
Loading…
Reference in New Issue
Block a user