MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / color_profile_init

Function color_profile_init

src/lodepng.cpp:3489–3514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3487} ColorProfile;
3488
3489static void color_profile_init(ColorProfile* profile, const LodePNGColorMode* mode)
3490{
3491 profile->sixteenbit = 0;
3492 profile->sixteenbit_done = mode->bitdepth == 16 ? 0 : 1;
3493
3494 profile->colored = 0;
3495 profile->colored_done = lodepng_is_greyscale_type(mode) ? 1 : 0;
3496
3497 profile->key = 0;
3498 profile->alpha = 0;
3499 profile->alpha_done = lodepng_can_have_alpha(mode) ? 0 : 1;
3500
3501 profile->numcolors = 0;
3502 color_tree_init(&profile->tree);
3503 profile->palette = (unsigned char*)lodepng_malloc(1024);
3504 profile->maxnumcolors = 257;
3505 if(lodepng_get_bpp(mode) <= 8)
3506 {
3507 int bpp = lodepng_get_bpp(mode);
3508 profile->maxnumcolors = bpp == 1 ? 2 : (bpp == 2 ? 4 : (bpp == 4 ? 16 : 256));
3509 }
3510 profile->numcolors_done = 0;
3511
3512 profile->greybits = 1;
3513 profile->greybits_done = lodepng_get_bpp(mode) == 1 ? 1 : 0;
3514}
3515
3516static void color_profile_cleanup(ColorProfile* profile)
3517{

Callers 1

Calls 5

lodepng_can_have_alphaFunction · 0.85
color_tree_initFunction · 0.85
lodepng_mallocFunction · 0.85
lodepng_get_bppFunction · 0.85

Tested by

no test coverage detected