summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-04-23 03:20:15 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-04-23 13:01:03 (GMT)
commit085ea571b81a96677892353dd3ca1be0649d3d5c (patch)
treedc3cfd0047caec0eb7f8e4b6e9a8a084a1dd5860 /src
parentbd8de4c8420b7b6dc782d12a0eef1ea3fe6f5883 (diff)
downloadpowder-085ea571b81a96677892353dd3ca1be0649d3d5c.zip
powder-085ea571b81a96677892353dd3ca1be0649d3d5c.tar.gz
fix in RGB_to_HSV.
Diffstat (limited to 'src')
-rw-r--r--src/misc.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/misc.c b/src/misc.c
index b468ce3..6328949 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};