From a91a65632c4d830070e1ca9bbda7e355f1459414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Cr=C3=A9moux?= Date: Fri, 1 Feb 2019 11:54:25 +0300 Subject: Fix QSvgRenderer incorrect render of svg:image The bounds of QSvgImage are integer based (QRect) which cause rounding issues when decimals values are used to define image (image shifted and with incorrect size). Changing the bounds to QRectF solves the issue. Fixes: QTBUG-73445 Change-Id: I49828e2c0b1917ec878844d520aac182581c23fb Reviewed-by: Eirik Aavitsland --- src/svg/qsvggraphics.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/svg/qsvggraphics.cpp') diff --git a/src/svg/qsvggraphics.cpp b/src/svg/qsvggraphics.cpp index 5b273af..12f2349 100644 --- a/src/svg/qsvggraphics.cpp +++ b/src/svg/qsvggraphics.cpp @@ -121,14 +121,14 @@ void QSvgArc::draw(QPainter *p, QSvgExtraStates &states) } QSvgImage::QSvgImage(QSvgNode *parent, const QImage &image, - const QRect &bounds) + const QRectF &bounds) : QSvgNode(parent), m_image(image), m_bounds(bounds) { - if (m_bounds.width() == 0) - m_bounds.setWidth(m_image.width()); - if (m_bounds.height() == 0) - m_bounds.setHeight(m_image.height()); + if (m_bounds.width() == 0.0) + m_bounds.setWidth(static_cast(m_image.width())); + if (m_bounds.height() == 0.0) + m_bounds.setHeight(static_cast(m_image.height())); } void QSvgImage::draw(QPainter *p, QSvgExtraStates &states) -- cgit v1.2.1