Make sure the hue returned by Color.RgbToHsv is positive.

This commit is contained in:
Paul Chote
2021-07-03 15:02:51 +01:00
committed by Smittytron
parent fca12fd707
commit bc51461427

View File

@@ -151,6 +151,11 @@ namespace OpenRA.Primitives
hue = (r - g) / (6 * delta) + 2 / 3f;
var h = hue - (int)hue;
// Wrap negative values into [0-1)
if (h < 0)
h += 1;
var s = delta / rgbMax;
return (h, s, v);
}