common: viewport values improperly rounded 81/289181/1
authormgrudzinska <m.grudzinska@samsung.com>
Sun, 27 Feb 2022 01:24:18 +0000 (02:24 +0100)
committerMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Thu, 2 Mar 2023 08:13:45 +0000 (09:13 +0100)
For a very specific scaling factors shapes were to much clipped
because of wrong rounding of the viewport.

Change-Id: Icfd42938c3754c91381565e0b114ca7168f33726

src/lib/tvgPaint.cpp

index 10dc5fd..d0e908d 100644 (file)
@@ -79,8 +79,8 @@ static bool _compFastTrack(Paint* cmpTarget, const RenderTransform* pTransform,
 
         viewport.x = static_cast<int32_t>(v1.x);
         viewport.y = static_cast<int32_t>(v1.y);
-        viewport.w = static_cast<int32_t>(v2.x - v1.x + 0.5f);
-        viewport.h = static_cast<int32_t>(v2.y - v1.y + 0.5f);
+        viewport.w = static_cast<int32_t>(ceil(v2.x - viewport.x));
+        viewport.h = static_cast<int32_t>(ceil(v2.y - viewport.y));
 
         if (viewport.w < 0) viewport.w = 0;
         if (viewport.h < 0) viewport.h = 0;
@@ -404,4 +404,4 @@ uint8_t Paint::opacity() const noexcept
 uint32_t Paint::identifier() const noexcept
 {
     return pImpl->id;
-}
\ No newline at end of file
+}