From dd0d88f9d74975bf9ee84dcf2e18948d2680356d Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 28 Mar 2016 16:43:40 -0500 Subject: QML UI: take device pixel ratio into account when scaling pixmaps on iOS This way warning icons and tank change icons and other event markers are no longer ridiculously tiny on retina screens. Oddly this doesn't appear to be needed on Android, only on iOS. Fixes #1033 Signed-off-by: Dirk Hohndel --- subsurface-core/metrics.cpp | 8 +++++++- subsurface-core/metrics.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'subsurface-core') diff --git a/subsurface-core/metrics.cpp b/subsurface-core/metrics.cpp index db636794d..3c66528b8 100644 --- a/subsurface-core/metrics.cpp +++ b/subsurface-core/metrics.cpp @@ -15,7 +15,8 @@ IconMetrics::IconMetrics() : sz_med(-1), sz_big(-1), sz_pic(-1), - spacing(-1) + spacing(-1), + dpr(1.0) { } @@ -57,3 +58,8 @@ const IconMetrics & defaultIconMetrics() return dfltIconMetrics; } + +void updateDevicePixelRatio(double dpr) +{ + dfltIconMetrics.dpr = dpr; +} diff --git a/subsurface-core/metrics.h b/subsurface-core/metrics.h index 03d6b22e2..ca281b3b1 100644 --- a/subsurface-core/metrics.h +++ b/subsurface-core/metrics.h @@ -25,9 +25,12 @@ struct IconMetrics { int sz_pic; // ex 128px // icon spacing int spacing; // ex 2px + // devicePixelRatio + double dpr; // 1.0 for traditional screens, HiDPI screens up to 3.0 IconMetrics(); }; const IconMetrics & defaultIconMetrics(); +void updateDevicePixelRatio(double dpr); #endif // METRICS_H -- cgit v1.2.3-70-g09d2