1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
65
66
67
68
69
70
71
72
73
74
75
76
82
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
114
115
116
117
118
119
120
121
122
123
124
130
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
155
156
157
158
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
178
181
184
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
213
/* ... */
/* ... */
#include <stdlib.h>
#include "GUIDEMO.h"
#if (SHOW_GUIDEMO_SPEED)
/* ... */
static const GUI_COLOR _aColor[8] = {
0x000000,
0x0000FF,
0x00FF00,
0x00FFFF,
0xFF0000,
0xFF00FF,
0xFFFF00,
0xFFFFFF
...};
/* ... */
/* ... */
static U32 _GetPixelsPerSecond(void) {
GUI_COLOR Color, BkColor;
U32 x0, y0, x1, y1, xSize, ySize;
I32 t, t0;
U32 Cnt, PixelsPerSecond, PixelCnt;
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
Cnt = 0;
x0 = 0;
x1 = xSize - 1;
y0 = 65;
y1 = ySize - 60 - 1;
Color = GUI_GetColor();
BkColor = GUI_GetBkColor();
GUI_SetColor(BkColor);
t0 = GUIDEMO_GetTime();
do {
GUI_FillRect(x0, y0, x1, y1);
Cnt++;
t = GUIDEMO_GetTime();
...} while ((t - (t0 + 100)) <= 0);
t -= t0;
PixelCnt = (x1 - x0 + 1) * (y1 - y0 + 1) * Cnt;
PixelsPerSecond = PixelCnt / t * 1000;
GUI_SetColor(Color);
return PixelsPerSecond;
}{ ... }
/* ... */
/* ... */
void GUIDEMO_Speed(void) {
int TimeStart, i;
U32 PixelsPerSecond;
unsigned aColorIndex[8];
int xSize, ySize, vySize;
GUI_RECT Rect, ClipRect;
char cText[40] = { 0 };
xSize = LCD_GetXSize();
ySize = LCD_GetYSize();
vySize = LCD_GetVYSize();
#if GUI_SUPPORT_CURSOR
GUI_CURSOR_Hide();
#endif
if (vySize > ySize) {
ClipRect.x0 = 0;
ClipRect.y0 = 0;
ClipRect.x1 = xSize;
ClipRect.y1 = ySize;
GUI_SetClipRect(&ClipRect);
}if (vySize > ySize) { ... }
GUIDEMO_ShowIntro("High speed",
"Multi layer clipping\n"
"Highly optimized drivers");
for (i = 0; i< 8; i++) {
aColorIndex[i] = GUI_Color2Index(_aColor[i]);
}for (i = 0; i< 8; i++) { ... }
TimeStart = GUIDEMO_GetTime();
for (i = 0; ((GUIDEMO_GetTime() - TimeStart) < 5000) && (GUIDEMO_CheckCancel() == 0); i++) {
GUI_SetColorIndex(aColorIndex[i&7]);
Rect.x0 = rand() % xSize - xSize / 2;
Rect.y0 = rand() % ySize - ySize / 2;
Rect.x1 = Rect.x0 + 20 + rand() % xSize;
Rect.y1 = Rect.y0 + 20 + rand() % ySize;
GUI_FillRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1);
if (Rect.x1 >= xSize) {
Rect.x1 = xSize - 1;
}if (Rect.x1 >= xSize) { ... }
if (Rect.y1 >= ySize) {
Rect.y1 = ySize - 1;
}if (Rect.y1 >= ySize) { ... }
if (Rect.x0 < 0 ) {
Rect.x0 = 0;
}if (Rect.x0 < 0) { ... }
if (Rect.y1 < 0) {
Rect.y1 = 0;
}if (Rect.y1 < 0) { ... }
GUI_Exec();
}for (i = 0; ((GUIDEMO_GetTime() - TimeStart) < 5000) && (GUIDEMO_CheckCancel() == 0); i++) { ... }
GUIDEMO_NotifyStartNext();
PixelsPerSecond = _GetPixelsPerSecond();
GUI_SetClipRect(NULL);
GUIDEMO_DrawBk(0);
GUI_SetColor(GUI_WHITE);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetFont(&GUI_FontRounded22);
GUI_DrawBitmap(&bmSTLogo70x35, 5, 5);
GUIDEMO_AddStringToString(cText, "Pixels/sec: ");
GUIDEMO_AddIntToString(cText, PixelsPerSecond);
GUI_DispStringHCenterAt(cText, xSize >> 1, (ySize - GUI_GetFontSizeY()) >> 1);
GUIDEMO_Delay(4000);
#if GUI_SUPPORT_CURSOR
GUI_CURSOR_Show();
#endif
}{ ... }
/* ... */#else
void GUIDEMO_Speed(void) {}
/* ... */
#endif