returns -1 if color not present, its index otherwise*/
| 2941 | |
| 2942 | /*returns -1 if color not present, its index otherwise*/ |
| 2943 | static 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 |
| 2956 | 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