Curves: Avoid virtual function overhead when finding selected curves

This showed up on a profile of sculpting with the comb brush.
Use a span instead of a virtual array.
This commit is contained in:
Hans Goudey 2022-07-27 15:34:29 -05:00
parent 165fa9e2a1
commit ff048f5d27
1 changed files with 2 additions and 1 deletions

View File

@ -67,10 +67,11 @@ static IndexMask retrieve_selected_curves(const CurvesGeometry &curves,
return selection.get_internal_single() <= 0.0f ? IndexMask(0) :
IndexMask(curves.curves_num());
}
const Span<float> point_selection_span = selection.get_internal_span();
return index_mask_ops::find_indices_based_on_predicate(
curves.curves_range(), 512, r_indices, [&](const int curve_i) {
for (const int i : curves.points_for_curve(curve_i)) {
if (selection[i] > 0.0f) {
if (point_selection_span[i] > 0.0f) {
return true;
}
}