Commit 25acdbf
committed
simplify rgb to hsv conversion
By inlining some values, the starting hue calculation can be reduced from using three subtractions and two divisions to using one subtraction and one division.
"fmod(n+1,1)" can be replaced with "n - floor(n)" due to the second parameter being 1.
The saturation calculation can be done without floating point values.
The "CLIP8"s are unnecessary because the values are already in the correct range.1 parent f614580 commit 25acdbf
1 file changed
+32
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
325 | 326 | | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | | - | |
| 337 | + | |
338 | 338 | | |
339 | | - | |
| 339 | + | |
340 | 340 | | |
341 | | - | |
342 | | - | |
343 | 341 | | |
344 | | - | |
345 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
346 | 351 | | |
| 352 | + | |
347 | 353 | | |
348 | 354 | | |
349 | 355 | | |
| |||
359 | 365 | | |
360 | 366 | | |
361 | 367 | | |
362 | | - | |
| 368 | + | |
| 369 | + | |
363 | 370 | | |
364 | 371 | | |
365 | 372 | | |
| |||
0 commit comments