MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / stbi__gif_load

Function stbi__gif_load

Source/Utils/stb_image.h:7045–7072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7043}
7044
7045static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri)
7046{
7047 stbi_uc *u = 0;
7048 stbi__gif g;
7049 memset(&g, 0, sizeof(g));
7050 STBI_NOTUSED(ri);
7051
7052 u = stbi__gif_load_next(s, &g, comp, req_comp, 0);
7053 if (u == (stbi_uc *) s) u = 0; // end of animated gif marker
7054 if (u) {
7055 *x = g.w;
7056 *y = g.h;
7057
7058 // moved conversion to after successful load so that the same
7059 // can be done for multiple frames.
7060 if (req_comp && req_comp != 4)
7061 u = stbi__convert_format(u, 4, req_comp, g.w, g.h);
7062 } else if (g.out) {
7063 // if there was an error and we allocated an image buffer, free it!
7064 STBI_FREE(g.out);
7065 }
7066
7067 // free buffers needed for multiple frame loading;
7068 STBI_FREE(g.history);
7069 STBI_FREE(g.background);
7070
7071 return u;
7072}
7073
7074static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp)
7075{

Callers 1

stbi__load_mainFunction · 0.85

Calls 2

stbi__gif_load_nextFunction · 0.85
stbi__convert_formatFunction · 0.85

Tested by

no test coverage detected