mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-07 02:51:41 +00:00
Gradient::sample cloned, sanitised and sorted every stop on each call, and the diamond texture sampled it for each of its 65 536 pixels, so a file's gradient with many stops cost that sort 65 536 times. sample_sorted samples stops already sorted, finding the segment by binary search; sample delegates to it and the diamond texture sorts once. Co-authored-by: Brandon Thomas <echelon@gmail.com>