summaryrefslogtreecommitdiffstats
path: root/src/citra_qt
diff options
context:
space:
mode:
authorKevin Hartman <kevin@hart.mn>2014-08-30 07:23:12 +0200
committerTony Wasserka <NeoBrainX@gmail.com>2014-11-18 13:06:05 +0100
commit221a9b023d8c9ca55c093823e9efd6d13d0a54a2 (patch)
tree57a26a0e11416b366688d00c4a2c9216fa0cde78 /src/citra_qt
parentAdd a GUI logging channel. (diff)
downloadyuzu-221a9b023d8c9ca55c093823e9efd6d13d0a54a2.tar
yuzu-221a9b023d8c9ca55c093823e9efd6d13d0a54a2.tar.gz
yuzu-221a9b023d8c9ca55c093823e9efd6d13d0a54a2.tar.bz2
yuzu-221a9b023d8c9ca55c093823e9efd6d13d0a54a2.tar.lz
yuzu-221a9b023d8c9ca55c093823e9efd6d13d0a54a2.tar.xz
yuzu-221a9b023d8c9ca55c093823e9efd6d13d0a54a2.tar.zst
yuzu-221a9b023d8c9ca55c093823e9efd6d13d0a54a2.zip
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/bootmanager.cpp24
-rw-r--r--src/citra_qt/bootmanager.hxx1
2 files changed, 25 insertions, 0 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 20824692d..516e115fd 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -2,6 +2,12 @@
#include <QKeyEvent>
#include <QApplication>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+// Required for screen DPI information
+#include <QScreen>
+#include <QWindow>
+#endif
+
#include "common/common.h"
#include "bootmanager.hxx"
@@ -176,6 +182,24 @@ void GRenderWindow::PollEvents() {
*/
}
+// On Qt 5.1+, this correctly gets the size of the framebuffer (pixels).
+//
+// Older versions get the window size (density independent pixels),
+// and hence, do not support DPI scaling ("retina" displays).
+// The result will be a viewport that is smaller than the extent of the window.
+void GRenderWindow::GetFramebufferSize(int* fbWidth, int* fbHeight)
+{
+#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
+ int pixelRatio = child->QPaintDevice::devicePixelRatio();
+
+ *fbWidth = child->QPaintDevice::width() * pixelRatio;
+ *fbHeight = child->QPaintDevice::height() * pixelRatio;
+#else
+ *fbWidth = child->QPaintDevice::width();
+ *fbHeight = child->QPaintDevice::height();
+#endif
+}
+
void GRenderWindow::BackupGeometry()
{
geometry = ((QGLWidget*)this)->saveGeometry();
diff --git a/src/citra_qt/bootmanager.hxx b/src/citra_qt/bootmanager.hxx
index f8afc403e..ec3e1fe71 100644
--- a/src/citra_qt/bootmanager.hxx
+++ b/src/citra_qt/bootmanager.hxx
@@ -96,6 +96,7 @@ public:
void MakeCurrent() override;
void DoneCurrent() override;
void PollEvents() override;
+ void GetFramebufferSize(int* fbWidth, int* fbHeight) override;
void BackupGeometry();
void RestoreGeometry();