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

◆ nsgif__update_bitmap()

static nsgif_error fl::third_party::nsgif__update_bitmap ( struct nsgif * gif,
struct nsgif_frame * frame,
const fl::u8 * data,
fl::u32 frame_idx )
static

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

699{
700 nsgif_error ret;
701 fl::u32 *bitmap;
702
703 gif->decoded_frame = frame_idx;
704
705 bitmap = nsgif__bitmap_get(gif);
706 if (bitmap == nullptr) {
707 return NSGIF_ERR_OOM;
708 }
709
710 /* Handle any bitmap clearing/restoration required before decoding this
711 * frame. */
712 if (frame_idx == 0 || gif->decoded_frame == NSGIF_FRAME_INVALID) {
713 nsgif__restore_bg(gif, nullptr, bitmap);
714
715 } else {
716 struct nsgif_frame *prev = &gif->frames[frame_idx - 1];
717
718 if (prev->info.disposal == NSGIF_DISPOSAL_RESTORE_BG) {
719 nsgif__restore_bg(gif, prev, bitmap);
720
721 } else if (prev->info.disposal == NSGIF_DISPOSAL_RESTORE_PREV) {
722 ret = nsgif__recover_frame(gif, bitmap);
723 if (ret != NSGIF_OK) {
724 nsgif__restore_bg(gif, prev, bitmap);
725 }
726 }
727 }
728
730 /* Store the previous frame for later restoration */
731 nsgif__record_frame(gif, bitmap);
732 }
733
734 ret = nsgif__decode(gif, frame, data, bitmap);
735
737
738 if (!frame->decoded) {
739 frame->opaque = nsgif__bitmap_get_opaque(gif);
740 frame->decoded = true;
741 }
742 nsgif__bitmap_set_opaque(gif, frame);
743
744 return ret;
745}
static void nsgif__restore_bg(struct nsgif *gif, struct nsgif_frame *frame, fl::u32 *bitmap) FL_NOEXCEPT
Restore a GIF to the background colour.
Definition gif.cpp.hpp:647
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
struct fl::third_party::nsgif_frame nsgif_frame
GIF frame data.
static void nsgif__record_frame(struct nsgif *gif, const fl::u32 *bitmap) FL_NOEXCEPT
Definition gif.cpp.hpp:302
nsgif_error
LibNSGIF return codes.
Definition nsgif.hpp:58
@ NSGIF_ERR_OOM
Out of memory error.
Definition nsgif.hpp:67
@ NSGIF_OK
Success.
Definition nsgif.hpp:62
static bool nsgif__bitmap_get_opaque(const struct nsgif *gif) FL_NOEXCEPT
Helper to get the client to determine if the bitmap is opaque.
Definition gif.cpp.hpp:291
@ NSGIF_DISPOSAL_RESTORE_BG
Clear frame to background colour.
Definition nsgif.hpp:406
@ NSGIF_DISPOSAL_RESTORE_PREV
Restore previous frame.
Definition nsgif.hpp:407
static nsgif_error nsgif__recover_frame(const struct nsgif *gif, fl::u32 *bitmap) FL_NOEXCEPT
Definition gif.cpp.hpp:338
static nsgif_error nsgif__decode(struct nsgif *gif, struct nsgif_frame *frame, const fl::u8 *data, fl::u32 *frame_data) FL_NOEXCEPT
Definition gif.cpp.hpp:605
static void nsgif__bitmap_modified(const struct nsgif *gif) FL_NOEXCEPT
Helper to tell the client that their bitmap was modified.
Definition gif.cpp.hpp:259
static void nsgif__bitmap_set_opaque(const struct nsgif *gif, const struct nsgif_frame *frame) FL_NOEXCEPT
Helper to tell the client that whether the bitmap is opaque.
Definition gif.cpp.hpp:273
bool opaque
whether the frame is totally opaque
Definition gif.cpp.hpp:45
nsgif_frame * frames
decoded frames
Definition gif.cpp.hpp:79
fl::u32 decoded_frame
current frame decoded to bitmap
Definition gif.cpp.hpp:83
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::u8 disposal
Disposal method for previous frame; affects plotting.
Definition nsgif.hpp:432
#define NSGIF_FRAME_INVALID
Internal flag that a frame is invalid/unprocessed.
Definition gif.cpp.hpp:162

References fl::third_party::nsgif_frame_info::disposal, FL_NOEXCEPT, fl::third_party::nsgif_frame::info, nsgif__bitmap_get(), nsgif__bitmap_get_opaque(), nsgif__bitmap_modified(), nsgif__bitmap_set_opaque(), nsgif__decode(), nsgif__record_frame(), nsgif__recover_frame(), nsgif__restore_bg(), NSGIF_DISPOSAL_RESTORE_BG, NSGIF_DISPOSAL_RESTORE_PREV, NSGIF_ERR_OOM, NSGIF_FRAME_INVALID, and NSGIF_OK.

Referenced by nsgif__parse_image_data().

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