Cleanup: Rename curves utility function

"Fill" usually refers to setting a single value. This copies the
sizes from curves offsets to a separate array.
This commit is contained in:
Hans Goudey
2023-01-19 15:31:16 -06:00
parent 8d63293c46
commit 7db00d4ef7
6 changed files with 13 additions and 13 deletions

View File

@@ -533,11 +533,11 @@ void fill_points(const CurvesGeometry &curves,
bke::CurvesGeometry copy_only_curve_domain(const bke::CurvesGeometry &src_curves);
/**
* Copy the size of every curve in #curve_ranges to the corresponding index in #counts.
* Copy the number of points in every curve in #curve_ranges to the corresponding index in #sizes.
*/
void fill_curve_counts(const bke::CurvesGeometry &curves,
Span<IndexRange> curve_ranges,
MutableSpan<int> counts);
void copy_curve_sizes(const bke::CurvesGeometry &curves,
Span<IndexRange> curve_ranges,
MutableSpan<int> sizes);
IndexMask indices_for_type(const VArray<int8_t> &types,
const std::array<int, CURVE_TYPES_NUM> &type_counts,

View File

@@ -10,16 +10,16 @@
namespace blender::bke::curves {
void fill_curve_counts(const bke::CurvesGeometry &curves,
const Span<IndexRange> curve_ranges,
MutableSpan<int> counts)
void copy_curve_sizes(const bke::CurvesGeometry &curves,
const Span<IndexRange> curve_ranges,
MutableSpan<int> sizes)
{
const OffsetIndices points_by_curve = curves.points_by_curve();
threading::parallel_for(curve_ranges.index_range(), 512, [&](IndexRange ranges_range) {
for (const IndexRange curves_range : curve_ranges.slice(ranges_range)) {
threading::parallel_for(curves_range, 4096, [&](IndexRange range) {
for (const int i : range) {
counts[i] = points_by_curve.size(i);
sizes[i] = points_by_curve.size(i);
}
});
}

View File

@@ -70,7 +70,7 @@ static void calculate_result_offsets(const bke::CurvesGeometry &src_curves,
MutableSpan<int> dst_point_offsets)
{
/* Fill the offsets array with the curve point counts, then accumulate them to form offsets. */
bke::curves::fill_curve_counts(src_curves, unselected_ranges, dst_curve_offsets);
bke::curves::copy_curve_sizes(src_curves, unselected_ranges, dst_curve_offsets);
const OffsetIndices points_by_curve = src_curves.points_by_curve();
threading::parallel_for(selection.index_range(), 512, [&](IndexRange range) {
for (const int curve_i : selection.slice(range)) {

View File

@@ -252,7 +252,7 @@ static CurvesGeometry resample_to_uniform(const CurvesGeometry &src_curves,
src_curves.curves_range(), nullptr);
/* Fill the counts for the curves that aren't selected and accumulate the counts into offsets. */
bke::curves::fill_curve_counts(src_curves, unselected_ranges, dst_offsets);
bke::curves::copy_curve_sizes(src_curves, unselected_ranges, dst_offsets);
offset_indices::accumulate_counts_to_offsets(dst_offsets);
dst_curves.resize(dst_offsets.last(), dst_curves.curves_num());
@@ -421,7 +421,7 @@ CurvesGeometry resample_to_evaluated(const CurvesGeometry &src_curves,
dst_offsets[i] = src_evaluated_points_by_curve.size(i);
}
});
bke::curves::fill_curve_counts(src_curves, unselected_ranges, dst_offsets);
bke::curves::copy_curve_sizes(src_curves, unselected_ranges, dst_offsets);
offset_indices::accumulate_counts_to_offsets(dst_offsets);
const OffsetIndices dst_points_by_curve = dst_curves.points_by_curve();

View File

@@ -20,7 +20,7 @@ static void calculate_result_offsets(const bke::CurvesGeometry &src_curves,
MutableSpan<int> dst_point_offsets)
{
/* Fill the array with each curve's point count, then accumulate them to the offsets. */
bke::curves::fill_curve_counts(src_curves, unselected_ranges, dst_curve_offsets);
bke::curves::copy_curve_sizes(src_curves, unselected_ranges, dst_curve_offsets);
const OffsetIndices src_points_by_curve = src_curves.points_by_curve();
threading::parallel_for(selection.index_range(), 1024, [&](IndexRange range) {
for (const int curve_i : selection.slice(range)) {

View File

@@ -974,7 +974,7 @@ bke::CurvesGeometry trim_curves(const bke::CurvesGeometry &src_curves,
start_points,
end_points,
src_ranges);
bke::curves::fill_curve_counts(src_curves, inverse_selection, dst_curve_offsets);
bke::curves::copy_curve_sizes(src_curves, inverse_selection, dst_curve_offsets);
/* Finalize and update the geometry container. */
offset_indices::accumulate_counts_to_offsets(dst_curve_offsets);