summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Capitanio <capnm@capitanio.org>2023-04-07 17:44:39 +0200
committerYuri Sizov <yuris@humnom.net>2023-04-07 17:44:39 +0200
commit233bd4abaa9ce4678615e305039821d54b090740 (patch)
treec769a9a370252b0fa7850557274c35f9a2ff6fb9
parenta99b0464123db4b52b4ae747775afd78968f8160 (diff)
SVG: fix tvg::Picture->size() and scale based errors.
Co-authored-by: RĂ©mi Verschelde <rverschelde@gmail.com> (cherry picked from commit bfc498f3d03bdeaa55e836517fcb1ddf58854fd5)
-rw-r--r--modules/svg/image_loader_svg.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp
index e239b33374..ad7feeda49 100644
--- a/modules/svg/image_loader_svg.cpp
+++ b/modules/svg/image_loader_svg.cpp
@@ -79,8 +79,8 @@ Error ImageLoaderSVG::create_image_from_utf8_buffer(Ref<Image> p_image, const Pa
float fw, fh;
picture->size(&fw, &fh);
- uint32_t width = round(fw * p_scale);
- uint32_t height = round(fh * p_scale);
+ uint32_t width = MAX(1, round(fw * p_scale));
+ uint32_t height = MAX(1, round(fh * p_scale));
const uint32_t max_dimension = 16384;
if (width > max_dimension || height > max_dimension) {