| 4928 | } |
| 4929 | |
| 4930 | static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3], int out_n) |
| 4931 | { |
| 4932 | stbi__context *s = z->s; |
| 4933 | stbi__uint32 i, pixel_count = s->img_x * s->img_y; |
| 4934 | stbi__uint16 *p = (stbi__uint16*) z->out; |
| 4935 | |
| 4936 | // compute color-based transparency, assuming we've |
| 4937 | // already got 65535 as the alpha value in the output |
| 4938 | STBI_ASSERT(out_n == 2 || out_n == 4); |
| 4939 | |
| 4940 | if (out_n == 2) { |
| 4941 | for (i = 0; i < pixel_count; ++i) { |
| 4942 | p[1] = (p[0] == tc[0] ? 0 : 65535); |
| 4943 | p += 2; |
| 4944 | } |
| 4945 | } else { |
| 4946 | for (i = 0; i < pixel_count; ++i) { |
| 4947 | if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) |
| 4948 | p[3] = 0; |
| 4949 | p += 4; |
| 4950 | } |
| 4951 | } |
| 4952 | return 1; |
| 4953 | } |
| 4954 | |
| 4955 | static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int pal_img_n) |
| 4956 | { |
no outgoing calls
no test coverage detected