aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--profile-widget/diveeventitem.cpp5
-rw-r--r--qt-mobile/qmlprofile.cpp2
-rw-r--r--subsurface-core/metrics.cpp8
-rw-r--r--subsurface-core/metrics.h3
4 files changed, 17 insertions, 1 deletions
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp
index b2e3db8c9..3e1de48f3 100644
--- a/profile-widget/diveeventitem.cpp
+++ b/profile-widget/diveeventitem.cpp
@@ -66,8 +66,13 @@ void DiveEventItem::setupPixmap()
#ifndef SUBSURFACE_MOBILE
int sz_bigger = metrics.sz_med + metrics.sz_small; // ex 40px
#else
+#if defined(Q_OS_IOS)
+ // on iOS devices we need to adjust for Device Pixel Ratio
+ int sz_bigger = metrics.sz_med * metrics.dpr;
+#else
int sz_bigger = metrics.sz_med;
#endif
+#endif
int sz_pix = sz_bigger/2; // ex 20px
#define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation)
diff --git a/qt-mobile/qmlprofile.cpp b/qt-mobile/qmlprofile.cpp
index 249a6b818..ad686561d 100644
--- a/qt-mobile/qmlprofile.cpp
+++ b/qt-mobile/qmlprofile.cpp
@@ -2,6 +2,7 @@
#include "qmlmanager.h"
#include "profile-widget/profilewidget2.h"
#include "subsurface-core/dive.h"
+#include "subsurface-core/metrics.h"
#include <QTransform>
#include <QScreen>
@@ -99,6 +100,7 @@ void QMLProfile::setDevicePixelRatio(qreal dpr)
if (dpr != m_devicePixelRatio) {
m_devicePixelRatio = dpr;
m_profileWidget->setFontPrintScale(0.8 * dpr);
+ updateDevicePixelRatio(dpr);
emit devicePixelRatioChanged();
}
}
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