78,11 → 78,12 |
|
static unsigned int scr_width; |
static unsigned int scr_height; |
static char *scr_addr; |
static uint8_t *scr_addr; |
|
static unsigned int style; |
|
static unsigned attr_to_ega_style(const attrs_t *a); |
static uint8_t ega_glyph(wchar_t ch); |
|
static void clrscr(void) |
{ |
143,23 → 144,40 |
} |
} |
|
static void printchar(char c, unsigned int row, unsigned int col) |
static void printchar(wchar_t c, unsigned int row, unsigned int col) |
{ |
scr_addr[(row * scr_width + col) * 2] = c; |
scr_addr[(row * scr_width + col) * 2] = ega_glyph(c); |
scr_addr[(row * scr_width + col) * 2 + 1] = style; |
|
cursor_goto(row, col + 1); |
} |
|
static void draw_text_data(keyfield_t *data) |
/** Draw text data to viewport. |
* |
* @param vport Viewport id |
* @param data Text data. |
* @param x Leftmost column of the area. |
* @param y Topmost row of the area. |
* @param w Number of rows. |
* @param h Number of columns. |
*/ |
static void draw_text_data(keyfield_t *data, unsigned int x, |
unsigned int y, unsigned int w, unsigned int h) |
{ |
int i; |
unsigned int i, j; |
keyfield_t *field; |
uint8_t *dp; |
|
for (i = 0; i < scr_width * scr_height; i++) { |
scr_addr[i * 2] = data[i].character; |
scr_addr[i * 2 + 1] = attr_to_ega_style(&data[i].attrs); |
for (j = 0; j < h; j++) { |
for (i = 0; i < w; i++) { |
field = &data[j * w + i]; |
dp = &scr_addr[2 * ((y + j) * scr_width + (x + i))]; |
|
dp[0] = ega_glyph(field->character); |
dp[1] = attr_to_ega_style(&field->attrs); |
} |
} |
} |
|
static int save_screen(void) |
{ |
231,13 → 249,21 |
} |
} |
|
static uint8_t ega_glyph(wchar_t ch) |
{ |
if (ch >= 0 && ch < 128) |
return ch; |
|
return '?'; |
} |
|
static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
{ |
int retval; |
ipc_callid_t callid; |
ipc_call_t call; |
char c; |
unsigned int row, col; |
wchar_t c; |
unsigned int row, col, w, h; |
int bg_color, fg_color, attr; |
uint32_t bg_rgb, fg_rgb; |
keyfield_t *interbuf = NULL; |
270,11 → 296,19 |
retval = EINVAL; |
break; |
case FB_DRAW_TEXT_DATA: |
col = IPC_GET_ARG1(call); |
row = IPC_GET_ARG2(call); |
w = IPC_GET_ARG3(call); |
h = IPC_GET_ARG4(call); |
if (!interbuf) { |
retval = EINVAL; |
break; |
} |
draw_text_data(interbuf); |
if (col + w > scr_width || row + h > scr_height) { |
retval = EINVAL; |
break; |
} |
draw_text_data(interbuf, col, row, w, h); |
retval = 0; |
break; |
case FB_GET_CSIZE: |
359,7 → 393,7 |
break; |
|
default: |
retval = ENOENT; |
retval = EINVAL; |
} |
ipc_answer_0(callid, retval); |
} |