user avatar
Use defaultSize according to svg standard in svg plugin
Lars Schmertmann authored
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: default avatarAndré Klitzing <aklitzing@gmail.com>
Reviewed-by: default avatarEdward Welbourne <edward.welbourne@qt.io>
4bd5d6ce