Commit b7a45b00 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Clamp normalised values before pouring into pixel.

This should prevent roll-overs, but it doesn't fix the bug I was initially trying to fix, which instead seems to be a bugged HSL function.

Ref 2337
parent db436ad7
......@@ -157,9 +157,10 @@ struct KoColorSpaceTrait {
Q_ASSERT((int)values.count() == (int)channels_nb);
channels_type c;
for (uint i = 0; i < channels_nb; i++) {
c = (channels_type)
((float)KoColorSpaceMathsTraits<channels_type>::unitValue * values[i]);
c = qBound(KoColorSpaceMathsTraits<channels_type>::min,(channels_type)
((float)KoColorSpaceMathsTraits<channels_type>::unitValue * values[i]), KoColorSpaceMathsTraits<channels_type>::max);
nativeArray(pixel)[i] = c;
inline static void multiplyAlpha(quint8 * pixels, quint8 alpha, qint32 nPixels) {
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment