diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-25 17:12:31 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-25 17:12:31 +0300 |
commit | 1243cb803e7d096d27e2b5dcdfa05bf0367e248c (patch) | |
tree | 215dc88aac78eb690675e1c8b0429ef3ce85f05b | |
parent | cea51c1bb500eb2cfca425e1cae5dcc419dda2ce (diff) |
Cleanup: Add asserts, remove default case
-rw-r--r-- | source/blender/blenkernel/intern/curve_bezier.cc | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curves_geometry.cc | 13 |
2 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/curve_bezier.cc b/source/blender/blenkernel/intern/curve_bezier.cc index 8efe7a17a35..b11216983b2 100644 --- a/source/blender/blenkernel/intern/curve_bezier.cc +++ b/source/blender/blenkernel/intern/curve_bezier.cc @@ -149,6 +149,10 @@ static void interpolate_to_evaluated(const Span<T> src, const Span<int> evaluated_offsets, MutableSpan<T> dst) { + BLI_assert(!src.is_empty()); + BLI_assert(dst.size() == src.size()); + BLI_assert(evaluated_offsets.last() == dst.size()); + linear_interpolation(src.first(), src[1], dst.take_front(evaluated_offsets.first())); threading::parallel_for( diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index 1dfd95ebb5b..7ceaa8f0f37 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -702,28 +702,25 @@ void CurvesGeometry::interpolate_to_evaluated(const int curve_index, case CURVE_TYPE_CATMULL_ROM: curves::catmull_rom::interpolate_to_evaluated( src, this->cyclic()[curve_index], this->resolution()[curve_index], dst); - break; + return; case CURVE_TYPE_POLY: dst.type().copy_assign_n(src.data(), dst.data(), src.size()); - break; + return; case CURVE_TYPE_BEZIER: curves::bezier::interpolate_to_evaluated( src, this->runtime->bezier_evaluated_offsets.as_span().slice(points), dst); - break; + return; case CURVE_TYPE_NURBS: curves::nurbs::interpolate_to_evaluated(this->runtime->nurbs_basis_cache[curve_index], this->nurbs_orders()[curve_index], this->nurbs_weights().slice(points), src, dst); - break; - default: - BLI_assert_unreachable(); - break; + return; } + BLI_assert_unreachable(); } - /** \} */ /* -------------------------------------------------------------------- */ |