Stefano Verzegnassi has proposed merging lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-use-device-dpis into lp:ubuntu-docviewer-app/reboot.
Commit message: [LibreOffice-plugin] Get screen DPIs at runtime Requested reviews: Ubuntu Document Viewer Developers (ubuntu-docviewer-dev) For more details, see: https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/reboot-use-device-dpis/+merge/270850 [LibreOffice-plugin] Get screen DPIs at runtime -- Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-use-device-dpis into lp:ubuntu-docviewer-app/reboot.
=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/twips.h' --- src/plugin/libreofficetoolkit-qml-plugin/twips.h 2015-07-19 07:32:50 +0000 +++ src/plugin/libreofficetoolkit-qml-plugin/twips.h 2015-09-11 15:50:17 +0000 @@ -19,23 +19,21 @@ #ifndef TWIPS_H #define TWIPS_H -// FIXME: Should we check for the real DPI of the screen, since we'll have in -// future to support HiDPI devices and Full/Ultra-HD smartphones/tablet? -// FIXME: Not common, but DPI on the X axis, and DPI on the Y axis may be -// different. -#define VIRTUAL_DPI 96.0 - #include <QtGlobal> +#include <QtWidgets/QApplication> +#include <QScreen> class Twips { public: static inline int convertTwipsToPixels(int twips, qreal zoom = 1.0) { - return int(twips / 1440.0 * VIRTUAL_DPI * zoom); + QScreen *screen = QApplication::screens().at(0); + return int(twips / 1440.0 * screen->logicalDotsPerInch() * zoom); } static inline int convertPixelsToTwips(int pixels, qreal zoom = 1.0) { - return int(pixels * 1440.0 / VIRTUAL_DPI / zoom); + QScreen *screen = QApplication::screens().at(0); + return int(pixels * 1440.0 / screen->logicalDotsPerInch() / zoom); } };
-- Mailing list: https://launchpad.net/~ubuntu-touch-coreapps-reviewers Post to : ubuntu-touch-coreapps-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~ubuntu-touch-coreapps-reviewers More help : https://help.launchpad.net/ListHelp