| 7707 | } |
| 7708 | |
| 7709 | static 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 | |
| 7740 | static int stbi__gif_info(stbi__context* s, int* x, int* y, int* comp) { |
| 7741 | return stbi__gif_info_raw(s, x, y, comp); |
no test coverage detected