summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2021-11-19 07:32:05 +0100
committerEirik Aavitsland <eirik.aavitsland@qt.io>2021-11-19 09:33:11 +0100
commitd180cb47b147ca07874b7defe1ed2771d5cb73fc (patch)
treeb0259a52d83347c8ad9126e01c5a21ea938b10bc /src
parenta0cee2d79550979638ed3e1ef5ffa2fe43367a99 (diff)
downloadqtsvg-d180cb47b147ca07874b7defe1ed2771d5cb73fc.tar.gz
Fix boundsOnElement() for text nodes having transformations
Text layout calculations are done with a local scaling, and that was mixed up with the node transformation when computing the bounds. Fixes: QTBUG-98139 Pick-to: 6.2 Change-Id: Id3ab0500cfba4578989b5766677a53340e8cecde Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/svg/qsvggraphics.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp
index bc4f9d6..764c21e 100644
--- a/src/svg/qsvggraphics.cpp
+++ b/src/svg/qsvggraphics.cpp
@@ -289,7 +289,7 @@ QRectF QSvgText::bounds(QPainter *p, QSvgExtraStates &states) const
{
QRectF boundingRect;
draw_helper(p, states, &boundingRect);
- return boundingRect;
+ return p->transform().mapRect(boundingRect);
}
void QSvgText::draw(QPainter *p, QSvgExtraStates &states)
@@ -465,7 +465,7 @@ void QSvgText::draw_helper(QPainter *p, QSvgExtraStates &states, QRectF *boundin
brect.translate(m_coord * scale);
if (bounds.height() > 0)
brect.setBottom(qMin(brect.bottom(), bounds.bottom()));
- *boundingRect = p->transform().mapRect(brect);
+ *boundingRect = QTransform::fromScale(1 / scale, 1 / scale).mapRect(brect);
}
}