Rev 4345 | Rev 4348 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4345 | Rev 4347 | ||
---|---|---|---|
Line 76... | Line 76... | ||
76 | /* Allow only 1 connection */ |
76 | /* Allow only 1 connection */ |
77 | static int client_connected = 0; |
77 | static int client_connected = 0; |
78 | 78 | ||
79 | static unsigned int scr_width; |
79 | static unsigned int scr_width; |
80 | static unsigned int scr_height; |
80 | static unsigned int scr_height; |
81 | static char *scr_addr; |
81 | static uint8_t *scr_addr; |
82 | 82 | ||
83 | static unsigned int style; |
83 | static unsigned int style; |
84 | 84 | ||
85 | static unsigned attr_to_ega_style(const attrs_t *a); |
85 | static unsigned attr_to_ega_style(const attrs_t *a); |
86 | 86 | ||
Line 149... | Line 149... | ||
149 | scr_addr[(row * scr_width + col) * 2 + 1] = style; |
149 | scr_addr[(row * scr_width + col) * 2 + 1] = style; |
150 | 150 | ||
151 | cursor_goto(row, col + 1); |
151 | cursor_goto(row, col + 1); |
152 | } |
152 | } |
153 | 153 | ||
- | 154 | /** Draw text data to viewport. |
|
- | 155 | * |
|
- | 156 | * @param vport Viewport id |
|
- | 157 | * @param data Text data. |
|
- | 158 | * @param x Leftmost column of the area. |
|
- | 159 | * @param y Topmost row of the area. |
|
- | 160 | * @param w Number of rows. |
|
- | 161 | * @param h Number of columns. |
|
- | 162 | */ |
|
154 | static void draw_text_data(keyfield_t *data) |
163 | static void draw_text_data(keyfield_t *data, unsigned int x, |
- | 164 | unsigned int y, unsigned int w, unsigned int h) |
|
155 | { |
165 | { |
- | 166 | unsigned int i, j; |
|
- | 167 | keyfield_t *field; |
|
156 | int i; |
168 | uint8_t *dp; |
- | 169 | ||
- | 170 | for (j = 0; j < h; j++) { |
|
- | 171 | for (i = 0; i < w; i++) { |
|
- | 172 | field = &data[j * w + i]; |
|
- | 173 | dp = &scr_addr[2 * ((y + j) * scr_width + (x + i))]; |
|
157 | 174 | ||
158 | for (i = 0; i < scr_width * scr_height; i++) { |
- | |
159 | scr_addr[i * 2] = data[i].character; |
175 | dp[0] = field->character; |
160 | scr_addr[i * 2 + 1] = attr_to_ega_style(&data[i].attrs); |
176 | dp[1] = attr_to_ega_style(&field->attrs); |
- | 177 | } |
|
161 | } |
178 | } |
162 | } |
179 | } |
163 | 180 | ||
164 | static int save_screen(void) |
181 | static int save_screen(void) |
165 | { |
182 | { |
Line 235... | Line 252... | ||
235 | { |
252 | { |
236 | int retval; |
253 | int retval; |
237 | ipc_callid_t callid; |
254 | ipc_callid_t callid; |
238 | ipc_call_t call; |
255 | ipc_call_t call; |
239 | char c; |
256 | char c; |
240 | unsigned int row, col; |
257 | unsigned int row, col, w, h; |
241 | int bg_color, fg_color, attr; |
258 | int bg_color, fg_color, attr; |
242 | uint32_t bg_rgb, fg_rgb; |
259 | uint32_t bg_rgb, fg_rgb; |
243 | keyfield_t *interbuf = NULL; |
260 | keyfield_t *interbuf = NULL; |
244 | size_t intersize = 0; |
261 | size_t intersize = 0; |
245 | int i; |
262 | int i; |
Line 268... | Line 285... | ||
268 | continue; |
285 | continue; |
269 | } |
286 | } |
270 | retval = EINVAL; |
287 | retval = EINVAL; |
271 | break; |
288 | break; |
272 | case FB_DRAW_TEXT_DATA: |
289 | case FB_DRAW_TEXT_DATA: |
- | 290 | col = IPC_GET_ARG1(call); |
|
- | 291 | row = IPC_GET_ARG2(call); |
|
- | 292 | w = IPC_GET_ARG3(call); |
|
- | 293 | h = IPC_GET_ARG4(call); |
|
273 | if (!interbuf) { |
294 | if (!interbuf) { |
274 | retval = EINVAL; |
295 | retval = EINVAL; |
275 | break; |
296 | break; |
276 | } |
297 | } |
- | 298 | if (col + w > scr_width || row + h > scr_height) { |
|
- | 299 | retval = EINVAL; |
|
- | 300 | break; |
|
- | 301 | } |
|
277 | draw_text_data(interbuf); |
302 | draw_text_data(interbuf, col, row, w, h); |
278 | retval = 0; |
303 | retval = 0; |
279 | break; |
304 | break; |
280 | case FB_GET_CSIZE: |
305 | case FB_GET_CSIZE: |
281 | ipc_answer_2(callid, EOK, scr_height, scr_width); |
306 | ipc_answer_2(callid, EOK, scr_height, scr_width); |
282 | continue; |
307 | continue; |
Line 357... | Line 382... | ||
357 | } |
382 | } |
358 | retval = 0; |
383 | retval = 0; |
359 | break; |
384 | break; |
360 | 385 | ||
361 | default: |
386 | default: |
362 | retval = ENOENT; |
387 | retval = EINVAL; |
363 | } |
388 | } |
364 | ipc_answer_0(callid, retval); |
389 | ipc_answer_0(callid, retval); |
365 | } |
390 | } |
366 | } |
391 | } |
367 | 392 |