Commit 4bd5d6ce authored by Lars Schmertmann's avatar Lars Schmertmann Committed by Lars Schmertmann
Browse files

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: default avatarAndré Klitzing <aklitzing@gmail.com>
Reviewed-by: default avatarEdward Welbourne <edward.welbourne@qt.io>
parent 2856c5e5
No related merge requests found
Showing with 195 additions and 1 deletion
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment