mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 20:01:22 +00:00
Double check for 0 before divide
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gnustep_testplant_branch@39747 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
54247ab70f
commit
6ab033ef7d
1 changed files with 11 additions and 1 deletions
|
@ -282,7 +282,17 @@ gsColorToHSB(device_color_t *color)
|
||||||
diff = V - Temp;
|
diff = V - Temp;
|
||||||
if (V == r)
|
if (V == r)
|
||||||
{
|
{
|
||||||
H = (g - b)/diff;
|
if (diff == 0.0)
|
||||||
|
{
|
||||||
|
// Invoke same code as r=g=b above...
|
||||||
|
H = 0;
|
||||||
|
// diff == 0 so diff/V == 0
|
||||||
|
// V already == r
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
H = (g - b)/diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (V == g)
|
else if (V == g)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue