← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

Re: [Merge] lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-use-device-dpis into lp:ubuntu-docviewer-app/reboot

 

Review: Needs Fixing

Let's cache values, I think that it's generally faster than getting them every time.
Just store "screen->logicalDotsPerInch()" into static variable or create function:

static inline qreal getLogicalDotsPerInch()
{
    static qreal value = 0;
    if (!value) {
        // Mb it's better to use QGuiApplication::screens().
        QList<QScreen*> screens = QApplication::screens();
        if (screens.size())
            value = screens.at(0)->logicalDotsPerInch();
    }

    return value;
}

and use it's return value in calculations.
-- 
https://code.launchpad.net/~verzegnassi-stefano/ubuntu-docviewer-app/reboot-use-device-dpis/+merge/270850
Your team Ubuntu Document Viewer Developers is subscribed to branch lp:ubuntu-docviewer-app/reboot.


References