MCPcopy Create free account
hub / github.com/FastLED/FastLED / safeCopy

Method safeCopy

src/fl/math/line_simplification.h:333–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331
332 template <typename VectorType>
333 void safeCopy(const fl::span<const Point> &polyLine, VectorType *out) {
334 auto *first_out = out->data();
335 // auto* last_out = first_out + mCount;
336 auto *other_first_out = polyLine.data();
337 // auto* other_last_out = other_first_out + polyLine.size();
338 const bool is_same = first_out == other_first_out;
339 if (is_same) {
340 return;
341 }
342 auto *last_out = first_out + mCount;
343 auto *other_last_out = other_first_out + polyLine.size();
344
345 const bool is_overlapping =
346 (first_out >= other_first_out && first_out < other_last_out) ||
347 (other_first_out >= first_out && other_first_out < last_out);
348
349 if (!is_overlapping) {
350 out->assign(polyLine.data(), polyLine.data() + polyLine.size());
351 return;
352 }
353
354 // allocate a temporary buffer
355 fl::vector_inlined<Point, 64> temp;
356 temp.assign(polyLine.begin(), polyLine.end());
357 out->assign(temp.begin(), temp.end());
358 return;
359 }
360
361 u32 mCount = 10;
362 LineSimplifier<NumberT> mLineSimplifier;

Callers

nothing calls this directly

Calls 5

dataMethod · 0.45
sizeMethod · 0.45
assignMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected