From 0f25bfe87b2b20d65348605c020bde469565da96 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Thu, 4 Jan 2018 23:15:53 +0100 Subject: [PATCH] Don't check the impossible cases in rgb2hsvtc() --- rtengine/color.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/rtengine/color.h b/rtengine/color.h index f2092f530..2b6d40174 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -313,18 +313,12 @@ public: s = del_Max / var_Max; if (r == var_Max) { - h = (g - b) / del_Max; + h = (g < b ? 6.f : 0.f) + (g - b) / del_Max; } else if (g == var_Max) { h = 2.f + (b - r) / del_Max; } else { /*if ( b == var_Max ) */ h = 4.f + (r - g) / del_Max; } - - if (h < 0.f) { - h += 6.f; - } else if (h > 6.f) { - h -= 6.f; - } } }