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

Function stbi__bmp_set_mask_defaults

Source/Utils/stb_image.h:5419–5443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5417} stbi__bmp_data;
5418
5419static int stbi__bmp_set_mask_defaults(stbi__bmp_data *info, int compress)
5420{
5421 // BI_BITFIELDS specifies masks explicitly, don't override
5422 if (compress == 3)
5423 return 1;
5424
5425 if (compress == 0) {
5426 if (info->bpp == 16) {
5427 info->mr = 31u << 10;
5428 info->mg = 31u << 5;
5429 info->mb = 31u << 0;
5430 } else if (info->bpp == 32) {
5431 info->mr = 0xffu << 16;
5432 info->mg = 0xffu << 8;
5433 info->mb = 0xffu << 0;
5434 info->ma = 0xffu << 24;
5435 info->all_a = 0; // if all_a is 0 at end, then we loaded alpha channel but it was all 0
5436 } else {
5437 // otherwise, use defaults, which is all-0
5438 info->mr = info->mg = info->mb = info->ma = 0;
5439 }
5440 return 1;
5441 }
5442 return 0; // error
5443}
5444
5445static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info)
5446{

Callers 1

stbi__bmp_parse_headerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected