evaluateFloat interprets the option value f. If f is between 0 and 1, it is interpreted as a percentage of max, otherwise it is treated as an absolute value. If f is less than 0, 0 is returned.
(f float64, max int)
| 132 | // interpreted as a percentage of max, otherwise it is treated as an absolute |
| 133 | // value. If f is less than 0, 0 is returned. |
| 134 | func evaluateFloat(f float64, max int) int { |
| 135 | if 0 < f && f < 1 { |
| 136 | return int(float64(max) * f) |
| 137 | } |
| 138 | if f < 0 { |
| 139 | return 0 |
| 140 | } |
| 141 | return int(f) |
| 142 | } |
| 143 | |
| 144 | // resizeParams determines if the image needs to be resized, and if so, the |
| 145 | // dimensions to resize to. |
no outgoing calls
no test coverage detected