Part of #118145.
Rewrite the application of brush hardness, filtering for 3D view clipping
and brush distance factor calculation to operate on arrays of data rather
than a single element at a time.
In the benchmark file from the task above, this improves performance by
5%, from 0.58s to 0.55s. I expect that's mainly because constant checks
have been moved out of the hot loops, avoiding function call overhead,
and because in some cases we avoid doing division for every element.
Pull Request: https://projects.blender.org/blender/blender/pulls/123671