📄 guidev.lst
字号:
C51 COMPILER V8.05a GUIDEV 04/11/2008 14:19:26 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE GUIDEV
OBJECT MODULE PLACED IN GUIDEV.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\MemDev\GUIDEV.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXTEND
-PRINT(.\GUIDEV.lst) OBJECT(GUIDEV.obj)
line level source
1 /*
2 *********************************************************************************************************
3 * uC/GUI
4 * Universal graphic software for embedded applications
5 *
6 * (c) Copyright 2002, Micrium Inc., Weston, FL
7 * (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
8 *
9 * 礐/GUI is protected by international copyright laws. Knowledge of the
10 * source code may not be used to write a similar product. This file may
11 * only be used in accordance with a license and should not be redistributed
12 * in any way. We appreciate your understanding and fairness.
13 *
14 ----------------------------------------------------------------------
15 File : GUIDev.C
16 Purpose : Implementation of memory devices
17 ---------------------------END-OF-HEADER------------------------------
18 */
19
20
21 #include <string.h>
22 #include "gui\Core\GUI_Private.h"
23 #include "gui\Core\GUIDebug.h"
24
25 /* Memory device capabilities are compiled only if support for them is enabled.*/
26 #if GUI_SUPPORT_MEMDEV
/*
*********************************************************
* *
* Macros *
* *
*********************************************************
*/
#define POS_AUTO -4095 /* Position value for auto-pos */
/*
********************************************************************
*
* ID translation table
*
********************************************************************
This table contains 0, 1, 2, ... and serves as translation table for DDBs
*/
#define INTS(Base) Base+0,Base+1,Base+2,Base+3,Base+4,Base+5, \
Base+6,Base+7,Base+8,Base+9,Base+10,Base+11, \
Base+12,Base+13,Base+14,Base+15
static const LCD_PIXELINDEX aID[] = {
C51 COMPILER V8.05a GUIDEV 04/11/2008 14:19:26 PAGE 2
INTS(0)
};
/*
*********************************************************
* *
* internal routines *
* *
* (not part of interface table) *
* *
*********************************************************
*/
LCD_PIXELINDEX* GUI_MEMDEV_XY2PTR(int x,int y) {
GUI_MEMDEV* pDev = GUI_MEMDEV_h2p(GUI_Context.hDevData);
U8 *pData = (U8*)(pDev+1);
#if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_ALL
if ((x >= pDev->x0+pDev->XSize) | (x<pDev->x0) | (y >= pDev->y0+pDev->YSize) | (y<pDev->y0)) {
GUI_DEBUG_ERROROUT2("GUI_MEMDEV_XY2PTR: parameters out of bounds",x,y);
}
#endif
pData += (y- pDev->y0) * pDev->BytesPerLine;
return ((LCD_PIXELINDEX*)pData) + x - pDev->x0;
}
/*
*********************************************************
* *
* Draw Bitmap 1 BPP *
* *
*********************************************************
*/
static void DrawBitLine1BPP(GUI_USAGE* pUsage, int x, int y, U8 const*p, int Diff, int xsize, const LCD_P
-IXELINDEX*pTrans) {
LCD_PIXELINDEX pixels;
LCD_PIXELINDEX Index0 = *(pTrans+0);
LCD_PIXELINDEX Index1 = *(pTrans+1);
LCD_PIXELINDEX* pData;
U8 PixelCnt;
GUI_MEMDEV* pDev = GUI_MEMDEV_h2p(GUI_Context.hDevData);
PixelCnt = 8- (Diff&7);
pixels = (*p) << (Diff&7);
pData = GUI_MEMDEV_XY2PTR(x,y);
GUI_DEBUG_ERROROUT3_IF( x < pDev->x0, "GUIDEV.c: DrawBitLine1BPP, Act= %d, Border= %d, Clip= %d"
,x,pDev->x0, GUI_Context.ClipRect.x0);
switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
case 0: /* Write mode */
PixelLoopWrite:
if (PixelCnt>xsize)
PixelCnt =xsize;
xsize -= PixelCnt;
do {
*pData++ = (pixels&0x80) ? Index1 : Index0;
pixels<<=1;
} while (--PixelCnt);
if (xsize) {
PixelCnt=8;
C51 COMPILER V8.05a GUIDEV 04/11/2008 14:19:26 PAGE 3
pixels = *(++p);
goto PixelLoopWrite;
}
break;
case LCD_DRAWMODE_TRANS:
PixelLoopTrans:
if (PixelCnt>xsize)
PixelCnt =xsize;
xsize -= PixelCnt;
do {
if ((pixels&0x80)) {
if (pUsage)
GUI_USAGE_AddPixel(pUsage, x,y);
*pData = Index1;
}
x++;
pData++;
pixels<<=1;
} while (--PixelCnt);
if (xsize) {
PixelCnt=8;
pixels = *(++p);
goto PixelLoopTrans;
}
break;
case LCD_DRAWMODE_XOR:;
PixelLoopXor:
if (PixelCnt>xsize)
PixelCnt =xsize;
xsize -= PixelCnt;
do {
if ((pixels&0x80))
*pData = pDev->NumColors - 1 - *pData;
pData++;
pixels<<=1;
} while (--PixelCnt);
if (xsize) {
PixelCnt=8;
pixels = *(++p);
goto PixelLoopXor;
}
break;
}
}
/*
*********************************************************
* *
* Draw Bitmap 2 BPP *
* *
*********************************************************
*/
static void DrawBitLine2BPP(GUI_USAGE* pUsage, int x, int y, U8 const*p, int Diff, int xsize, const LCD_P
-IXELINDEX*pTrans) {
U8 pixels;
U8 PixelCnt;
LCD_PIXELINDEX* pData;
PixelCnt = 4- (Diff&3);
pixels = (*p) << ((Diff&3)<<1);
pData = GUI_MEMDEV_XY2PTR(x,y);
switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
C51 COMPILER V8.05a GUIDEV 04/11/2008 14:19:26 PAGE 4
case 0: /* Write mode */
PixelLoopWrite:
if (PixelCnt>xsize) {
PixelCnt =xsize;
}
xsize -= PixelCnt;
do {
*pData++ = *(pTrans + (pixels>>6));
pixels<<=2;
} while (--PixelCnt);
if (xsize) {
PixelCnt=4;
pixels = *(++p);
goto PixelLoopWrite;
}
break;
case LCD_DRAWMODE_TRANS:
PixelLoopTrans:
if (PixelCnt>xsize)
PixelCnt =xsize;
xsize -= PixelCnt;
do {
if (pixels&0xc0) {
*pData = *(pTrans + (pixels>>6));
GUI_USAGE_AddPixel(pUsage, x,y);
}
pData++;
pixels<<=2;
} while (--PixelCnt);
if (xsize) {
PixelCnt=4;
pixels = *(++p);
goto PixelLoopTrans;
}
break;
case LCD_DRAWMODE_XOR:;
PixelLoopXor:
if (PixelCnt>xsize)
PixelCnt =xsize;
xsize -= PixelCnt;
do {
if ((pixels&0xc0))
*pData ^= 255;
pData++;
pixels<<=2;
} while (--PixelCnt);
if (xsize) {
PixelCnt=4;
pixels = *(++p);
goto PixelLoopXor;
}
break;
}
}
/*
*********************************************************
* *
* Draw Bitmap 4 BPP *
* *
*********************************************************
*/
C51 COMPILER V8.05a GUIDEV 04/11/2008 14:19:26 PAGE 5
static void DrawBitLine4BPP(GUI_USAGE* pUsage, int x, int y, U8 const*p, int Diff, int xsize, const LCD_P
-IXELINDEX*pTrans) {
U8 pixels;
LCD_PIXELINDEX* pData;
U8 PixelCnt;
PixelCnt = 2- (Diff&1);
pixels = (*p) << ((Diff&1)<<2);
pData = GUI_MEMDEV_XY2PTR(x,y);
switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
/*
* Write mode *
*/
case 0:
/* Draw incomplete bytes to the left of center area */
if (Diff) {
*pData = *(pTrans + (pixels >>4));
pData++;
xsize--;
pixels = *++p;
}
/* Draw center area (2 pixels in one byte) */
if (xsize >= 2) {
int i = xsize>>1;
xsize &= 1;
do {
*pData = *(pTrans + (pixels>>4)); /* Draw 1. (left) pixel */
*(pData+1) = *(pTrans + (pixels&15)); /* Draw 2. (right) pixel */
pData +=2;
pixels = *++p;
} while (--i);
}
/* Draw incomplete bytes to the right of center area */
if (xsize) {
*pData = * (pTrans + (pixels >> 4));
}
break;
/*
* Transparent draw mode *
*/
case LCD_DRAWMODE_TRANS:
/* Draw incomplete bytes to the left of center area */
if (Diff) {
if (pixels&0xF0) {
*pData = *(pTrans + (pixels>>4));
if (pUsage)
GUI_USAGE_AddPixel(pUsage, x,y);
}
pData++;
x++;
xsize--;
pixels = *++p;
}
/* Draw center area (2 pixels in one byte) */
while (xsize >= 2) {
/* Draw 1. (left) pixel */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -