MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / stbi__gif_load

Function stbi__gif_load

lite/example/cpp_example/mge/cv/stb_image.h:7709–7738  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7707}
7708
7709static void* stbi__gif_load(
7710 stbi__context* s, int* x, int* y, int* comp, int req_comp,
7711 stbi__result_info* ri) {
7712 stbi_uc* u = 0;
7713 stbi__gif g;
7714 memset(&g, 0, sizeof(g));
7715 STBI_NOTUSED(ri);
7716
7717 u = stbi__gif_load_next(s, &g, comp, req_comp, 0);
7718 if (u == (stbi_uc*)s)
7719 u = 0; // end of animated gif marker
7720 if (u) {
7721 *x = g.w;
7722 *y = g.h;
7723
7724 // moved conversion to after successful load so that the same
7725 // can be done for multiple frames.
7726 if (req_comp && req_comp != 4)
7727 u = stbi__convert_format(u, 4, req_comp, g.w, g.h);
7728 } else if (g.out) {
7729 // if there was an error and we allocated an image buffer, free it!
7730 STBI_FREE(g.out);
7731 }
7732
7733 // free buffers needed for multiple frame loading;
7734 STBI_FREE(g.history);
7735 STBI_FREE(g.background);
7736
7737 return u;
7738}
7739
7740static int stbi__gif_info(stbi__context* s, int* x, int* y, int* comp) {
7741 return stbi__gif_info_raw(s, x, y, comp);

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