returns STBI_rgb or whatever, 0 on error
| 5734 | #ifndef STBI_NO_TGA |
| 5735 | // returns STBI_rgb or whatever, 0 on error |
| 5736 | static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_rgb16) |
| 5737 | { |
| 5738 | // only RGB or RGBA (incl. 16bit) or grey allowed |
| 5739 | if (is_rgb16) *is_rgb16 = 0; |
| 5740 | switch(bits_per_pixel) { |
| 5741 | case 8: return STBI_grey; |
| 5742 | case 16: if(is_grey) return STBI_grey_alpha; |
| 5743 | // fallthrough |
| 5744 | case 15: if(is_rgb16) *is_rgb16 = 1; |
| 5745 | return STBI_rgb; |
| 5746 | case 24: // fallthrough |
| 5747 | case 32: return bits_per_pixel/8; |
| 5748 | default: return 0; |
| 5749 | } |
| 5750 | } |
| 5751 | |
| 5752 | static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp) |
| 5753 | { |
no outgoing calls
no test coverage detected