From 12cfbd2a967f9df09d3efa2f8f13c442ff36b75f Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 1 Oct 2020 20:06:42 -0400 Subject: [PATCH] CppUtils.hsluv(): prevent out of bounds sat/luv --- src/utils.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils.h b/src/utils.h index ff603f98..94acf51b 100644 --- a/src/utils.h +++ b/src/utils.h @@ -41,7 +41,13 @@ public slots: QColor hsluv(qreal hue, qreal sat, qreal luv, qreal alpha = 1.0) const { double red, green, blue; - hsluv2rgb(hue, sat, luv, &red, &green, &blue); + + hsluv2rgb( + hue, + qMax(0.0, qMin(100.0, sat)), + qMax(0.0, qMin(100.0, luv)), + &red, &green, &blue + ); return QColor::fromRgbF( qMax(0.0, qMin(1.0, red)),