| 6649 | } |
| 6650 | |
| 6651 | static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code) |
| 6652 | { |
| 6653 | stbi_uc *p, *c; |
| 6654 | int idx; |
| 6655 | |
| 6656 | // recurse to decode the prefixes, since the linked-list is backwards, |
| 6657 | // and working backwards through an interleaved image would be nasty |
| 6658 | if (g->codes[code].prefix >= 0) |
| 6659 | stbi__out_gif_code(g, g->codes[code].prefix); |
| 6660 | |
| 6661 | if (g->cur_y >= g->max_y) return; |
| 6662 | |
| 6663 | idx = g->cur_x + g->cur_y; |
| 6664 | p = &g->out[idx]; |
| 6665 | g->history[idx / 4] = 1; |
| 6666 | |
| 6667 | c = &g->color_table[g->codes[code].suffix * 4]; |
| 6668 | if (c[3] > 128) { // don't render transparent pixels; |
| 6669 | p[0] = c[2]; |
| 6670 | p[1] = c[1]; |
| 6671 | p[2] = c[0]; |
| 6672 | p[3] = c[3]; |
| 6673 | } |
| 6674 | g->cur_x += 4; |
| 6675 | |
| 6676 | if (g->cur_x >= g->max_x) { |
| 6677 | g->cur_x = g->start_x; |
| 6678 | g->cur_y += g->step; |
| 6679 | |
| 6680 | while (g->cur_y >= g->max_y && g->parse > 0) { |
| 6681 | g->step = (1 << g->parse) * g->line_size; |
| 6682 | g->cur_y = g->start_y + (g->step >> 1); |
| 6683 | --g->parse; |
| 6684 | } |
| 6685 | } |
| 6686 | } |
| 6687 | |
| 6688 | static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) |
| 6689 | { |
no outgoing calls
no test coverage detected