From f13c72e3d72449e9c2b15f2d31b022fbde03338f Mon Sep 17 00:00:00 2001 From: Sergii Liebodkin Date: Wed, 30 Oct 2024 10:33:10 +0000 Subject: [PATCH] wg_engine: fix equals gradient offsets In case if gradient offsets are equal the last color are used instead of first --- src/renderer/wg_engine/tvgWgShaderTypes.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/renderer/wg_engine/tvgWgShaderTypes.cpp b/src/renderer/wg_engine/tvgWgShaderTypes.cpp index ef44a1c7..56438606 100755 --- a/src/renderer/wg_engine/tvgWgShaderTypes.cpp +++ b/src/renderer/wg_engine/tvgWgShaderTypes.cpp @@ -146,6 +146,8 @@ void WgShaderTypeGradient::updateTexData(const Fill::ColorStop* stops, uint32_t for (uint32_t i = 1; i < stopCnt; i++) if (sstops.last().offset < stops[i].offset) sstops.push(stops[i]); + else if (sstops.last().offset == stops[i].offset) + sstops.last() = stops[i]; // head uint32_t range_s = 0; uint32_t range_e = uint32_t(sstops[0].offset * (WG_TEXTURE_GRADIENT_SIZE-1));