From a55a38385e3b559aad49fd76203ebe0d04c8a2e9 Mon Sep 17 00:00:00 2001 From: wuyize Date: Thu, 23 Mar 2023 20:28:19 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20GraphicElement=E4=B8=ADpixelRatio?= =?UTF-8?q?=E7=9A=84=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Editor/GraphicElement.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp b/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp index bcee199..ceef5cf 100644 --- a/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp +++ b/ArchitectureColoredPainting/src/Editor/GraphicElement.cpp @@ -106,13 +106,9 @@ void SimpleElement::paint(QPainter* painter, QTransform transform, const LayerSt } else { - double angle = atan(transform.m12() / transform.m11()); - double maxScale; - if (fabs(cos(angle))>1e-5) - maxScale = std::max(fabs(transform.m11() / cos(angle)), fabs(transform.m22() / cos(angle))); - else - maxScale = std::max(fabs(transform.m12() / sin(angle)), fabs(transform.m21() / sin(angle))); - double pixelRatio = maxScale * QGuiApplication::primaryScreen()->devicePixelRatio(); + float sx = sqrt(transform.m11() * transform.m11() + transform.m12() * transform.m12()); + float sy = sqrt(transform.m21() * transform.m21() + transform.m22() * transform.m22()); + double pixelRatio = std::max(sx, sy) * QGuiApplication::primaryScreen()->devicePixelRatio() * 2; //double pixelRatio = 5; if (painterPath == painterPathPrev && styles.getHash() == stylesHashValue && pixelRatioPrev >= pixelRatio && !forceRefresh) {