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