Clamping color stops. Addresses issue #6034 where color stops can sometimes be just outside the 0-1 range. Diffs= 6ee7cea9e Clamping color stops. (#6052) Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head index 4ffe9fa..e292a4a 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -bb00ec119d2ced89395c70e718419aa970b312d8 +6ee7cea9edb3efb81318bc5a8a1db2c6a28c011a
diff --git a/src/shapes/paint/linear_gradient.cpp b/src/shapes/paint/linear_gradient.cpp index 6618c90..aa49c94 100644 --- a/src/shapes/paint/linear_gradient.cpp +++ b/src/shapes/paint/linear_gradient.cpp
@@ -123,7 +123,7 @@ for (size_t i = 0; i < count; ++i) { colors[i] = colorModulateOpacity(m_Stops[i]->colorValue(), ro); - stops[i] = m_Stops[i]->position(); + stops[i] = std::max(0.0f, std::min(m_Stops[i]->position(), 1.0f)); } makeGradient(renderPaint, start, end, colors, stops, count);