summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2023-01-26 03:16:04 +0100
committerMorph <39850852+Morph1984@users.noreply.github.com>2023-01-26 03:16:04 +0100
commit5be85c556ed05cd9d751fb7b3f8a331800ee573d (patch)
tree68ae7ce7fbb70f74ae8939917f0f431c4e33ebc2 /src
parentmain: Enable High DPI fixes for Qt >= 5.14 (diff)
downloadyuzu-5be85c556ed05cd9d751fb7b3f8a331800ee573d.tar
yuzu-5be85c556ed05cd9d751fb7b3f8a331800ee573d.tar.gz
yuzu-5be85c556ed05cd9d751fb7b3f8a331800ee573d.tar.bz2
yuzu-5be85c556ed05cd9d751fb7b3f8a331800ee573d.tar.lz
yuzu-5be85c556ed05cd9d751fb7b3f8a331800ee573d.tar.xz
yuzu-5be85c556ed05cd9d751fb7b3f8a331800ee573d.tar.zst
yuzu-5be85c556ed05cd9d751fb7b3f8a331800ee573d.zip
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/main.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 82e4adfe0..53249426c 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -4401,6 +4401,10 @@ void GMainWindow::changeEvent(QEvent* event) {
#endif
static void SetHighDPIAttributes() {
+#ifdef _WIN32
+ // For Windows, we want to avoid scaling artifacts on fractional scaling ratios.
+ // This is done by setting the optimal scaling policy for the primary screen.
+
// Create a temporary QApplication.
int temp_argc = 0;
char** temp_argv = nullptr;
@@ -4428,9 +4432,6 @@ static void SetHighDPIAttributes() {
// Get the lower of the 2 ratios and truncate, this is the maximum integer scale.
const float max_ratio = std::trunc(std::min(width_ratio, height_ratio));
- QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
-
if (max_ratio > real_ratio) {
QApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::Round);
@@ -4438,6 +4439,14 @@ static void SetHighDPIAttributes() {
QApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::Floor);
}
+#else
+ // Other OSes should be better than Windows at fractional scaling.
+ QApplication::setHighDpiScaleFactorRoundingPolicy(
+ Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
+#endif
+
+ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
}
int main(int argc, char* argv[]) {