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

Function Decode1

include/bmpread/bmpread.c:787–808  ·  view source on GitHub ↗

Decodes 1-bit bitmap data by looking colors up in the two-color palette. */

Source from the content-addressed store, hash-verified

785/* Decodes 1-bit bitmap data by looking colors up in the two-color palette.
786 */
787static 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.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected