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

◆ nsgif__record_frame()

static void fl::third_party::nsgif__record_frame ( struct nsgif * gif,
const fl::u32 * bitmap )
static

Definition at line 302 of file gif.cpp.hpp.

305{
306 fl::size pixel_bytes = sizeof(*bitmap);
307 fl::size height = gif->info.height;
308 fl::size width = gif->info.width;
309 fl::u32 *prev_frame;
310
312 gif->decoded_frame == gif->prev_index) {
313 /* No frame to copy, or already have this frame recorded. */
314 return;
315 }
316
317 bitmap = nsgif__bitmap_get(gif);
318 if (bitmap == nullptr) {
319 return;
320 }
321
322 if (gif->prev_frame == nullptr) {
323 prev_frame = static_cast<fl::u32*>(fl::Malloc(width * height * pixel_bytes));
324 if (prev_frame == nullptr) {
325 return;
326 }
327 gif->prev_frame = prev_frame;
328 } else {
329 prev_frame = static_cast<fl::u32*>(gif->prev_frame);
330 }
331
332 fl::memcpy(prev_frame, bitmap, width * height * pixel_bytes);
333
334 gif->prev_frame = prev_frame;
335 gif->prev_index = gif->decoded_frame;
336}
static fl::u32 * nsgif__bitmap_get(struct nsgif *gif) FL_NOEXCEPT
Helper to get the rendering bitmap for a gif.
Definition gif.cpp.hpp:233
fl::u32 prev_index
previous frame index
Definition gif.cpp.hpp:136
fl::u32 decoded_frame
current frame decoded to bitmap
Definition gif.cpp.hpp:83
fl::u32 width
width of GIF (may increase during decoding)
Definition nsgif.hpp:384
fl::u32 height
height of GIF (may increase during decoding)
Definition nsgif.hpp:386
struct nsgif_info info
Definition gif.cpp.hpp:72
void * prev_frame
previous frame for NSGIF_FRAME_RESTORE
Definition gif.cpp.hpp:134
void * memcpy(void *dest, const void *src, size_t n) FL_NOEXCEPT
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186
void * Malloc(fl::size size)
#define NSGIF_FRAME_INVALID
Internal flag that a frame is invalid/unprocessed.
Definition gif.cpp.hpp:162

References FL_NOEXCEPT, fl::height, fl::Malloc(), fl::memcpy(), nsgif__bitmap_get(), NSGIF_FRAME_INVALID, and fl::width.

Referenced by nsgif__update_bitmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: