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

Function color_tree_get

src/lodepng.cpp:2943–2953  ·  view source on GitHub ↗

returns -1 if color not present, its index otherwise*/

Source from the content-addressed store, hash-verified

2941
2942/*returns -1 if color not present, its index otherwise*/
2943static int color_tree_get(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
2944{
2945 int bit = 0;
2946 for(bit = 0; bit < 8; bit++)
2947 {
2948 int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1);
2949 if(!tree->children[i]) return -1;
2950 else tree = tree->children[i];
2951 }
2952 return tree ? tree->index : -1;
2953}
2954
2955#ifdef LODEPNG_COMPILE_ENCODER
2956static int color_tree_has(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a)

Callers 2

color_tree_hasFunction · 0.85
rgba8ToPixelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected