Make color, fill, stroke et al. thread-safe: #3077#4774
Make color, fill, stroke et al. thread-safe: #3077#4774GKFX wants to merge 1 commit intoprocessing:masterfrom
Conversation
calcEtc color variables deleted; colorCalc now returns a float[4] array.
|
This runs counter to an intentional design decision in the code because it would mean a lot of allocation and garbage collection for that array as it's re-created and destroyed inside tight |
|
@benfry That's fine; I'd like to replace the floats |
|
Messing with |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
calc***color variables deleted;colorCalcnow returns afloat[] {r,g,b,a}array, with values from 0 to 1, like the old calc[RGBA] variables. The graycolormethods don't bother with colorCalc at all.The fill and stroke methods were also non thread-safe and values could easily pass between them.
I ran a number of tests with random inputs to the new
colorfunctions and they differed by one (eg.ffE5E5E5→ffE6E6E6) from the previous version in a tiny number (seven in 10 million) of cases due to different rounding but were otherwise identical.Fixes #3077.