[Bf-blender-cvs] [b132dd042e7] master: Cleanup: Simplify spline point attribute materialize functions

Hans Goudey noreply at git.blender.org
Thu May 27 04:22:15 CEST 2021


Commit: b132dd042e7dd7f589644e1edaacdf5e07608398
Author: Hans Goudey
Date:   Wed May 26 22:22:09 2021 -0400
Branches: master
https://developer.blender.org/rBb132dd042e7dd7f589644e1edaacdf5e07608398

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.

===================================================================

M	source/blender/blenkernel/intern/geometry_component_curve.cc

===================================================================

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++;
       }



More information about the Bf-blender-cvs mailing list