mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-06 04:35:32 +00:00
Fixed: CPColor colorWithHue:saturation:brightness: parameters not clamped.
Previously, the parameters to CPColor colorWithHue:saturation:brightness: could be specified below 0 or above 1.0. Now the values are clamped so that values below 0 are taken as 0 and values above 1.0 and taken as 1.0.
This commit is contained in:
1 parent
0c2abf3629
commit
d00846aae7
1 file changed
+5
@@ -199,6 +199,11 @@ var cachedBlackColor,
|
||||
*/
|
||||
+ (CPColor)colorWithHue:(float)hue saturation:(float)saturation brightness:(float)brightness alpha:(float)alpha
|
||||
{
|
||||
// Clamp values.
|
||||
hue = MAX(MIN(hue, 1.0), 0.0);
|
||||
saturation = MAX(MIN(saturation, 1.0), 0.0);
|
||||
brightness = MAX(MIN(brightness, 1.0), 0.0);
|
||||
|
||||
if (saturation === 0.0)
|
||||
return [CPColor colorWithCalibratedWhite:brightness alpha:alpha];
|
||||
|
||||
|
||||
Reference in new issue
Block a user