returns -1 if color not present, its index otherwise*/
| 3025 | |
| 3026 | /*returns -1 if color not present, its index otherwise*/ |
| 3027 | static int color_tree_get(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
| 3028 | { |
| 3029 | int bit = 0; |
| 3030 | for(bit = 0; bit < 8; ++bit) |
| 3031 | { |
| 3032 | int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1); |
| 3033 | if(!tree->children[i]) return -1; |
| 3034 | else tree = tree->children[i]; |
| 3035 | } |
| 3036 | return tree ? tree->index : -1; |
| 3037 | } |
| 3038 | |
| 3039 | #ifdef LODEPNG_COMPILE_ENCODER |
| 3040 | static int color_tree_has(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
no outgoing calls
no test coverage detected