MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / stbi__tga_get_comp

Function stbi__tga_get_comp

Source/Utils/stb_image.h:5736–5750  ·  view source on GitHub ↗

returns STBI_rgb or whatever, 0 on error

Source from the content-addressed store, hash-verified

5734#ifndef STBI_NO_TGA
5735// returns STBI_rgb or whatever, 0 on error
5736static 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
5752static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp)
5753{

Callers 2

stbi__tga_infoFunction · 0.85
stbi__tga_loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected