From 085ea571b81a96677892353dd3ca1be0649d3d5c Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Fri, 22 Apr 2011 23:20:15 -0400 Subject: [PATCH] fix in RGB_to_HSV. --- src/misc.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/misc.c b/src/misc.c index b468ce387..63289491d 100644 --- a/src/misc.c +++ b/src/misc.c @@ -613,12 +613,14 @@ void RGB_to_HSV(int r,int g,int b,int *h,int *s,int *v)//convert 0-255 HSV value *s = 0; *v = a; } - - c = (rr==a) ? gg-bb : ((bb==a) ? rr-gg : bb-rr); - d = (rr==a) ? 3 : ((bb==a) ? 1 : 5); - *h = (int)(42.667*(d - c/(x - a))); - *s = (int)(256.0*((x - a)/x)); - *v = (int)(256.0*x); + else + { + c = (rr==a) ? gg-bb : ((bb==a) ? rr-gg : bb-rr); + d = (rr==a) ? 3 : ((bb==a) ? 1 : 5); + *h = (int)(42.667*(d - c/(x - a))); + *s = (int)(256.0*((x - a)/x)); + *v = (int)(256.0*x); + } } vector2d v2d_zero = {0,0}; matrix2d m2d_identity = {1,0,0,1};