/branches/dd/uspace/srv/fb/serial_console.c |
---|
223,26 → 223,48 |
} |
} |
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, j; |
unsigned int i, j; |
keyfield_t *field; |
attrs_t *a0, *a1; |
serial_goto(0, 0); |
serial_goto(y, x); |
a0 = &data[0].attrs; |
serial_set_attrs(a0); |
for (i = 0; i < scr_height; i++) { |
for (j = 0; j < scr_width; j++) { |
a1 = &data[i * scr_width + j].attrs; |
for (j = 0; j < h; j++) { |
if (j > 0 && w != scr_width) |
serial_goto(y, x); |
for (i = 0; i < w; i++) { |
unsigned int col = x + i; |
unsigned int row = y + j; |
field = &data[j * w + i]; |
a1 = &field->attrs; |
if (!attrs_same(*a0, *a1)) |
serial_set_attrs(a1); |
(*putc_function)(data[i * scr_width + j].character); |
(*putc_function)(field->character); |
a0 = a1; |
} |
} |
} |
int lastcol = 0; |
int lastrow = 0; |
/** |
* Main function of the thread serving client connections. |
*/ |
255,10 → 277,7 |
size_t intersize = 0; |
char c; |
int lastcol = 0; |
int lastrow = 0; |
int newcol; |
int newrow; |
int col, row, w, h; |
int fgcolor; |
int bgcolor; |
int flags; |
299,30 → 318,40 |
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); |
lastrow = row + h - 1; |
lastcol = col + w; |
retval = 0; |
break; |
case FB_PUTCHAR: |
c = IPC_GET_ARG1(call); |
newrow = IPC_GET_ARG2(call); |
newcol = IPC_GET_ARG3(call); |
if ((lastcol != newcol) || (lastrow != newrow)) |
serial_goto(newrow, newcol); |
lastcol = newcol + 1; |
lastrow = newrow; |
row = IPC_GET_ARG2(call); |
col = IPC_GET_ARG3(call); |
if ((lastcol != col) || (lastrow != row)) |
serial_goto(row, col); |
lastcol = col + 1; |
lastrow = row; |
(*putc_function)(c); |
retval = 0; |
break; |
case FB_CURSOR_GOTO: |
newrow = IPC_GET_ARG1(call); |
newcol = IPC_GET_ARG2(call); |
serial_goto(newrow, newcol); |
lastrow = newrow; |
lastcol = newcol; |
row = IPC_GET_ARG1(call); |
col = IPC_GET_ARG2(call); |
serial_goto(row, col); |
lastrow = row; |
lastcol = col; |
retval = 0; |
break; |
case FB_GET_CSIZE: |
/branches/dd/uspace/srv/fb/msim.c |
---|
45,7 → 45,7 |
#include "msim.h" |
#define WIDTH 80 |
#define HEIGHT 25 |
#define HEIGHT 24 |
static char *virt_addr; |
/branches/dd/uspace/srv/fb/ski.c |
---|
47,7 → 47,7 |
#define SKI_PUTCHAR 31 |
#define WIDTH 80 |
#define HEIGHT 25 |
#define HEIGHT 24 |
/** Display character on ski debug console |
* |
/branches/dd/uspace/srv/fb/fb.c |
---|
866,35 → 866,40 |
cursor_show(vport); |
} |
/** Draw text data to viewport |
/** Draw text data to viewport. |
* |
* @param vport Viewport id |
* @param data Text data fitting exactly into viewport |
* |
* @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(viewport_t *vport, keyfield_t *data) |
static void draw_text_data(viewport_t *vport, keyfield_t *data, unsigned int x, |
unsigned int y, unsigned int w, unsigned int h) |
{ |
unsigned int i; |
unsigned int i, j; |
bb_cell_t *bbp; |
attrs_t *a; |
attr_rgb_t rgb; |
for (i = 0; i < vport->cols * vport->rows; i++) { |
unsigned int col = i % vport->cols; |
unsigned int row = i / vport->cols; |
bbp = &vport->backbuf[BB_POS(vport, col, row)]; |
uint8_t glyph = bbp->glyph; |
a = &data[i].attrs; |
rgb_from_attr(&rgb, a); |
for (j = 0; j < h; j++) { |
for (i = 0; i < w; i++) { |
unsigned int col = x + i; |
unsigned int row = y + j; |
bbp->glyph = data[i].character; |
bbp->fg_color = rgb.fg_color; |
bbp->bg_color = rgb.bg_color; |
bbp = &vport->backbuf[BB_POS(vport, col, row)]; |
uint8_t glyph = bbp->glyph; |
draw_vp_glyph(vport, false, col, row); |
a = &data[j * w + i].attrs; |
rgb_from_attr(&rgb, a); |
bbp->glyph = data[j * w + i].character; |
bbp->fg_color = rgb.fg_color; |
bbp->bg_color = rgb.bg_color; |
draw_vp_glyph(vport, false, col, row); |
} |
} |
cursor_show(vport); |
} |
998,6 → 1003,8 |
viewport_t *vport = &viewports[vp]; |
unsigned int x; |
unsigned int y; |
unsigned int w; |
unsigned int h; |
switch (IPC_GET_METHOD(*call)) { |
case IPC_M_SHARE_OUT: |
1058,15 → 1065,23 |
IPC_GET_ARG2(*call), vport->width - x, vport->height - y, putpixel, (void *) vport); |
break; |
case FB_DRAW_TEXT_DATA: |
x = IPC_GET_ARG1(*call); |
y = IPC_GET_ARG2(*call); |
w = IPC_GET_ARG3(*call); |
h = IPC_GET_ARG4(*call); |
if (!interbuffer) { |
retval = EINVAL; |
break; |
} |
if (intersize < vport->cols * vport->rows * sizeof(*interbuffer)) { |
if (x + w > vport->cols || y + h > vport->rows) { |
retval = EINVAL; |
break; |
} |
draw_text_data(vport, interbuffer); |
if (intersize < w * h * sizeof(*interbuffer)) { |
retval = EINVAL; |
break; |
} |
draw_text_data(vport, interbuffer, x, y, w, h); |
break; |
default: |
handled = false; |
/branches/dd/uspace/srv/fb/ega.c |
---|
78,7 → 78,7 |
static unsigned int scr_width; |
static unsigned int scr_height; |
static char *scr_addr; |
static uint8_t *scr_addr; |
static unsigned int style; |
151,13 → 151,30 |
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] = field->character; |
dp[1] = attr_to_ega_style(&field->attrs); |
} |
} |
} |
237,7 → 254,7 |
ipc_callid_t callid; |
ipc_call_t call; |
char c; |
unsigned int row, col; |
unsigned int row, col, w, h; |
int bg_color, fg_color, attr; |
uint32_t bg_rgb, fg_rgb; |
keyfield_t *interbuf = NULL; |
270,11 → 287,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 → 384,7 |
break; |
default: |
retval = ENOENT; |
retval = EINVAL; |
} |
ipc_answer_0(callid, retval); |
} |