FastLED 3.9.15
Loading...
Searching...
No Matches

◆ onQueuingDone()

bool fl::RectangularDrawBuffer::onQueuingDone ( )

Definition at line 49 of file rectangular_draw_buffer.cpp.

49 {
50 if (mQueueState == QUEUE_DONE) {
51 return false;
52 }
55 // iterator through the current draw objects and calculate the total
56 // number of bytes (representing RGB or RGBW) that will be drawn this frame.
57 uint32_t total_bytes = 0;
58 uint32_t max_bytes_in_strip = 0;
59 uint32_t num_strips = 0;
60 getBlockInfo(&num_strips, &max_bytes_in_strip, &total_bytes);
61 if (total_bytes > mAllLedsBufferUint8Size) {
62 uint8_t *old_ptr = mAllLedsBufferUint8.release();
64 uint8_t *ptr = fl::LargeBlockAllocator<uint8_t>::Alloc(total_bytes);
65 mAllLedsBufferUint8.reset(ptr);
66 }
67 mAllLedsBufferUint8Size = total_bytes;
68 uint32_t offset = 0;
69 for (auto it = mDrawList.begin(); it != mDrawList.end(); ++it) {
70 uint8_t pin = it->mPin;
71 Slice<uint8_t> slice(mAllLedsBufferUint8.get() + offset,
72 max_bytes_in_strip);
73 mPinToLedSegment[pin] = slice;
74 offset += max_bytes_in_strip;
75 }
76 return true;
77}
static T * Alloc(size_t n)
Definition allocator.h:15
static void Free(T *p)
Definition allocator.h:20
void getBlockInfo(uint32_t *num_strips, uint32_t *bytes_per_strip, uint32_t *total_bytes) const
fl::FixedMap< uint8_t, fl::Slice< uint8_t >, 50 > mPinToLedSegment
scoped_array< uint8_t > mAllLedsBufferUint8
UISlider offset("Offset", 0.0f, 0.0f, 1.0f, 0.01f)

References fl::LargeBlockAllocator< T >::Alloc(), fl::LargeBlockAllocator< T >::Free(), getBlockInfo(), mAllLedsBufferUint8, mAllLedsBufferUint8Size, mDrawList, mDrawListChangedThisFrame, mPinToLedSegment, mPrevDrawList, mQueueState, offset(), and QUEUE_DONE.

+ Here is the call graph for this function: