EGLFS: Don’t compute logical DPI from physical size
Remove code which computes logical DPI from the screen’s physical size. Return a DPI of 100 instead (this value was previously returned if the physical size was not available), and add a matching logicalBaseDpi() implementation which gives a device pixel ratio of 1. Task-number: QTBUG-87035 Change-Id: Ib20afbbd24fd6b57c8ffb2fd697f1becba283cba Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
b3637a7bfb
commit
59498964c9
@ -224,13 +224,11 @@ QSize QEglFSDeviceIntegration::screenSize() const
|
||||
|
||||
QDpi QEglFSDeviceIntegration::logicalDpi() const
|
||||
{
|
||||
const QSizeF ps = physicalScreenSize();
|
||||
const QSize s = screenSize();
|
||||
return QDpi(100, 100);
|
||||
}
|
||||
|
||||
if (!ps.isEmpty() && !s.isEmpty())
|
||||
return QDpi(25.4 * s.width() / ps.width(),
|
||||
25.4 * s.height() / ps.height());
|
||||
else
|
||||
QDpi QEglFSDeviceIntegration::logicalBaseDpi() const
|
||||
{
|
||||
return QDpi(100, 100);
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
virtual QSizeF physicalScreenSize() const;
|
||||
virtual QSize screenSize() const;
|
||||
virtual QDpi logicalDpi() const;
|
||||
virtual QDpi logicalBaseDpi() const;
|
||||
virtual Qt::ScreenOrientation nativeOrientation() const;
|
||||
virtual Qt::ScreenOrientation orientation() const;
|
||||
virtual int screenDepth() const;
|
||||
|
@ -115,6 +115,11 @@ QDpi QEglFSScreen::logicalDpi() const
|
||||
return qt_egl_device_integration()->logicalDpi();
|
||||
}
|
||||
|
||||
QDpi QEglFSScreen::logicalBaseDpi() const
|
||||
{
|
||||
return qt_egl_device_integration()->logicalBaseDpi();
|
||||
}
|
||||
|
||||
Qt::ScreenOrientation QEglFSScreen::nativeOrientation() const
|
||||
{
|
||||
return qt_egl_device_integration()->nativeOrientation();
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
|
||||
QSizeF physicalSize() const override;
|
||||
QDpi logicalDpi() const override;
|
||||
QDpi logicalBaseDpi() const override;
|
||||
Qt::ScreenOrientation nativeOrientation() const override;
|
||||
Qt::ScreenOrientation orientation() const override;
|
||||
|
||||
|
@ -75,13 +75,11 @@ QSizeF QEglFSEmulatorScreen::physicalSize() const
|
||||
|
||||
QDpi QEglFSEmulatorScreen::logicalDpi() const
|
||||
{
|
||||
const QSizeF ps = m_physicalSize;
|
||||
const QSize s = m_geometry.size();
|
||||
return logicalBaseDpi();
|
||||
}
|
||||
|
||||
if (!ps.isEmpty() && !s.isEmpty())
|
||||
return QDpi(25.4 * s.width() / ps.width(),
|
||||
25.4 * s.height() / ps.height());
|
||||
else
|
||||
QDpi QEglFSEmulatorScreen::logicalBaseDpi() const
|
||||
{
|
||||
return QDpi(100, 100);
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
QImage::Format format() const override;
|
||||
QSizeF physicalSize() const override;
|
||||
QDpi logicalDpi() const override;
|
||||
QDpi logicalBaseDpi() const override;
|
||||
qreal refreshRate() const override;
|
||||
Qt::ScreenOrientation nativeOrientation() const override;
|
||||
Qt::ScreenOrientation orientation() const override;
|
||||
|
@ -160,13 +160,11 @@ QSizeF QEglFSKmsScreen::physicalSize() const
|
||||
|
||||
QDpi QEglFSKmsScreen::logicalDpi() const
|
||||
{
|
||||
const QSizeF ps = physicalSize();
|
||||
const QSize s = geometry().size();
|
||||
return logicalBaseDpi();
|
||||
}
|
||||
|
||||
if (!ps.isEmpty() && !s.isEmpty())
|
||||
return QDpi(25.4 * s.width() / ps.width(),
|
||||
25.4 * s.height() / ps.height());
|
||||
else
|
||||
QDpi QEglFSKmsScreen::logicalBaseDpi() const
|
||||
{
|
||||
return QDpi(100, 100);
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
|
||||
QSizeF physicalSize() const override;
|
||||
QDpi logicalDpi() const override;
|
||||
QDpi logicalBaseDpi() const override;
|
||||
Qt::ScreenOrientation nativeOrientation() const override;
|
||||
Qt::ScreenOrientation orientation() const override;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user