Report 2.x scale factor for UIView on visionOS
The docs claim that this is the default, but in practice it's not the case. Change-Id: I5f6184cbfded2efedbac88023644d3c1e80e9901 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit a05f5457ca033214c1efcf528b85a09a9c758920) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
ad8b330ecc
commit
c410163173
@ -322,7 +322,10 @@ QDpi QIOSScreen::logicalBaseDpi() const
|
|||||||
qreal QIOSScreen::devicePixelRatio() const
|
qreal QIOSScreen::devicePixelRatio() const
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_VISIONOS)
|
#if defined(Q_OS_VISIONOS)
|
||||||
return 2.0; // Based on what iPad app reports
|
// Based on what iPad app reports, and what Apple
|
||||||
|
// documents to be the default scale factor on
|
||||||
|
// visionOS, and the minimum scale for assets.
|
||||||
|
return 2.0;
|
||||||
#else
|
#else
|
||||||
return [m_uiScreen scale];
|
return [m_uiScreen scale];
|
||||||
#endif
|
#endif
|
||||||
|
@ -139,6 +139,14 @@ inline ulong getTimeStamp(UIEvent *event)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_VISIONOS)
|
||||||
|
// Although the "Drawing sharp layer-based content in visionOS" docs
|
||||||
|
// claim that by default a CALayer rasterizes at a 2x scale this does
|
||||||
|
// not seem to be the case in practice. So we explicitly set the view's
|
||||||
|
// scale factor based on the screen, where we hard-code it to 2.0.
|
||||||
|
self.contentScaleFactor = self.platformWindow->screen()->devicePixelRatio();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user