From 2a0a3950e696c850f2e60a2e936619dfbf113819 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Fri, 5 May 2023 00:22:06 +0200 Subject: [PATCH] svg2png: rounding up svg width and height The svg width/height values were cast to int, which could result in cutting off a small part of the image. Now, in the case of a non-integer size, it will be rounded up. @Issue: https://github.com/thorvg/thorvg/issues/1414 --- src/bin/svg2png/svg2png.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bin/svg2png/svg2png.cpp b/src/bin/svg2png/svg2png.cpp index 72da8579..9792194c 100644 --- a/src/bin/svg2png/svg2png.cpp +++ b/src/bin/svg2png/svg2png.cpp @@ -98,6 +98,8 @@ public: picture->size(&fw, &fh); w = static_cast(fw); h = static_cast(fh); + if (fw > w) w++; + if (fh > h) h++; if (w * h > SIZE_8K) { float scale = fw / fh;