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

Function stbi__load_and_postprocess_8bit

Source/Utils/stb_image.h:1259–1283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1257#endif
1258
1259static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)
1260{
1261 stbi__result_info ri;
1262 void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8);
1263
1264 if (result == NULL)
1265 return NULL;
1266
1267 // it is the responsibility of the loaders to make sure we get either 8 or 16 bit.
1268 STBI_ASSERT(ri.bits_per_channel == 8 || ri.bits_per_channel == 16);
1269
1270 if (ri.bits_per_channel != 8) {
1271 result = stbi__convert_16_to_8((stbi__uint16 *) result, *x, *y, req_comp == 0 ? *comp : req_comp);
1272 ri.bits_per_channel = 8;
1273 }
1274
1275 // @TODO: move stbi__convert_format to here
1276
1277 if (stbi__vertically_flip_on_load) {
1278 int channels = req_comp ? req_comp : *comp;
1279 stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi_uc));
1280 }
1281
1282 return (unsigned char *) result;
1283}
1284
1285static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp)
1286{

Callers 4

stbi_load_from_fileFunction · 0.85
stbi_load_from_memoryFunction · 0.85
stbi_load_from_callbacksFunction · 0.85
stbi__loadf_mainFunction · 0.85

Calls 3

stbi__load_mainFunction · 0.85
stbi__convert_16_to_8Function · 0.85
stbi__vertical_flipFunction · 0.85

Tested by

no test coverage detected