fixed div-by-zero when using custom gradients with offset 100

rayl@netrover.com
This commit is contained in:
People doing a 16 bpc version of gimp 1997-12-15 00:21:15 +00:00
parent c6663bee44
commit a07e23927d
4 changed files with 24 additions and 0 deletions

View File

@ -891,6 +891,8 @@ gradient_calc_square_factor (double dist,
if (rat < offset) if (rat < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (rat - offset) / (1.0 - offset); rat = (rat - offset) / (1.0 - offset);
} /* else */ } /* else */
@ -923,6 +925,8 @@ gradient_calc_radial_factor (double dist,
if (rat < offset) if (rat < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (rat - offset) / (1.0 - offset); rat = (rat - offset) / (1.0 - offset);
} /* else */ } /* else */
@ -979,6 +983,8 @@ gradient_calc_bilinear_factor (double dist,
if (fabs(rat) < offset) if (fabs(rat) < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (fabs(rat) - offset) / (1.0 - offset); rat = (fabs(rat) - offset) / (1.0 - offset);
} /* else */ } /* else */

View File

@ -891,6 +891,8 @@ gradient_calc_square_factor (double dist,
if (rat < offset) if (rat < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (rat - offset) / (1.0 - offset); rat = (rat - offset) / (1.0 - offset);
} /* else */ } /* else */
@ -923,6 +925,8 @@ gradient_calc_radial_factor (double dist,
if (rat < offset) if (rat < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (rat - offset) / (1.0 - offset); rat = (rat - offset) / (1.0 - offset);
} /* else */ } /* else */
@ -979,6 +983,8 @@ gradient_calc_bilinear_factor (double dist,
if (fabs(rat) < offset) if (fabs(rat) < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (fabs(rat) - offset) / (1.0 - offset); rat = (fabs(rat) - offset) / (1.0 - offset);
} /* else */ } /* else */

View File

@ -891,6 +891,8 @@ gradient_calc_square_factor (double dist,
if (rat < offset) if (rat < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (rat - offset) / (1.0 - offset); rat = (rat - offset) / (1.0 - offset);
} /* else */ } /* else */
@ -923,6 +925,8 @@ gradient_calc_radial_factor (double dist,
if (rat < offset) if (rat < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (rat - offset) / (1.0 - offset); rat = (rat - offset) / (1.0 - offset);
} /* else */ } /* else */
@ -979,6 +983,8 @@ gradient_calc_bilinear_factor (double dist,
if (fabs(rat) < offset) if (fabs(rat) < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (fabs(rat) - offset) / (1.0 - offset); rat = (fabs(rat) - offset) / (1.0 - offset);
} /* else */ } /* else */

View File

@ -891,6 +891,8 @@ gradient_calc_square_factor (double dist,
if (rat < offset) if (rat < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (rat - offset) / (1.0 - offset); rat = (rat - offset) / (1.0 - offset);
} /* else */ } /* else */
@ -923,6 +925,8 @@ gradient_calc_radial_factor (double dist,
if (rat < offset) if (rat < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (rat - offset) / (1.0 - offset); rat = (rat - offset) / (1.0 - offset);
} /* else */ } /* else */
@ -979,6 +983,8 @@ gradient_calc_bilinear_factor (double dist,
if (fabs(rat) < offset) if (fabs(rat) < offset)
rat = 0.0; rat = 0.0;
else if (offset == 1)
rat = (rat>=1) ? 1 : 0;
else else
rat = (fabs(rat) - offset) / (1.0 - offset); rat = (fabs(rat) - offset) / (1.0 - offset);
} /* else */ } /* else */