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

◆ nsgif__restore_bg()

static void fl::third_party::nsgif__restore_bg ( struct nsgif * gif,
struct nsgif_frame * frame,
fl::u32 * bitmap )
static

Restore a GIF to the background colour.

Parameters
[in]gifThe gif object we're decoding.
[in]frameThe frame to clear, or NULL.
[in]bitmapThe bitmap to clear the frame in.

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

651{
652 fl::size pixel_bytes = sizeof(*bitmap);
653
654 if (frame == nullptr) {
655 fl::size width = gif->info.width;
656 fl::size height = gif->info.height;
657
659 width * height * pixel_bytes);
660 } else {
661 fl::u32 width = frame->info.rect.x1 - frame->info.rect.x0;
662 fl::u32 height = frame->info.rect.y1 - frame->info.rect.y0;
663 fl::u32 offset_x = frame->info.rect.x0;
664 fl::u32 offset_y = frame->info.rect.y0;
665
666 if (frame->info.display == false ||
667 frame->info.rect.x0 >= gif->info.width ||
668 frame->info.rect.y0 >= gif->info.height) {
669 return;
670 }
671
672 width -= gif__clip(offset_x, width, gif->info.width);
673 height -= gif__clip(offset_y, height, gif->info.height);
674
675 if (frame->info.transparency) {
676 for (fl::u32 y = 0; y < height; y++) {
677 fl::u32 *scanline = bitmap + offset_x +
678 (offset_y + y) * gif->info.width;
680 width * pixel_bytes);
681 }
682 } else {
683 for (fl::u32 y = 0; y < height; y++) {
684 fl::u32 *scanline = bitmap + offset_x +
685 (offset_y + y) * gif->info.width;
686 for (fl::u32 x = 0; x < width; x++) {
687 scanline[x] = gif->info.background;
688 }
689 }
690 }
691 }
692}
int y
Definition simple.h:93
static fl::u32 gif__clip(fl::u32 frame_off, fl::u32 frame_dim, fl::u32 image_ext) FL_NOEXCEPT
Get any frame clip adjustment for the image extent.
Definition gif.cpp.hpp:413
nsgif_rect_t rect
Frame's redraw rectangle.
Definition nsgif.hpp:437
bool transparency
whether the frame may have transparency
Definition nsgif.hpp:426
bool display
whether the frame should be displayed/animated
Definition nsgif.hpp:424
fl::u32 background
background colour in same pixel format as nsgif_bitmap_t.
Definition nsgif.hpp:392
fl::u32 y0
y co-ordinate of redraw rectangle, top
Definition nsgif.hpp:48
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
fl::u32 x1
x co-ordinate of redraw rectangle, right
Definition nsgif.hpp:50
struct nsgif_info info
Definition gif.cpp.hpp:72
fl::u32 y1
y co-ordinate of redraw rectangle, bottom
Definition nsgif.hpp:52
fl::u32 x0
x co-ordinate of redraw rectangle, left
Definition nsgif.hpp:46
struct nsgif_frame_info info
Definition gif.cpp.hpp:38
u8 u8 height
Definition blur.h:186
void * memset(void *s, int c, size_t n) FL_NOEXCEPT
u8 width
Definition blur.h:186
#define NSGIF_TRANSPARENT_COLOUR
Transparent colour.
Definition gif.cpp.hpp:165

References FL_NOEXCEPT, gif__clip(), fl::height, fl::memset(), NSGIF_TRANSPARENT_COLOUR, fl::width, fl::x, and fl::y.

Referenced by nsgif__update_bitmap().

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