This is a part of the D10518 (which got really big but deserves attention as it seems to fix a problem with Grease Pencil).
This new function replaces some of the logic in DRW_select_buffer_find_nearest_to_point that traverses a buffer in a spiral path to search for a closer pixel.
The performance is practically the same (perhaps a difference of 0.01x).
So advantages:
- It can be used in other places avoiding duplicate code.
- Works with any rectangle shape (not just a square).
- Operates on any type of data (float, int, array of arrays).
Disadvantages:
- less readable.