MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / Decode16

Function Decode16

include/bmpread/bmpread.c:711–735  ·  view source on GitHub ↗

Decodes 16-bit bitmap data by applying bitmasks. */

Source from the content-addressed store, hash-verified

709/* Decodes 16-bit bitmap data by applying bitmasks.
710 */
711static void Decode16(uint8_t * p_out,
712 const uint8_t * p_out_end,
713 const uint8_t * p_file,
714 const read_context * p_ctx)
715{
716 const bitfield * bf = p_ctx->bitfields;
717
718 while(p_out < p_out_end)
719 {
720 uint16_t value = LoadLittleUint16(p_file);
721
722 *p_out++ = Make8Bits(ApplyBitfield(value, bf[0]), bf[0].span);
723 *p_out++ = Make8Bits(ApplyBitfield(value, bf[1]), bf[1].span);
724 *p_out++ = Make8Bits(ApplyBitfield(value, bf[2]), bf[2].span);
725 if(p_ctx->out_channels == 4)
726 {
727 if(bf[3].span)
728 *p_out++ = Make8Bits(ApplyBitfield(value, bf[3]), bf[3].span);
729 else
730 *p_out++ = BMPREAD_DEFAULT_ALPHA;
731 }
732
733 p_file += 2;
734 }
735}
736
737/* Decodes 8-bit bitmap data by looking colors up in the palette.
738 */

Callers

nothing calls this directly

Calls 1

Make8BitsFunction · 0.85

Tested by

no test coverage detected