libmonochrome/src/ML_bmp_16_or_cl.c

34 lines
1.3 KiB
C

/* ************************************************************************** */
/* */
/* ML_bmp_16_or_cl.c */
/* | Project : libmonochrome */
/* */
/* By: Pierre "PierrotLL" Le Gall <legallpierre89@gmail.com> */
/* Last updated: 2011/11/22 */
/* */
/* ************************************************************************** */
#include <monochrome/internals.h>
void ML_bmp_16_or_cl(const unsigned short *bmp, int x, int y)
{
unsigned long line;
char i, shift, begin=0, end=16, bool1=1, bool2=1, bool3=1, *screen, *p=(char*)&line+1;
if(!bmp || x<-15 || x>127 || y<-15 || y>63) return;
if(y < 0) begin = -y;
if(y > 48) end = 64-y;
shift = 8-(x&7);
if(x < 0) bool1 = 0;
if(x<-8 || x>119) bool2 = 0;
if(x>111 || shift==8) bool3 = 0;
screen = ML_vram_adress()+(y+begin<<4)+(x>>3);
for(i=begin ; i<end ; i++)
{
line = bmp[i]<<shift;
if(bool1) screen[0] |= *p;
if(bool2) screen[1] |= *(p+1);
if(bool3) screen[2] |= *(p+2);
screen += 16;
}
}