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

Function stbi__out_gif_code

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

Source from the content-addressed store, hash-verified

7295}
7296
7297static void stbi__out_gif_code(stbi__gif* g, stbi__uint16 code) {
7298 stbi_uc *p, *c;
7299 int idx;
7300
7301 // recurse to decode the prefixes, since the linked-list is backwards,
7302 // and working backwards through an interleaved image would be nasty
7303 if (g->codes[code].prefix >= 0)
7304 stbi__out_gif_code(g, g->codes[code].prefix);
7305
7306 if (g->cur_y >= g->max_y)
7307 return;
7308
7309 idx = g->cur_x + g->cur_y;
7310 p = &g->out[idx];
7311 g->history[idx / 4] = 1;
7312
7313 c = &g->color_table[g->codes[code].suffix * 4];
7314 if (c[3] > 128) { // don't render transparent pixels;
7315 p[0] = c[2];
7316 p[1] = c[1];
7317 p[2] = c[0];
7318 p[3] = c[3];
7319 }
7320 g->cur_x += 4;
7321
7322 if (g->cur_x >= g->max_x) {
7323 g->cur_x = g->start_x;
7324 g->cur_y += g->step;
7325
7326 while (g->cur_y >= g->max_y && g->parse > 0) {
7327 g->step = (1 << g->parse) * g->line_size;
7328 g->cur_y = g->start_y + (g->step >> 1);
7329 --g->parse;
7330 }
7331 }
7332}
7333
7334static stbi_uc* stbi__process_gif_raster(stbi__context* s, stbi__gif* g) {
7335 stbi_uc lzw_cs;

Callers 1

stbi__process_gif_rasterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected