Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-05-27 05:22:09 +0300
committerHans Goudey <h.goudey@me.com>2021-05-27 05:22:09 +0300
commitb132dd042e7dd7f589644e1edaacdf5e07608398 (patch)
tree60f79b12201e5ac48492d19f1de5b38ce0a9e832
parentc97b6215a37e5eca744d54d2e80741af78e1dafc (diff)
Cleanup: Simplify spline point attribute materialize functions
- Iterate over the mask directly instead of using an index. - Use Span slice and copy_from instead of a lower level function.
-rw-r--r--source/blender/blenkernel/intern/geometry_component_curve.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc
index b9930e2fc50..be3fdf26cb3 100644
--- a/source/blender/blenkernel/intern/geometry_component_curve.cc
+++ b/source/blender/blenkernel/intern/geometry_component_curve.cc
@@ -476,14 +476,12 @@ static void point_attribute_materialize(Span<Span<T>> data,
for (const int spline_index : data.index_range()) {
const int offset = offsets[spline_index];
const int next_offset = offsets[spline_index + 1];
- initialized_copy_n(data[spline_index].data(), next_offset - offset, r_span.data() + offset);
+ r_span.slice(offset, next_offset - offset).copy_from(data[spline_index]);
}
}
else {
int spline_index = 0;
- for (const int i : r_span.index_range()) {
- const int dst_index = mask[i];
-
+ for (const int dst_index : mask) {
while (offsets[spline_index] < dst_index) {
spline_index++;
}
@@ -511,9 +509,7 @@ static void point_attribute_materialize_to_uninitialized(Span<Span<T>> data,
}
else {
int spline_index = 0;
- for (const int i : r_span.index_range()) {
- const int dst_index = mask[i];
-
+ for (const int dst_index : mask) {
while (offsets[spline_index] < dst_index) {
spline_index++;
}