[vlc-commits] [Git][videolan/vlc][master] qt: fix using partially uninitialized scaled size in `SVGColorImageReader`

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Feb 27 11:14:50 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
7a8acd46 by Fatih Uzunoglu at 2025-02-27T11:00:53+00:00
qt: fix using partially uninitialized scaled size in `SVGColorImageReader`

I do not set `scaledSize` to requested size by default, just to partially
override it when either `width` or `height` is 0. However, this means that we need
to initialize the uninitialized part manually by setting it to non-zero
requested size counterpart as I proposed here.

- - - - -


1 changed file:

- modules/gui/qt/util/color_svg_image_provider.cpp


Changes:

=====================================
modules/gui/qt/util/color_svg_image_provider.cpp
=====================================
@@ -129,9 +129,15 @@ public:
                         const QSize naturalSize = svgHandler->option(QImageIOHandler::Size).toSize();
 
                         if (m_requestedSize.width() == 0)
+                        {
                             scaledSize.setWidth(m_requestedSize.height() * ((qreal)naturalSize.width() / naturalSize.height()));
+                            scaledSize.setHeight(m_requestedSize.height());
+                        }
                         else if (m_requestedSize.height() == 0)
+                        {
                             scaledSize.setHeight(m_requestedSize.width() * ((qreal)naturalSize.height() / naturalSize.width()));
+                            scaledSize.setWidth(m_requestedSize.width());
+                        }
                     }
                     else
                     {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/7a8acd4625e15d0ce88a7fed9fd13b7321633cf8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/7a8acd4625e15d0ce88a7fed9fd13b7321633cf8
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list