📄 lcdrle8.lst
字号:
C51 COMPILER V8.05a LCDRLE8 04/11/2008 14:19:06 PAGE 1
C51 COMPILER V8.05a, COMPILATION OF MODULE LCDRLE8
OBJECT MODULE PLACED IN LCDRLE8.obj
COMPILER INVOKED BY: D:\Program Files\keil\C51\BIN\C51.EXE gui\Core\LCDRLE8.c LARGE BROWSE MDU_F120 DEBUG OBJECTEXTEND P
-RINT(.\LCDRLE8.lst) OBJECT(LCDRLE8.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 : LCDRLE8.c
16 Purpose : Drawing routines for run length encoded bitmaps
17 with 8 bpp
18 ---------------------------END-OF-HEADER------------------------------
19 */
20
21 #include <stddef.h> /* needed for definition of NULL */
22 #include "gui\Core\GUI_Private.h"
23 #include "gui\Core\LCD_Private.h"
24
25 static struct {
26 int x,y;
27 const U8* pPixel;
28 const U8* pPixelStart;
29 } Cache;
30
31 void LCD_DrawBitmap_RLE8 (int x0,int y0,int xsize, int ysize, const U8*pPixel, const LCD_LOGPALETTE* pLogP
-al, int xMag, int yMag) {
32 1 LCD_PIXELINDEX aColorIndex[2];
33 1 LCD_PIXELINDEX PixelIndex;
34 1 int xi,y;
35 1 int xL, yL;
36 1 const U8* pPixelOrg = pPixel;
37 1 char NoTrans = !(GUI_Context.DrawMode & LCD_DRAWMODE_TRANS);
38 1 const LCD_PIXELINDEX* pTrans =NULL;
39 1 char IsMagnified = ((yMag | xMag) != 1);
40 1 aColorIndex[0] = LCD_ACOLORINDEX[0];
41 1 aColorIndex[1] = LCD_ACOLORINDEX[1];
42 1 /* Handle color translation */
43 1 if ((pLogPal) && (pLogPal->pPalEntries)) {
44 2 if ((pTrans = LCD_GetpPalConvTable(pLogPal)) == NULL) {
45 3 return;
46 3 }
47 2 }
48 1 /* Check if we can limit the number of lines due to clipping) */
49 1 if (yMag == 1) {
50 2 if (ysize > GUI_Context.ClipRect.y1 - y0 + 1)
51 2 ysize = GUI_Context.ClipRect.y1 - y0 + 1;
52 2 }
53 1 /* Init variables for looping */
C51 COMPILER V8.05a LCDRLE8 04/11/2008 14:19:06 PAGE 2
54 1 xi=0;
55 1 y =0;
56 1 /* Check if we can use the cache to save some unnecessary iterations */
57 1 if (!IsMagnified) {
58 2 int yDiff = GUI_Context.ClipRect.y0 - y0;
59 2 if ((Cache.pPixelStart == pPixel) && (yDiff > Cache.y)) {
60 3 /* Accept cache values */
61 3 y = Cache.y;
62 3 xi = Cache.x;
63 3 pPixel = Cache.pPixel;
64 3 }
65 2 }
66 1 /* Init values for caching */
67 1 Cache.pPixel = Cache.pPixelStart = pPixelOrg;
68 1 Cache.x = Cache.y = 0;
69 1 /* Repeat until we have reached bottom */
70 1 for (; y < ysize; ) {
71 2 U8 Cmd = *pPixel++;
72 2 U8 Data = *pPixel++;
73 2 if (Cmd) {
74 3 /* Save cache info */
75 3 Cache.pPixel = pPixel-2;
76 3 Cache.x = xi;
77 3 Cache.y = y;
78 3 LCD_ACOLORINDEX[1] = pTrans ? *(pTrans+Data) : Data;
79 3 while (Cmd) {
80 4 int xi1 = xi+Cmd;
81 4 if (xi1>=xsize)
82 4 xi1 = xsize;
83 4 Cmd -= (xi1-xi);
84 4 if (Data || NoTrans) { /* Skip transparent pixels */
85 5 if (IsMagnified) {
86 6 xL = xMag * xi + x0;
87 6 yL = yMag * y + y0;
88 6 LCD_FillRect(xL, yL, xL + xMag * (xi1 - xi) -1 , yL + yMag - 1);
89 6 } else {
90 6 LCD_DrawHLine(x0+xi, y + y0, xi1+x0-1);
91 6 }
92 5 }
93 4 xi =xi1;
94 4 if (xi1==xsize) {
95 5 y++;
96 5 xi=0;
97 5 }
98 4 }
99 3 } else {
100 3 do {
101 4 U8 Index = *pPixel++;
102 4 if (Index || NoTrans) { /* Skip transparent pixels */
103 5 int x = x0+xi;
104 5 PixelIndex = pTrans ? *(pTrans+Index) : Index;
105 5 if (IsMagnified) {
106 6 LCD_SetColorIndex(PixelIndex);
107 6 xL = xMag * xi + x0;
108 6 yL = yMag * y + y0;
109 6 LCD_FillRect(xL, yL, xL + xMag -1 , yL + yMag - 1);
110 6 } else {
111 6 #if 1 /* High speed variant */
112 6 if (y + y0>= GUI_Context.ClipRect.y0)
113 6 if (x >= GUI_Context.ClipRect.x0)
114 6 if (x <= GUI_Context.ClipRect.x1)
115 6 LCDDEV_L0_SetPixelIndex(x, y + y0, PixelIndex);
C51 COMPILER V8.05a LCDRLE8 04/11/2008 14:19:06 PAGE 3
116 6 #else
LCD_SetPixelIndex(x, y + y0, PixelIndex);
#endif
119 6 }
120 5 }
121 4 if (++xi >= xsize) {
122 5 xi=0; y++;
123 5 if (y >= ysize)
124 5 break;
125 5 }
126 4 } while (--Data);
127 3 }
128 2 }
129 1 LCD_ACOLORINDEX[0] = aColorIndex[0];
130 1 LCD_ACOLORINDEX[1] = aColorIndex[1];
131 1 }
132
133
134
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1530 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 10 42
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -