diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-07-22 09:15:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-22 09:15:54 +0200 |
commit | e92f22691c84afb6e326aa2fd7b2006f9b3ce97e (patch) | |
tree | 154e88f66f55c9cd37a5fc24771f554454992e49 | |
parent | b3bd08207032ca146319f4b25654bcddd31ee401 (diff) | |
parent | eb8482cf95cb946525959b0ae8b910011f6a5295 (diff) |
Merge pull request #63302 from nathanfranke/rounded-svg
Round dimensions of SVG to work around floating point precision errors
-rw-r--r-- | modules/svg/image_loader_svg.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index dcb1f1d744..87e2fae2d0 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -80,8 +80,8 @@ void ImageLoaderSVG::create_image_from_string(Ref<Image> p_image, String p_strin float fw, fh; picture->size(&fw, &fh); - uint32_t width = MIN(fw * p_scale, 16 * 1024); - uint32_t height = MIN(fh * p_scale, 16 * 1024); + uint32_t width = MIN(round(fw * p_scale), 16 * 1024); + uint32_t height = MIN(round(fh * p_scale), 16 * 1024); picture->size(width, height); std::unique_ptr<tvg::SwCanvas> sw_canvas = tvg::SwCanvas::gen(); |