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

◆ nsgif__parse_logical_screen_descriptor()

static nsgif_error fl::third_party::nsgif__parse_logical_screen_descriptor ( struct nsgif * gif,
const fl::u8 ** pos )
static

Read Logical Screen Descriptor.

7-byte Logical Screen Descriptor is:

+0 SHORT Logical Screen Width +2 SHORT Logical Screen Height +4 CHAR Packed Fields 1BIT Global Colour Table Flag 3BITS Colour Resolution 1BIT Sort Flag 3BITS Size of Global Colour Table +5 CHAR Background Colour Index +6 CHAR Pixel Aspect Ratio

Parameters
[in]gifThe GIF object we're decoding.
[in,out]posThe current buffer position, updated on success.
Returns
NSGIF_OK on success, appropriate error otherwise.

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

1595{
1596 const fl::u8 *data = *pos;
1597 fl::size len = gif->buf + gif->buf_len - data;
1598
1599 if (len < 7) {
1600 return NSGIF_ERR_END_OF_DATA;
1601 }
1602
1603 gif->info.width = data[0] | (data[1] << 8);
1604 gif->info.height = data[2] | (data[3] << 8);
1606 gif->colour_table_size = 2 << (data[4] & NSGIF_COLOUR_TABLE_SIZE_MASK);
1607 gif->bg_index = data[5];
1608 gif->aspect_ratio = data[6];
1609 gif->info.loop_max = 1;
1610
1611 *pos += 7;
1612 return NSGIF_OK;
1613}
uint8_t pos
Definition Blur.ino:11
unsigned char u8
Definition coder.h:132
@ NSGIF_ERR_END_OF_DATA
Unexpected end of GIF source data.
Definition nsgif.hpp:87
@ NSGIF_OK
Success.
Definition nsgif.hpp:62
fl::u32 colour_table_size
size of global colour table (in entries)
Definition gif.cpp.hpp:122
fl::u32 aspect_ratio
image aspect ratio (ignored)
Definition gif.cpp.hpp:120
int loop_max
number of times to play animation (zero means loop forever)
Definition nsgif.hpp:390
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::size buf_len
total number of bytes of GIF data available
Definition gif.cpp.hpp:113
bool global_palette
whether the GIF has a global colour table
Definition nsgif.hpp:394
fl::u32 bg_index
background index
Definition gif.cpp.hpp:118
struct nsgif_info info
Definition gif.cpp.hpp:72
const fl::u8 * buf
pointer to GIF data
Definition gif.cpp.hpp:109
#define NSGIF_COLOUR_TABLE_SIZE_MASK
Definition gif.cpp.hpp:172
#define NSGIF_COLOUR_TABLE_MASK
Definition gif.cpp.hpp:171

References FL_NOEXCEPT, NSGIF_COLOUR_TABLE_MASK, NSGIF_COLOUR_TABLE_SIZE_MASK, NSGIF_ERR_END_OF_DATA, NSGIF_OK, and pos.

Referenced by nsgif_data_scan().

+ Here is the caller graph for this function: