Decodes 1-bit bitmap data by looking colors up in the two-color palette. */
| 785 | /* Decodes 1-bit bitmap data by looking colors up in the two-color palette. |
| 786 | */ |
| 787 | static void Decode1(uint8_t * p_out, |
| 788 | const uint8_t * p_out_end, |
| 789 | const uint8_t * p_file, |
| 790 | const read_context * p_ctx) |
| 791 | { |
| 792 | while(p_out < p_out_end) |
| 793 | { |
| 794 | unsigned int bit; |
| 795 | for(bit = 0; bit < 8 && p_out < p_out_end; bit++) |
| 796 | { |
| 797 | unsigned int lookup = (*p_file >> (7 - bit)) & 1; |
| 798 | |
| 799 | *p_out++ = p_ctx->palette[lookup].red; |
| 800 | *p_out++ = p_ctx->palette[lookup].green; |
| 801 | *p_out++ = p_ctx->palette[lookup].blue; |
| 802 | if(p_ctx->out_channels == 4) |
| 803 | *p_out++ = BMPREAD_DEFAULT_ALPHA; |
| 804 | } |
| 805 | |
| 806 | p_file++; |
| 807 | } |
| 808 | } |
| 809 | |
| 810 | /* Selects an above decoder and runs it for each scan line of the file. |
| 811 | * Returns 0 if there's an error or 1 if it's gravy. |
nothing calls this directly
no outgoing calls
no test coverage detected