Decodes 32-bit bitmap data by applying bitmasks. The 16- and 32-bit * decoders could be made more efficient by whitelisting supported bit patterns * ahead of time and special-casing their decoding here, but this allows us to * support more bitmask patterns, and shouldn't be *too* inefficient in any * case. * * Takes a pointer to an output buffer scan line (p_out), a pointer to the end * of
| 656 | * scan line of file data (p_file), and our context. |
| 657 | */ |
| 658 | static void Decode32(uint8_t * p_out, |
| 659 | const uint8_t * p_out_end, |
| 660 | const uint8_t * p_file, |
| 661 | const read_context * p_ctx) |
| 662 | { |
| 663 | const bitfield * bf = p_ctx->bitfields; |
| 664 | |
| 665 | while(p_out < p_out_end) |
| 666 | { |
| 667 | uint32_t value = LoadLittleUint32(p_file); |
| 668 | |
| 669 | *p_out++ = Make8Bits(ApplyBitfield(value, bf[0]), bf[0].span); |
| 670 | *p_out++ = Make8Bits(ApplyBitfield(value, bf[1]), bf[1].span); |
| 671 | *p_out++ = Make8Bits(ApplyBitfield(value, bf[2]), bf[2].span); |
| 672 | if(p_ctx->out_channels == 4) |
| 673 | { |
| 674 | if(bf[3].span) |
| 675 | *p_out++ = Make8Bits(ApplyBitfield(value, bf[3]), bf[3].span); |
| 676 | else |
| 677 | *p_out++ = BMPREAD_DEFAULT_ALPHA; |
| 678 | } |
| 679 | |
| 680 | p_file += 4; |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | /* Decodes 24-bit bitmap data--basically just swaps the order of color |
| 685 | * components. |
nothing calls this directly
no test coverage detected