-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrograss.c
53 lines (52 loc) · 1.17 KB
/
Prograss.c
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
#include "Setup.h"
#include <Prograss.h>
#include <Video.h>
//画进度条
EFI_PHYSICAL_ADDRESS PrograssInit(
prograss_t *p,
EFI_GRAPHICS_OUTPUT_PROTOCOL *graph,
UINTN X,
UINTN Y,
UINTN width,
UINTN height,
UINTN max,
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *bgColor
)
{
p->graph = graph;
p->height = height;
p->width = width;
//剧中计算
p->x = X;
p->y = Y;
p->flag = 0;
p->current = 0;
p->max = max;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL white = {255, 255, 255, 0};
p->color = white;
p->bgColor = *bgColor;
return EFI_SUCCESS;
}
EFI_STATUS PrograssIncrement(prograss_t *p)
{
// 画进度条
if(p->current==p->max){
p->current=0;
p->flag =!p->flag;
}
p->current++;
EFI_STATUS status = EFI_SUCCESS;
UINTN X = p->x + p->width * p->current;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL color;
if ((p->current+p->flag) % 2 == 0)
{
color=p->bgColor;
}
else
{
color=p->color;
}
//还没写完就被下一个给写完了
status = FillColorToVideo(p->graph, &color, X, p->y, p->width, p->height);
return CHECK_ERROR_BEFORELOG(status, L"Prograss load ...");
}