returns STBI_rgb or whatever, 0 on error
| 6333 | #ifndef STBI_NO_TGA |
| 6334 | // returns STBI_rgb or whatever, 0 on error |
| 6335 | static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_rgb16) { |
| 6336 | // only RGB or RGBA (incl. 16bit) or grey allowed |
| 6337 | if (is_rgb16) |
| 6338 | *is_rgb16 = 0; |
| 6339 | switch (bits_per_pixel) { |
| 6340 | case 8: |
| 6341 | return STBI_grey; |
| 6342 | case 16: |
| 6343 | if (is_grey) |
| 6344 | return STBI_grey_alpha; |
| 6345 | // fallthrough |
| 6346 | case 15: |
| 6347 | if (is_rgb16) |
| 6348 | *is_rgb16 = 1; |
| 6349 | return STBI_rgb; |
| 6350 | case 24: // fallthrough |
| 6351 | case 32: |
| 6352 | return bits_per_pixel / 8; |
| 6353 | default: |
| 6354 | return 0; |
| 6355 | } |
| 6356 | } |
| 6357 | |
| 6358 | static int stbi__tga_info(stbi__context* s, int* x, int* y, int* comp) { |
| 6359 | int tga_w, tga_h, tga_comp, tga_image_type, tga_bits_per_pixel, tga_colormap_bpp; |
no outgoing calls
no test coverage detected