From f8eb5140e21d99289e45ff8eee96275544adc82b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 27 Feb 2022 13:09:35 -0800 Subject: [PATCH] mobile/profile: fix scaling of profile for HDPI screens For reasons I don't understand, the device pixel ratio was taken into account twice. And as a result the transformation applied to the profile made us show only the top left part of it - but enlarged (depending on the DPR). This code fixes that problem by simply forcing the transformation used by the painter to be the identity matrix. I worry that this could be wrong in some situations, but for now it seems to fix the problem. Signed-off-by: Dirk Hohndel --- CHANGELOG.md | 1 + profile-widget/qmlprofile.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 081206075..d049b8066 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - core: avoid crash with corrupted cloud storage +- mobile: fix profile scaling issue on high DPR devices - mobile/Android: add logfiles as attachment to support emails - planner: make ESC (cancel plan) work when moving handles - dive list: make dive guide visible in dive list [#3382] diff --git a/profile-widget/qmlprofile.cpp b/profile-widget/qmlprofile.cpp index fefb3f097..a47eb0e3a 100644 --- a/profile-widget/qmlprofile.cpp +++ b/profile-widget/qmlprofile.cpp @@ -51,7 +51,10 @@ void QMLProfile::paint(QPainter *painter) timer.start(); // let's look at the intended size of the content and scale our scene accordingly + // for some odd reason the painter transformation is set up to scale by the dpr - which results + // in applying that dpr scaling twice. So we hard-code it here to be the identity matrix QRect painterRect = painter->viewport(); + painter->resetTransform(); if (m_diveId < 0) return; struct dive *d = get_dive_by_uniq_id(m_diveId);