📄 lcdslin.lst
字号:
LCD_PIXELINDEX Index1 = *(pTrans+1);
x+=Diff;
if ((Index0==Index1) & (!(GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)))) {
LCD_PIXELINDEX ColorIndexOld= COLOR;
COLOR = Index0;
LCD_L0_DrawHLine(x,y,x+xsize-1);
COLOR = ColorIndexOld;
return;
}
{
int Adr=XY2OFF(x,y);
int x1 = x+xsize-1;
U8 Mask = 0xff >> (x &7);
U8 EndMask = 0xff80 >> (x1&7);
U8 CacheByte;
U16 PixelData;
int NumBytes = (x1>>3) - (x>>3);
if (NumBytes) {
CacheByte=Cache[Adr];
PixelData = (*(p+1) | ((*p)<<8));
PixelData >>= (8+(x&7)-(Diff&7));
switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
case 0:
if (!COLOR)
PixelData ^= 255;
CacheByte = (CacheByte&~Mask)|(PixelData&Mask);
break;
case LCD_DRAWMODE_TRANS:
if (COLOR)
CacheByte |= (PixelData&Mask);
else
CacheByte &= ~(PixelData&Mask);
break;
case LCD_DRAWMODE_XOR:
CacheByte ^= (PixelData&Mask);
break;
}
LCD_WRITE(Adr++,CacheByte);
{
int DiffOld = Diff;
Diff+= 8-(x&7);
if ((DiffOld&~7) != (Diff&~7))
p++;
}
x=0;
NumBytes--;
for (; NumBytes; NumBytes--) {
PixelData = (*(p+1) | ((*p)<<8));
PixelData >>= (8-(Diff&7));
p++;
switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
case 0:
if (!COLOR)
PixelData ^= 255;
CacheByte=PixelData&255;
break;
case LCD_DRAWMODE_TRANS:
CacheByte=Cache[Adr];
if (COLOR)
CacheByte |= PixelData;
C51 COMPILER V8.05a LCDSLIN 04/11/2008 14:19:26 PAGE 16
else
CacheByte &= ~PixelData;
break;
case LCD_DRAWMODE_XOR:
CacheByte=Cache[Adr] ^ PixelData;
break;
}
LCD_WRITE(Adr++,CacheByte);
}
Mask = 0xff;
}
PixelData = (*(p+1) | ((*p)<<8));
PixelData >>= (8+(x&7)-(Diff&7));
Mask &= EndMask;
CacheByte = Cache[Adr];
switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
case 0:
if (!COLOR)
PixelData ^= 255;
CacheByte = (CacheByte&~Mask)|(PixelData&Mask);
break;
case LCD_DRAWMODE_TRANS:
if (COLOR)
CacheByte |= (PixelData&Mask);
else
CacheByte &= ~(PixelData&Mask);
break;
case LCD_DRAWMODE_XOR:
CacheByte ^= (PixelData&Mask);
break;
}
LCD_WRITE(Adr++,CacheByte);
}
}
#else
/*
*********************************************************
* *
* Draw Bitmap 1 BPP, no optimization *
* *
*********************************************************
*/
static void DrawBitLine1BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
PIXELCOLOR pixels;
PIXELCOLOR Index0 = *(pTrans+0);
PIXELCOLOR Index1 = *(pTrans+1);
/*
Jump to right entry point
*/
pixels = *p;
switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
case 0:
switch (Diff&7) {
case 0:
goto WriteBit0;
case 1:
goto WriteBit1;
case 2:
C51 COMPILER V8.05a LCDSLIN 04/11/2008 14:19:26 PAGE 17
goto WriteBit2;
case 3:
goto WriteBit3;
case 4:
goto WriteBit4;
case 5:
goto WriteBit5;
case 6:
goto WriteBit6;
case 7:
goto WriteBit7;
}
break;
case LCD_DRAWMODE_TRANS:
switch (Diff&7) {
case 0:
goto WriteTBit0;
case 1:
goto WriteTBit1;
case 2:
goto WriteTBit2;
case 3:
goto WriteTBit3;
case 4:
goto WriteTBit4;
case 5:
goto WriteTBit5;
case 6:
goto WriteTBit6;
case 7:
goto WriteTBit7;
}
break;
case LCD_DRAWMODE_XOR:
switch (Diff&7) {
case 0:
goto WriteXBit0;
case 1:
goto WriteXBit1;
case 2:
goto WriteXBit2;
case 3:
goto WriteXBit3;
case 4:
goto WriteXBit4;
case 5:
goto WriteXBit5;
case 6:
goto WriteXBit6;
case 7:
goto WriteXBit7;
}
}
/*
Write with transparency
*/
WriteTBit0:
if (pixels&(1<<7)) SETPIXEL(x+0, y, Index1);
if (!--xsize)
return;
WriteTBit1:
if (pixels&(1<<6)) SETPIXEL(x+1, y, Index1);
C51 COMPILER V8.05a LCDSLIN 04/11/2008 14:19:26 PAGE 18
if (!--xsize)
return;
WriteTBit2:
if (pixels&(1<<5)) SETPIXEL(x+2, y, Index1);
if (!--xsize)
return;
WriteTBit3:
if (pixels&(1<<4)) SETPIXEL(x+3, y, Index1);
if (!--xsize)
return;
WriteTBit4:
if (pixels&(1<<3)) SETPIXEL(x+4, y, Index1);
if (!--xsize)
return;
WriteTBit5:
if (pixels&(1<<2)) SETPIXEL(x+5, y, Index1);
if (!--xsize)
return;
WriteTBit6:
if (pixels&(1<<1)) SETPIXEL(x+6, y, Index1);
if (!--xsize)
return;
WriteTBit7:
if (pixels&(1<<0)) SETPIXEL(x+7, y, Index1);
if (!--xsize)
return;
x+=8;
pixels = *(++p);
goto WriteTBit0;
/*
Write without transparency
*/
WriteBit0:
SETPIXEL(x+0, y, (pixels&(1<<7)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit1:
SETPIXEL(x+1, y, (pixels&(1<<6)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit2:
SETPIXEL(x+2, y, (pixels&(1<<5)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit3:
SETPIXEL(x+3, y, (pixels&(1<<4)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit4:
SETPIXEL(x+4, y, (pixels&(1<<3)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit5:
SETPIXEL(x+5, y, (pixels&(1<<2)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit6:
SETPIXEL(x+6, y, (pixels&(1<<1)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit7:
C51 COMPILER V8.05a LCDSLIN 04/11/2008 14:19:26 PAGE 19
SETPIXEL(x+7, y, (pixels&(1<<0)) ? Index1 : Index0);
if (!--xsize)
return;
x+=8;
pixels = *(++p);
goto WriteBit0;
/*
Write XOR mode
*/
WriteXBit0:
if (pixels&(1<<7))
XORPIXEL(x+0, y);
if (!--xsize)
return;
WriteXBit1:
if (pixels&(1<<6))
XORPIXEL(x+1, y);
if (!--xsize)
return;
WriteXBit2:
if (pixels&(1<<5))
XORPIXEL(x+2, y);
if (!--xsize)
return;
WriteXBit3:
if (pixels&(1<<4))
XORPIXEL(x+3, y);
if (!--xsize)
return;
WriteXBit4:
if (pixels&(1<<3))
XORPIXEL(x+4, y);
if (!--xsize)
return;
WriteXBit5:
if (pixels&(1<<2))
XORPIXEL(x+5, y);
if (!--xsize)
return;
WriteXBit6:
if (pixels&(1<<1))
XORPIXEL(x+6, y);
if (!--xsize)
return;
WriteXBit7:
if (pixels&(1<<0))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -