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

Function color_tree_add

src/lodepng.cpp:2964–2979  ·  view source on GitHub ↗

color is not allowed to already exist. Index should be >= 0 (it's signed to be compatible with using -1 for "doesn't exist")*/

Source from the content-addressed store, hash-verified

2962/*color is not allowed to already exist.
2963Index should be >= 0 (it's signed to be compatible with using -1 for "doesn't exist")*/
2964static void color_tree_add(ColorTree* tree,
2965 unsigned char r, unsigned char g, unsigned char b, unsigned char a, int index)
2966{
2967 int bit;
2968 for(bit = 0; bit < 8; bit++)
2969 {
2970 int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1);
2971 if(!tree->children[i])
2972 {
2973 tree->children[i] = (ColorTree*)lodepng_malloc(sizeof(ColorTree));
2974 color_tree_init(tree->children[i]);
2975 }
2976 tree = tree->children[i];
2977 }
2978 tree->index = index;
2979}
2980
2981/*put a pixel, given its RGBA color, into image of any color type*/
2982static unsigned rgba8ToPixel(unsigned char* out, size_t i,

Callers 2

lodepng_convertFunction · 0.85
get_color_profileFunction · 0.85

Calls 2

lodepng_mallocFunction · 0.85
color_tree_initFunction · 0.85

Tested by

no test coverage detected