From 7274b3d601d38f7b5ca25ef1303eefecbfe8c2cc Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Sat, 27 Jul 2024 01:07:25 +0200 Subject: [PATCH] sw_engine: fix radial coefficients calculations In the Taylor series expansion, there was a missing division by 2! in the term with the second derivative. @Issue: https://github.com/thorvg/thorvg/issues/2530 --- src/renderer/sw_engine/tvgSwFill.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/sw_engine/tvgSwFill.cpp b/src/renderer/sw_engine/tvgSwFill.cpp index f8553754..2388247b 100644 --- a/src/renderer/sw_engine/tvgSwFill.cpp +++ b/src/renderer/sw_engine/tvgSwFill.cpp @@ -58,7 +58,7 @@ static void _calculateCoefficients(const SwFill* fill, uint32_t x, uint32_t y, f auto deltaDeltaRr = 2.0f * (radial->a11 * radial->a11 + radial->a21 * radial->a21) * radial->invA; det = b * b + (rr - radial->fr * radial->fr) * radial->invA; - deltaDet = 2.0f * b * deltaB + deltaB * deltaB + deltaRr + deltaDeltaRr; + deltaDet = 2.0f * b * deltaB + deltaB * deltaB + deltaRr + deltaDeltaRr * 0.5f; deltaDeltaDet = 2.0f * deltaB * deltaB + deltaDeltaRr; }