summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Schmertmann <Lars.Schmertmann@governikus.de>2016-12-02 08:05:46 +0100
committerLars Schmertmann <lars.schmertmann@governikus.de>2017-01-04 10:10:08 +0000
commit4bd5d6ced07d2d0e643a13e7cebb228c521d2046 (patch)
tree1a2b0141f6e08a74ca76233637db0ae4ec521bb1 /src
parent2856c5e52bdd2cb736d8394dd87a0726ea5fb560 (diff)
downloadqtsvg-4bd5d6ced07d2d0e643a13e7cebb228c521d2046.tar.gz
Use defaultSize according to svg standard in svg plugin
The viewBox attribute defines the svg internal coordinate system. If no width/height is set, the viewBox size is the right choice for defaultSize. Otherwise the standard prescribes that the specified height/width must be used. The old behavior ignored the width and height attributes, and this caused a lot of problems in qml. If the viewBox was very small the result was a low resolution image. If the viewBox was very large, loading took ages and the result used much more memory than needed. Both situations could be avoided by setting sourceSize. But when using the same image several times, the sourceSize must be set every time to the same value, otherwise the image cache would not work. It is cheaper to have the same high-quality source image in the cache, and scale it down when required. With the new behavior it is possible to control the default image size directly in the svg file at one place while it is still possible to set different sourceSizes if needed. Task-number: QTBUG-44863 Change-Id: I9c2fc7c122a29ebcf288b7cbd12427e081d404d5 Reviewed-by: André Klitzing <aklitzing@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/imageformats/svg/qsvgiohandler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/imageformats/svg/qsvgiohandler.cpp b/src/plugins/imageformats/svg/qsvgiohandler.cpp
index 88d37bc..0c26cb5 100644
--- a/src/plugins/imageformats/svg/qsvgiohandler.cpp
+++ b/src/plugins/imageformats/svg/qsvgiohandler.cpp
@@ -98,7 +98,7 @@ bool QSvgIOHandlerPrivate::load(QIODevice *device)
}
if (res) {
- defaultSize = QSize(r.viewBox().width(), r.viewBox().height());
+ defaultSize = r.defaultSize();
loaded = true;
}