MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stbi__gif_header

Function stbi__gif_header

include/stb/stb_image.h:6608–6637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6606}
6607
6608static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_info)
6609{
6610 stbi_uc version;
6611 if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8')
6612 return stbi__err("not GIF", "Corrupt GIF");
6613
6614 version = stbi__get8(s);
6615 if (version != '7' && version != '9') return stbi__err("not GIF", "Corrupt GIF");
6616 if (stbi__get8(s) != 'a') return stbi__err("not GIF", "Corrupt GIF");
6617
6618 stbi__g_failure_reason = "";
6619 g->w = stbi__get16le(s);
6620 g->h = stbi__get16le(s);
6621 g->flags = stbi__get8(s);
6622 g->bgindex = stbi__get8(s);
6623 g->ratio = stbi__get8(s);
6624 g->transparent = -1;
6625
6626 if (g->w > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)");
6627 if (g->h > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)");
6628
6629 if (comp != 0) *comp = 4; // can't actually tell whether it's 3 or 4 until we parse the comments
6630
6631 if (is_info) return 1;
6632
6633 if (g->flags & 0x80)
6634 stbi__gif_parse_colortable(s,g->pal, 2 << (g->flags & 7), -1);
6635
6636 return 1;
6637}
6638
6639static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp)
6640{

Callers 2

stbi__gif_info_rawFunction · 0.85
stbi__gif_load_nextFunction · 0.85

Calls 4

stbi__get8Function · 0.85
stbi__errFunction · 0.85
stbi__get16leFunction · 0.85

Tested by

no test coverage detected