mypaint / libmypaint

libmypaint, a.k.a. "brushlib", is a library for making brushstrokes which is used by MyPaint and other projects.
http://mypaint.org
Other
307 stars 87 forks source link

Factor out and clamp directional offsets #155

Closed jplloyd closed 4 years ago

jplloyd commented 4 years ago

Break out the calculation of directional offsets to its own function, and clamp the final result to guard against extreme allocations and redraws.

The offset multiplier param being logarithmic makes it very easy to produce extremely high or infinite dab placements - not by the base values alone but when in combination with mappings (for both the multiplier and the offsets it acts upon).

Also break out the base_mul factor, since the dab coordinates are no longer being changed directly.