From 0947c05a52881bf3484e1df2392225eb56e50de2 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Mon, 12 May 2025 23:15:29 +0200 Subject: [PATCH] sw_engine: replacing a cast with rounding Casting a float to an int instead of rounding resulted in a visibly incorrect reduction of the rendered area. @Issue: https://github.com/thorvg/thorvg/issues/3452 --- src/renderer/sw_engine/tvgSwRasterTexmap.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/sw_engine/tvgSwRasterTexmap.h b/src/renderer/sw_engine/tvgSwRasterTexmap.h index 138020ee..cb7d37c4 100644 --- a/src/renderer/sw_engine/tvgSwRasterTexmap.h +++ b/src/renderer/sw_engine/tvgSwRasterTexmap.h @@ -113,8 +113,8 @@ static void _rasterBlendingPolygonImageSegment(SwSurface* surface, const SwImage y = yStart; while (y < yEnd) { - x1 = (int32_t)_xa; - x2 = (int32_t)_xb; + x1 = nearbyint(_xa); + x2 = nearbyint(_xb); if (!region) { minx = INT32_MAX; @@ -246,8 +246,8 @@ static void _rasterPolygonImageSegment(SwSurface* surface, const SwImage* image, y = yStart; while (y < yEnd) { - x1 = (int32_t)_xa; - x2 = (int32_t)_xb; + x1 = nearbyint(_xa); + x2 = nearbyint(_xb); if (!region) { minx = INT32_MAX;