2016-04-21 23:31:00 +02:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ML_bmp_16_and_cl.c */
|
2016-04-22 07:06:40 +02:00
|
|
|
/* | Project : libmonochrome */
|
2016-04-21 23:31:00 +02:00
|
|
|
/* */
|
|
|
|
/* By: Pierre "PierrotLL" Le Gall <legallpierre89@gmail.com> */
|
|
|
|
/* Last updated: 2011/11/22 */
|
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include <monochrome/internals.h>
|
|
|
|
|
|
|
|
void ML_bmp_16_and_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 = ~((unsigned short)~bmp[i]<<shift);
|
|
|
|
if(bool1) screen[0] &= *p;
|
|
|
|
if(bool2) screen[1] &= *(p+1);
|
|
|
|
if(bool3) screen[2] &= *(p+2);
|
|
|
|
screen += 16;
|
|
|
|
}
|
|
|
|
}
|