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

◆ nsgif__get_frame()

static struct nsgif_frame * fl::third_party::nsgif__get_frame ( struct nsgif * gif,
fl::u32 frame_idx )
static

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

1276{
1277 struct nsgif_frame *frame;
1278
1279 if (gif->frame_holders > frame_idx) {
1280 frame = &gif->frames[frame_idx];
1281 } else {
1282 /* Allocate more memory */
1283 fl::size count = frame_idx + 1;
1284 struct nsgif_frame *temp;
1285
1286 temp = static_cast<struct nsgif_frame*>(fl::Malloc(count * sizeof(*frame)));
1287 if (temp == nullptr) {
1288 return nullptr;
1289 }
1290 if (gif->frames) {
1291 fl::memcpy(temp, gif->frames, gif->frame_holders * sizeof(*frame));
1292 fl::Free(gif->frames);
1293 }
1294 gif->frames = temp;
1295 gif->frame_holders = count;
1296
1297 frame = &gif->frames[frame_idx];
1298
1299 frame->info.local_palette = false;
1300 frame->info.transparency = false;
1301 frame->info.display = false;
1302 frame->info.disposal = 0;
1303 frame->info.delay = 10;
1304
1306 frame->frame_offset = gif->buf_pos;
1307 frame->redraw_required = false;
1308 frame->lzw_data_length = 0;
1309 frame->decoded = false;
1310 }
1311
1312 return frame;
1313}
struct fl::third_party::nsgif_frame nsgif_frame
GIF frame data.
fl::size frame_offset
offset (in bytes) to the GIF frame data
Definition gif.cpp.hpp:41
bool redraw_required
whether a full image redraw is required
Definition gif.cpp.hpp:47
bool transparency
whether the frame may have transparency
Definition nsgif.hpp:426
bool local_palette
whether the frame has a local colour table
Definition nsgif.hpp:428
nsgif_frame * frames
decoded frames
Definition gif.cpp.hpp:79
bool display
whether the frame should be displayed/animated
Definition nsgif.hpp:424
fl::size buf_pos
current index into GIF data
Definition gif.cpp.hpp:111
fl::u32 delay
delay (in cs) before animating the frame
Definition nsgif.hpp:434
fl::u32 lzw_data_length
Amount of LZW data found in scan.
Definition gif.cpp.hpp:50
fl::u32 transparency_index
the index designating a transparent pixel
Definition gif.cpp.hpp:53
bool decoded
whether the frame has previously been decoded.
Definition gif.cpp.hpp:43
struct nsgif_frame_info info
Definition gif.cpp.hpp:38
fl::u32 frame_holders
current number of frame holders
Definition gif.cpp.hpp:116
fl::u8 disposal
Disposal method for previous frame; affects plotting.
Definition nsgif.hpp:432
void Free(void *ptr)
void * memcpy(void *dest, const void *src, size_t n) FL_NOEXCEPT
void * Malloc(fl::size size)
#define NSGIF_NO_TRANSPARENCY
No transparency.
Definition gif.cpp.hpp:168

References fl::third_party::nsgif_frame::decoded, fl::third_party::nsgif_frame_info::delay, fl::third_party::nsgif_frame_info::display, fl::third_party::nsgif_frame_info::disposal, FL_NOEXCEPT, fl::third_party::nsgif_frame::frame_offset, fl::Free(), fl::third_party::nsgif_frame::info, fl::third_party::nsgif_frame_info::local_palette, fl::third_party::nsgif_frame::lzw_data_length, fl::Malloc(), fl::memcpy(), NSGIF_NO_TRANSPARENCY, fl::third_party::nsgif_frame::redraw_required, fl::third_party::nsgif_frame_info::transparency, and fl::third_party::nsgif_frame::transparency_index.

Referenced by nsgif__process_frame().

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