71 #if (!defined (LCD_LUT_COM) && !defined(LCD_LUT_SEG)) 72 #if (!LCD_MIRROR_X && !LCD_MIRROR_Y && !LCD_SWAP_XY) 73 #define LOG2PHYS_X(x, y) x 74 #define LOG2PHYS_Y(x, y) y 75 #elif (!LCD_MIRROR_X && !LCD_MIRROR_Y && LCD_SWAP_XY) 76 #define LOG2PHYS_X(x, y) y 77 #define LOG2PHYS_Y(x, y) x 78 #elif (!LCD_MIRROR_X && LCD_MIRROR_Y && !LCD_SWAP_XY) 79 #define LOG2PHYS_X(x, y) x 80 #define LOG2PHYS_Y(x, y) LCD_YSIZE - 1 - (y) 81 #elif (!LCD_MIRROR_X && LCD_MIRROR_Y && LCD_SWAP_XY) 82 #define LOG2PHYS_X(x, y) y 83 #define LOG2PHYS_Y(x, y) LCD_XSIZE - 1 - (x) 84 #elif ( LCD_MIRROR_X && !LCD_MIRROR_Y && !LCD_SWAP_XY) 85 #define LOG2PHYS_X(x, y) LCD_XSIZE - 1 - (x) 86 #define LOG2PHYS_Y(x, y) y 87 #elif ( LCD_MIRROR_X && !LCD_MIRROR_Y && LCD_SWAP_XY) 88 #define LOG2PHYS_X(x, y) LCD_YSIZE - 1 - (y) 89 #define LOG2PHYS_Y(x, y) x 90 #elif ( LCD_MIRROR_X && LCD_MIRROR_Y && !LCD_SWAP_XY) 91 #define LOG2PHYS_X(x, y) LCD_XSIZE - 1 - (x) 92 #define LOG2PHYS_Y(x, y) LCD_YSIZE - 1 - (y) 93 #elif ( LCD_MIRROR_X && LCD_MIRROR_Y && LCD_SWAP_XY) 94 #define LOG2PHYS_X(x, y) LCD_YSIZE - 1 - (y) 95 #define LOG2PHYS_Y(x, y) LCD_XSIZE - 1 - (x) 98 #if ( defined (LCD_LUT_COM) && !defined(LCD_LUT_SEG)) 99 #define LOG2PHYS_X(x, y) x 100 #define LOG2PHYS_Y(x, y) LCD__aLine2Com0[y] 101 #elif (!defined (LCD_LUT_COM) && defined(LCD_LUT_SEG)) 102 #define LOG2PHYS_X(x, y) LCD__aCol2Seg0[x] 103 #define LOG2PHYS_Y(x, y) y 104 #elif ( defined (LCD_LUT_COM) && defined(LCD_LUT_SEG)) 105 #define LOG2PHYS_X(x, y) LCD__aCol2Seg0[x] 106 #define LOG2PHYS_Y(x, y) LCD__aLine2Com0[y] 139 static void _SetPixelIndex(
GUI_DEVICE * pDevice,
int x,
int y,
int PixelIndex) {
143 #if (LCD_MIRROR_X == 1) || (LCD_MIRROR_Y == 1) || (LCD_SWAP_XY == 1) 163 #if (LCD_MIRROR_X == 0) && (LCD_MIRROR_Y == 0) && (LCD_SWAP_XY == 0) 178 static unsigned int _GetPixelIndex(
GUI_DEVICE * pDevice,
int x,
int y) {
179 unsigned int PixelIndex;
183 #if (LCD_MIRROR_X == 1) || (LCD_MIRROR_Y == 1) || (LCD_SWAP_XY == 1) 203 #if (LCD_MIRROR_X == 0) && (LCD_MIRROR_Y == 0) && (LCD_SWAP_XY == 0) 214 static void _XorPixel(
GUI_DEVICE * pDevice,
int x,
int y) {
218 PixelIndex = _GetPixelIndex(pDevice, x, y);
220 _SetPixelIndex(pDevice, x, y, PixelIndex ^ IndexMask);
227 static void _FillRect(
GUI_DEVICE * pDevice,
int x0,
int y0,
int x1,
int y1) {
233 for (; y0 <= y1; y0++) {
234 for (x = x0; x <= x1; x++) {
235 _XorPixel(pDevice, x, y0);
239 for (; y0 <= y1; y0++) {
240 for (x = x0; x <= x1; x++) {
241 _SetPixelIndex(pDevice, x, y0, PixelIndex);
251 static void _DrawHLine(
GUI_DEVICE * pDevice,
int x0,
int y,
int x1) {
252 _FillRect(pDevice, x0, y, x1, y);
259 static void _DrawVLine(
GUI_DEVICE * pDevice,
int x,
int y0,
int y1) {
260 _FillRect(pDevice, x, y0, x, y1);
270 Index0 = *(pTrans + 0);
271 Index1 = *(pTrans + 1);
276 _SetPixelIndex(pDevice, x++, y, (*p & (0x80 >> Diff)) ? Index1 : Index0);
285 if (*p & (0x80 >> Diff))
286 _SetPixelIndex(pDevice, x, y, Index1);
298 if (*p & (0x80 >> Diff)) {
299 Pixel = _GetPixelIndex(pDevice, x, y);
300 _SetPixelIndex(pDevice, x, y, Pixel ^ IndexMask);
318 int CurrentPixel, Shift, Index;
327 Shift = (3 - CurrentPixel) << 1;
328 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
329 PixelIndex = *(pTrans + Index);
330 _SetPixelIndex(pDevice, x++, y, PixelIndex);
331 if (++CurrentPixel == 4) {
338 Shift = (3 - CurrentPixel) << 1;
339 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
340 _SetPixelIndex(pDevice, x++, y, Index);
341 if (++CurrentPixel == 4) {
351 Shift = (3 - CurrentPixel) << 1;
352 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
354 PixelIndex = *(pTrans + Index);
355 _SetPixelIndex(pDevice, x, y, PixelIndex);
358 if (++CurrentPixel == 4) {
365 Shift = (3 - CurrentPixel) << 1;
366 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
368 _SetPixelIndex(pDevice, x, y, Index);
371 if (++CurrentPixel == 4) {
387 int CurrentPixel, Shift, Index;
396 Shift = (1 - CurrentPixel) << 2;
397 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
398 PixelIndex = *(pTrans + Index);
399 _SetPixelIndex(pDevice, x++, y, PixelIndex);
400 if (++CurrentPixel == 2) {
407 Shift = (1 - CurrentPixel) << 2;
408 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
409 _SetPixelIndex(pDevice, x++, y, Index);
410 if (++CurrentPixel == 2) {
420 Shift = (1 - CurrentPixel) << 2;
421 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
423 PixelIndex = *(pTrans + Index);
424 _SetPixelIndex(pDevice, x, y, PixelIndex);
427 if (++CurrentPixel == 2) {
434 Shift = (1 - CurrentPixel) << 2;
435 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
437 _SetPixelIndex(pDevice, x, y, Index);
440 if (++CurrentPixel == 2) {
460 for (; xsize > 0; xsize--, x++, p++) {
462 _SetPixelIndex(pDevice, x, y, *(pTrans + Pixel));
465 for (; xsize > 0; xsize--, x++, p++) {
466 _SetPixelIndex(pDevice, x, y, *p);
472 for (; xsize > 0; xsize--, x++, p++) {
475 _SetPixelIndex(pDevice, x, y, *(pTrans + Pixel));
479 for (; xsize > 0; xsize--, x++, p++) {
482 _SetPixelIndex(pDevice, x, y, Pixel);
499 for (;xsize > 0; xsize--, x++, p++) {
500 _SetPixelIndex(pDevice, x, y, *p);
513 for (;xsize > 0; xsize--, x++, p++) {
514 _SetPixelIndex(pDevice, x, y, *p);
522 static void _DrawBitmap(
GUI_DEVICE * pDevice,
int x0,
int y0,
523 int xSize,
int ySize,
530 switch (BitsPerPixel) {
532 for (i = 0; i < ySize; i++) {
533 _DrawBitLine1BPP(pDevice, x0, i + y0, pData, Diff, xSize, pTrans);
534 pData += BytesPerLine;
538 for (i = 0; i < ySize; i++) {
539 _DrawBitLine2BPP(pDevice, x0, i + y0, pData, Diff, xSize, pTrans);
540 pData += BytesPerLine;
544 for (i = 0; i < ySize; i++) {
545 _DrawBitLine4BPP(pDevice, x0, i + y0, pData, Diff, xSize, pTrans);
546 pData += BytesPerLine;
550 for (i = 0; i < ySize; i++) {
551 _DrawBitLine8BPP(pDevice, x0, i + y0, pData, xSize, pTrans);
552 pData += BytesPerLine;
559 for (i = 0; i < ySize; i++) {
560 _DrawBitLine16BPP(pDevice, x0, i + y0, (
const U16 *)pData, xSize);
561 pData += BytesPerLine;
568 for (i = 0; i < ySize; i++) {
569 _DrawBitLine32BPP(pDevice, x0, i + y0, (
const U32 *)pData, xSize);
570 pData += BytesPerLine;
607 return pContext->
xSize;
609 return pContext->
ySize;
636 static void * _GetDevData(
GUI_DEVICE * pDevice,
int Index) {
638 #if GUI_SUPPORT_MEMDEV 667 static void _SetOrg(
GUI_DEVICE * pDevice,
int x,
int y) {
685 static void _SetVRAMAddr(
GUI_DEVICE * pDevice,
void * pVRAM) {
702 static void _SetVSize(
GUI_DEVICE * pDevice,
int xSize,
int ySize) {
718 static void _SetSize(
GUI_DEVICE * pDevice,
int xSize,
int ySize) {
726 pContext->
xSize = xSize;
727 pContext->
ySize = ySize;
740 r = _InitOnce(pDevice);
777 static void (* _GetDevFunc(
GUI_DEVICE ** ppDevice,
int Index))(void) {
781 return (
void (*)(
void))_SetVRAMAddr;
783 return (
void (*)(
void))_SetVSize;
785 return (
void (*)(
void))_SetSize;
787 return (
void (*)(
void))_Init;
789 return (
void (*)(
void))_On;
791 return (
void (*)(
void))_Off;
793 return (
void (*)(
void))_SetLUTEntry;
GUI_SADDR GUI_CONTEXT * GUI_pContext
#define LCD__GetColorIndex()
#define LCD_DEVCAP_MIRROR_Y
tLCDDEV_GetIndexMask * pfGetIndexMask
#define LCD_DEVDATA_MEMDEV
const GUI_DEVICE_API GUI_MEMDEV_DEVICE_16
#define LCD_DEVCAP_NUMCOLORS
#define GUI_USE_PARA(para)
#define LCD_DEVFUNC_SET_SIZE
#define LCD_DEVCAP_BITSPERPIXEL
#define LCD_DEVCAP_VYSIZE
const GUI_DEVICE_API GUIDRV_Template_API
I32 LCD__GetBPP(U32 IndexMask)
#define LCD_DEVFUNC_SETLUTENTRY
#define LCD_DEVFUNC_SET_VSIZE
#define LCD_X_INITCONTROLLER
#define LCD_DEVCAP_VXSIZE
#define LCD_DEVCAP_SWAP_XY
#define LCD_DRAWMODE_TRANS
const LCD_API_COLOR_CONV * pColorConvAPI
#define LCD_X_SETVRAMADDR
#define LCD_DEVFUNC_SET_VRAM_ADDR
void * GUI_ALLOC_GetFixedBlock(GUI_ALLOC_DATATYPE Size)
#define LCD_DEVCAP_MIRROR_X
#define LCD_X_SETLUTENTRY
int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void *pData)
This function is called by the display driver for several purposes. To support the according task the...