📄 lcdmemc.c
字号:
if (pixels&(1<<1))
XORPIXEL(x+6, y);
if (!--xsize)
return;
WriteXBit7:
if (pixels&(1<<0))
XORPIXEL(x+7, y);
if (!--xsize)
return;
x+=8;
pixels = *(++p);
goto WriteXBit0;
}
/*
*********************************************
* *
* Draw Bitmap 2 BPP *
* *
*********************************************
*/
#if (LCD_MAX_LOG_COLORS > 2)
static void DrawBitLine2BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX pixels;
/*
// Jump to right entry point
*/
pixels = *p;
if (GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) {
switch (Diff&3) {
case 0:
goto WriteTBit0;
case 1:
goto WriteTBit1;
case 2:
goto WriteTBit2;
default:
goto WriteTBit3;
}
} else {
switch (Diff&3) {
case 0:
goto WriteBit0;
case 1:
goto WriteBit1;
case 2:
goto WriteBit2;
default:
goto WriteBit3;
}
}
/*
Write without transparency
*/
WriteBit0:
SETPIXEL(x+0, y, *(pTrans+(pixels>>6)));
if (!--xsize)
return;
WriteBit1:
SETPIXEL(x+1, y, *(pTrans+(3&(pixels>>4))));
if (!--xsize)
return;
WriteBit2:
SETPIXEL(x+2, y, *(pTrans+(3&(pixels>>2))));
if (!--xsize)
return;
WriteBit3:
SETPIXEL(x+3, y, *(pTrans+(3&(pixels))));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteBit0;
/*
Write with transparency
*/
WriteTBit0:
if (pixels&(3<<6))
SETPIXEL(x+0, y, *(pTrans+(pixels>>6)));
if (!--xsize)
return;
WriteTBit1:
if (pixels&(3<<4))
SETPIXEL(x+1, y, *(pTrans+(3&(pixels>>4))));
if (!--xsize)
return;
WriteTBit2:
if (pixels&(3<<2))
SETPIXEL(x+2, y, *(pTrans+(3&(pixels>>2))));
if (!--xsize)
return;
WriteTBit3:
if (pixels&(3<<0))
SETPIXEL(x+3, y, *(pTrans+(3&(pixels))));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteTBit0;
}
#endif
/*
*********************************************
* *
* Draw Bitmap 4 BPP *
* *
*********************************************
*/
#if (LCD_MAX_LOG_COLORS > 4)
static void DrawBitLine4BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX pixels;
/*
// Jump to right entry point
*/
pixels = *p;
if (GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) {
if ((Diff&1) ==0) {
goto WriteTBit0;
} else {
goto WriteTBit1;
}
} else {
if ((Diff&1) ==0) {
goto WriteBit0;
} else {
goto WriteBit1;
}
}
/*
Write without transparency
*/
WriteBit0:
SETPIXEL(x+0, y, *(pTrans+(pixels>>4)));
if (!--xsize)
return;
WriteBit1:
SETPIXEL(x+1, y, *(pTrans+(pixels&0xf)));
if (!--xsize)
return;
x+=2;
pixels = *(++p);
goto WriteBit0;
/*
Write with transparency
*/
WriteTBit0:
if (pixels>>4)
SETPIXEL(x+0, y, *(pTrans+(pixels>>4)));
if (!--xsize)
return;
WriteTBit1:
if (pixels&0xf)
SETPIXEL(x+1, y, *(pTrans+(pixels&0xf)));
if (!--xsize)
return;
x+=2;
pixels = *(++p);
goto WriteTBit0;
}
#endif
/*
*********************************************
* *
* Draw Bitmap 8 BPP (256 colors) *
* *
*********************************************
*/
#if (LCD_MAX_LOG_COLORS > 16)
static void DrawBitLine8BPP(int x, int y, U8 const*p, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX pixels;
do {
pixels = *p;
SETPIXEL(x+0, y, *(pTrans+pixels));
x++;
p++;
} while (--xsize);
}
#endif
/*
**********************************************************************
* *
* Universal draw Bitmap routine *
* *
**********************************************************************
*/
void LCD_L0_DrawBitmap (int x0, int y0,
int xsize, int ysize,
int BitsPerPixel,
int BytesPerLine,
const U8* pData, int Diff,
const LCD_PIXELINDEX* pTrans)
{
int i;
/* Use aID for bitmaps without palette */
if (!pTrans) {
pTrans = aID;
}
/* Use DrawBitLineXBPP */
for (i=0; i<ysize; i++) {
switch (BitsPerPixel) {
case 1:
DrawBitLine1BPP(x0, i+y0, pData, Diff, xsize, pTrans);
break;
#if (LCD_MAX_LOG_COLORS > 2)
case 2:
DrawBitLine2BPP(x0, i+y0, pData, Diff, xsize, pTrans);
break;
#endif
#if (LCD_MAX_LOG_COLORS > 4)
case 4:
DrawBitLine4BPP(x0, i+y0, pData, Diff, xsize, pTrans);
break;
#endif
case 8:
#if (LCD_MAX_LOG_COLORS > 16)
DrawBitLine8BPP(x0, i+y0, pData, xsize, pTrans);
#else
DEBUG_WARN("\nCan not display 8bpp bitmaps, please #define LCD_MAX_LOG_COLORS 256");
#endif
}
pData += BytesPerLine;
}
}
/*
*********************************************************
* *
* LCD_L0_SetOrg *
* *
*********************************************************
Purpose: Sets the original position of the virtual display.
Has no function at this point with the PC-driver.
*/
#if LCD_SUPPORT_SETORG
void LCD_L0_SetOrg(int x, int y) {
int Off;
if (y>(LCD_VYSIZE_PHYS-LCD_YSIZE_PHYS))
y = LCD_VYSIZE_PHYS-LCD_YSIZE_PHYS;
Off = y*LCD_BYTESPERLINE+(x>>3);
#if (LCD_BITSPERPIXEL == 3)
{
int i;
for (i=0; i<LCD_BITSPERPIXEL/3; i++) {
#ifndef WIN32
LCD__apVRam[i] = &LCD_VRam[i][0] +Off;
#endif
}
}
#elif (LCD_BITSPERPIXEL == 6)
#ifndef WIN32
LCD__apVRam[0] = &LCD_VRam_0[0] +Off;
LCD__apVRam[1] = &LCD_VRam_1[0] +Off;
#endif
#endif
}
#endif
/*
*********************************************************
* *
* Support for verification *
* *
*********************************************************
The following routines are implemented, but have no functionility
at this point. The reason is that these functions are supposed
to supervise the hardware, which for obvious reasons can not be
done in a simulation.
*/
#if LCD_VERIFY
int LCD_GetErrStat(void) {
return 0;
}
void LCD_ClrErrStat(void) {
}
int LCD_GetErrCnt (void) {
return 0;
}
#endif
/*
*********************************************************
* *
* LCD_On *
* LCD_Off *
* *
*********************************************************
These funtions are not implemented for this driver, they
have to be in the external modul which refreshes the LCD
regularily.
*/
#ifndef WIN32
void LCD_Off (void) {
#ifdef LCD_OFF
LCD_OFF();
#endif
}
#endif
#ifndef WIN32
void LCD_On (void) {
#ifdef LCD_ON
LCD_ON();
#endif
}
#endif
/*
*********************************************************
* *
* LCD_ReInit : Re-Init the display *
* *
*********************************************************
ReInit contains all of the code that can be re-executed at any point without
changing or even disturbing what can be seen on the LCD.
Note that it is also used as a subroutine by LCD_Init().
*/
void LCD_ReInit(void) {
}
/*
*********************************************************
* *
* LCD_Init : Init the display *
* *
*********************************************************
*/
int LCD_L0_Init(void) {
#ifdef WIN32
#if (LCD_BITSPERPIXEL == 3)
pVRam = GetpVRam(LCD_VYSIZE_PHYS*LCD_BYTESPERLINE);
#elif (LCD_BITSPERPIXEL == 6)
pVRam_0 = GetpVRam(LCD_VYSIZE_PHYS*LCD_BYTESPERLINE);
pVRam_1 = pVRam_0 + LCD_VYSIZE_PHYS * LCD_BYTESPERLINE;
#endif
#endif
LCD_Off();
LCD_ReInit();
LCD_L0_SetOrg(0,0);
/* Clear entire video RAM */
LCD_SetDrawMode(LCD_DRAWMODE_REV);
LCD_FillRect(0,0,4095,4095);
LCD_SetDrawMode(0);
LCD_On();
return 0;
}
/*
*********************************************************
* *
* LCD_L0_CheckInit *
* *
* Check if display controller(s) is/are still *
* properly initialized *
* *
*********************************************************
Return value: 0 => No error, init is O.K.
*/
int LCD_L0_CheckInit(void) {
return 0;
}
/*
*********************************************************
* *
* LCD_L0_SetLUTEntry *
* *
*********************************************************
*/
void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR color) {
LCD_USE_PARA(Pos);
LCD_USE_PARA(color);
}
#endif /*(LCD_CONTROLLER/100 == 0) */
void LCDMemC(void) { } /* avoid empty object files */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -