Decodes 4-bit bitmap data by looking colors up in the palette. */
| 755 | /* Decodes 4-bit bitmap data by looking colors up in the palette. |
| 756 | */ |
| 757 | static void Decode4(uint8_t * p_out, |
| 758 | const uint8_t * p_out_end, |
| 759 | const uint8_t * p_file, |
| 760 | const read_context * p_ctx) |
| 761 | { |
| 762 | while(p_out < p_out_end) |
| 763 | { |
| 764 | unsigned int lookup = (*p_file & 0xf0U) >> 4; |
| 765 | |
| 766 | *p_out++ = p_ctx->palette[lookup].red; |
| 767 | *p_out++ = p_ctx->palette[lookup].green; |
| 768 | *p_out++ = p_ctx->palette[lookup].blue; |
| 769 | if(p_ctx->out_channels == 4) |
| 770 | *p_out++ = BMPREAD_DEFAULT_ALPHA; |
| 771 | |
| 772 | if(p_out < p_out_end) |
| 773 | { |
| 774 | lookup = *p_file++ & 0x0fU; |
| 775 | |
| 776 | *p_out++ = p_ctx->palette[lookup].red; |
| 777 | *p_out++ = p_ctx->palette[lookup].green; |
| 778 | *p_out++ = p_ctx->palette[lookup].blue; |
| 779 | if(p_ctx->out_channels == 4) |
| 780 | *p_out++ = BMPREAD_DEFAULT_ALPHA; |
| 781 | } |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | /* Decodes 1-bit bitmap data by looking colors up in the two-color palette. |
| 786 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected