From 854718a302d46a588bd2aa1a62664569b6f41553 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Thu, 4 Nov 2021 03:21:06 +0300 Subject: tbi/win: make wrefresh() --- lib/tbi/win.c | 36 ++++++++++++++++++++++++++++++++++++ lib/tbi/win.h | 9 +++++++++ 2 files changed, 45 insertions(+) (limited to 'lib') diff --git a/lib/tbi/win.c b/lib/tbi/win.c index 172f9a9..7e3b413 100644 --- a/lib/tbi/win.c +++ b/lib/tbi/win.c @@ -252,3 +252,39 @@ UINTN EFIAPI wvprintf(struct window *w, CONST CHAR16 *fmt, VA_LIST args) return length; } +VOID wrefresh(struct window *w) +{ + UINTN x, y; + INT32 attributes; + CHAR16 tmp_ch, *print_ptr; + EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *stdout; + + ASSERT(w != NULL); + + attributes = w->attr[0][0]; + stdout = w->scr->stdout; + stdout->SetAttribute(stdout, attributes); + + for(y = 0; y < w->height; y++) { + stdout->SetCursorPosition(stdout, w->begx, w->begy + y); + print_ptr = w->text[y]; + + for(x = 0; x <= (w->width); x++) { + if(w->text[y][x] == CHAR_NULL || attributes != w->attr[y][x]) + { + tmp_ch = w->text[y][x]; + w->text[y][x] = CHAR_NULL; + stdout->OutputString(stdout, print_ptr); + w->text[y][x] = tmp_ch; + + print_ptr = &(w->text[y][x]); + if(w->text[y][x] != CHAR_NULL) { + attributes = w->attr[y][x]; + stdout->SetAttribute(stdout, attributes); + } + } + } + } + + stdout->SetAttribute(stdout, w->scr->attr); +} diff --git a/lib/tbi/win.h b/lib/tbi/win.h index 3c42538..76be2d8 100644 --- a/lib/tbi/win.h +++ b/lib/tbi/win.h @@ -174,4 +174,13 @@ UINTN EFIAPI mvwprintf(struct window *w, INT32 x, INT32 y, CONST CHAR16 *fmt, .. */ UINTN EFIAPI wvprintf(struct window *w, CONST CHAR16 *fmt, VA_LIST args); +/* + * Does the output of window to the terminal + * + * w: the window on which to operate + * + * return: VOID +*/ +VOID wrefresh(struct window *w); + #endif /* UFM_TBI_WINDOW_H */ -- cgit v1.2.3-18-g5258