# HG changeset patch # User Chris Cannam # Date 1430310524 -3600 # Node ID 092de22db207791d93628688a35031261735bbd5 # Parent 76b5eabd816b97c9777e785fb46a784507c4c8ba Make Retina layer rendering selectable in settings diff -r 76b5eabd816b -r 092de22db207 view/View.cpp --- a/view/View.cpp Wed Apr 29 13:08:17 2015 +0100 +++ b/view/View.cpp Wed Apr 29 13:28:44 2015 +0100 @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -450,10 +451,29 @@ return m_zoomLevel; } +int +View::effectiveDevicePixelRatio() const +{ +#ifdef Q_OS_MAC + int dpratio = devicePixelRatio(); + if (dpratio > 1) { + QSettings settings; + settings.beginGroup("Preferences"); + if (!settings.value("scaledHiDpi", true).toBool()) { + dpratio = 1; + } + settings.endGroup(); + } + return dpratio; +#else + return 1; +#endif +} + void View::setZoomLevel(int z) { - int dpratio = devicePixelRatio(); + int dpratio = effectiveDevicePixelRatio(); if (z < dpratio) return; if (z < 1) z = 1; if (m_zoomLevel != int(z)) { @@ -1658,7 +1678,7 @@ View::setPaintFont(QPainter &paint) { int scaleFactor = 1; - int dpratio = devicePixelRatio(); + int dpratio = effectiveDevicePixelRatio(); if (dpratio > 1) { QPaintDevice *dev = paint.device(); if (dynamic_cast(dev) || dynamic_cast(dev)) { @@ -1714,7 +1734,7 @@ QRect nonCacheRect(cacheRect); - int dpratio = devicePixelRatio(); + int dpratio = effectiveDevicePixelRatio(); // If not all layers are scrollable, but some of the back layers // are, we should store only those in the cache. diff -r 76b5eabd816b -r 092de22db207 view/View.h --- a/view/View.h Wed Apr 29 13:08:17 2015 +0100 +++ b/view/View.h Wed Apr 29 13:28:44 2015 +0100 @@ -426,6 +426,8 @@ void checkProgress(void *object); int getProgressBarWidth() const; // if visible + int effectiveDevicePixelRatio() const; + sv_frame_t m_centreFrame; int m_zoomLevel; bool m_followPan;