Merge pull request #63302 from nathanfranke/rounded-svg

Round dimensions of SVG to work around floating point precision errors
This commit is contained in:
Rémi Verschelde 2022-07-22 09:15:54 +02:00 committed by GitHub
commit e92f22691c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();