Fix: GraphicElement中pixelRatio的计算

dev-wuyize
wuyize 2023-03-23 20:28:19 +08:00
parent 5d5ea2307f
commit a55a38385e
1 changed files with 3 additions and 7 deletions

View File

@ -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)
{