Rev 1672 | Rev 1707 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1672 | Rev 1673 | ||
---|---|---|---|
Line 210... | Line 210... | ||
210 | * @param vp Viewport identification |
210 | * @param vp Viewport identification |
211 | * @param x X coord relative to viewport |
211 | * @param x X coord relative to viewport |
212 | * @param y Y coord relative to viewport |
212 | * @param y Y coord relative to viewport |
213 | * @param color RGB color |
213 | * @param color RGB color |
214 | */ |
214 | */ |
215 | static void putpixel(int vp, unsigned int x, unsigned int y, int color) |
215 | static void putpixel(viewport_t *vport, unsigned int x, unsigned int y, int color) |
216 | { |
216 | { |
217 | int dx = viewports[vp].x + x; |
217 | int dx = vport->x + x; |
218 | int dy = viewports[vp].y + y; |
218 | int dy = vport->y + y; |
219 | 219 | ||
220 | if (! viewports[vp].paused) |
220 | if (! (vport->paused && vport->dbdata)) |
221 | (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)],color); |
221 | (*screen.rgb2scr)(&screen.fbaddress[POINTPOS(dx,dy)],color); |
222 | 222 | ||
223 | if (viewports[vp].dbdata) { |
223 | if (vport->dbdata) { |
224 | int dline = (y + viewports[vp].dboffset) % viewports[vp].height; |
224 | int dline = (y + vport->dboffset) % vport->height; |
225 | int doffset = screen.pixelbytes * (dline * viewports[vp].width + x); |
225 | int doffset = screen.pixelbytes * (dline * vport->width + x); |
226 | (*screen.rgb2scr)(&viewports[vp].dbdata[doffset],color); |
226 | (*screen.rgb2scr)(&vport->dbdata[doffset],color); |
227 | } |
227 | } |
228 | } |
228 | } |
229 | 229 | ||
230 | /** Get pixel from viewport */ |
230 | /** Get pixel from viewport */ |
231 | static int getpixel(int vp, unsigned int x, unsigned int y) |
231 | static int getpixel(viewport_t *vport, unsigned int x, unsigned int y) |
232 | { |
232 | { |
233 | int dx = viewports[vp].x + x; |
233 | int dx = vport->x + x; |
234 | int dy = viewports[vp].y + y; |
234 | int dy = vport->y + y; |
235 | 235 | ||
236 | return (*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx,dy)]); |
236 | return (*screen.scr2rgb)(&screen.fbaddress[POINTPOS(dx,dy)]); |
237 | } |
237 | } |
238 | 238 | ||
239 | static inline void putpixel_mem(char *mem, unsigned int x, unsigned int y, |
239 | static inline void putpixel_mem(char *mem, unsigned int x, unsigned int y, |
240 | int color) |
240 | int color) |
241 | { |
241 | { |
242 | (*screen.rgb2scr)(&mem[POINTPOS(x,y)],color); |
242 | (*screen.rgb2scr)(&mem[POINTPOS(x,y)],color); |
243 | } |
243 | } |
244 | 244 | ||
245 | static void draw_rectangle(int vp, unsigned int sx, unsigned int sy, |
245 | static void draw_rectangle(viewport_t *vport, unsigned int sx, unsigned int sy, |
246 | unsigned int width, unsigned int height, |
246 | unsigned int width, unsigned int height, |
247 | int color) |
247 | int color) |
248 | { |
248 | { |
249 | unsigned int x, y; |
249 | unsigned int x, y; |
250 | static void *tmpline; |
250 | static void *tmpline; |
Line 254... | Line 254... | ||
254 | 254 | ||
255 | /* Clear first line */ |
255 | /* Clear first line */ |
256 | for (x = 0; x < width; x++) |
256 | for (x = 0; x < width; x++) |
257 | putpixel_mem(tmpline, x, 0, color); |
257 | putpixel_mem(tmpline, x, 0, color); |
258 | 258 | ||
259 | if (!viewports[vp].paused) { |
259 | if (!vport->paused) { |
260 | /* Recompute to screen coords */ |
260 | /* Recompute to screen coords */ |
261 | sx += viewports[vp].x; |
261 | sx += vport->x; |
262 | sy += viewports[vp].y; |
262 | sy += vport->y; |
263 | /* Copy the rest */ |
263 | /* Copy the rest */ |
264 | for (y = sy;y < sy+height; y++) |
264 | for (y = sy;y < sy+height; y++) |
265 | memcpy(&screen.fbaddress[POINTPOS(sx,y)], tmpline, |
265 | memcpy(&screen.fbaddress[POINTPOS(sx,y)], tmpline, |
266 | screen.pixelbytes * width); |
266 | screen.pixelbytes * width); |
267 | } |
267 | } |
268 | if (viewports[vp].dbdata) { |
268 | if (vport->dbdata) { |
269 | for (y=sy;y < sy+height; y++) { |
269 | for (y=sy;y < sy+height; y++) { |
270 | int rline = (y + viewports[vp].dboffset) % viewports[vp].height; |
270 | int rline = (y + vport->dboffset) % vport->height; |
271 | int rpos = (rline * viewports[vp].width + sx) * screen.pixelbytes; |
271 | int rpos = (rline * vport->width + sx) * screen.pixelbytes; |
272 | memcpy(&viewports[vp].dbdata[rpos], tmpline, screen.pixelbytes * width); |
272 | memcpy(&vport->dbdata[rpos], tmpline, screen.pixelbytes * width); |
273 | } |
273 | } |
274 | } |
274 | } |
275 | 275 | ||
276 | } |
276 | } |
277 | 277 | ||
278 | /** Fill viewport with background color */ |
278 | /** Fill viewport with background color */ |
279 | static void clear_port(int vp) |
279 | static void clear_port(viewport_t *vport) |
280 | { |
280 | { |
281 | viewport_t *vport = &viewports[vp]; |
- | |
282 | - | ||
283 | draw_rectangle(vp, 0, 0, vport->width, vport->height, vport->style.bg_color); |
281 | draw_rectangle(vport, 0, 0, vport->width, vport->height, vport->style.bg_color); |
284 | } |
282 | } |
285 | 283 | ||
286 | /** Scroll unbuffered viewport up/down |
284 | /** Scroll unbuffered viewport up/down |
287 | * |
285 | * |
288 | * @param vp Viewport to scroll |
286 | * @param vp Viewport to scroll |
289 | * @param rows Positive number - scroll up, negative - scroll down |
287 | * @param rows Positive number - scroll up, negative - scroll down |
290 | */ |
288 | */ |
291 | static void scroll_port_nodb(int vp, int lines) |
289 | static void scroll_port_nodb(viewport_t *vport, int lines) |
292 | { |
290 | { |
293 | int y; |
291 | int y; |
294 | int startline; |
292 | int startline; |
295 | int endline; |
293 | int endline; |
296 | viewport_t *vport = &viewports[vp]; |
- | |
297 | 294 | ||
298 | if (lines > 0) { |
295 | if (lines > 0) { |
299 | for (y=vport->y; y < vport->y+vport->height - lines; y++) |
296 | for (y=vport->y; y < vport->y+vport->height - lines; y++) |
300 | memcpy(&screen.fbaddress[POINTPOS(vport->x,y)], |
297 | memcpy(&screen.fbaddress[POINTPOS(vport->x,y)], |
301 | &screen.fbaddress[POINTPOS(vport->x,y + lines)], |
298 | &screen.fbaddress[POINTPOS(vport->x,y + lines)], |
302 | screen.pixelbytes * vport->width); |
299 | screen.pixelbytes * vport->width); |
303 | draw_rectangle(vp, 0, vport->height - lines, |
300 | draw_rectangle(vport, 0, vport->height - lines, |
304 | vport->width, lines, vport->style.bg_color); |
301 | vport->width, lines, vport->style.bg_color); |
305 | } else if (lines < 0) { |
302 | } else if (lines < 0) { |
306 | lines = -lines; |
303 | lines = -lines; |
307 | for (y=vport->y + vport->height-1; y >= vport->y + lines; y--) |
304 | for (y=vport->y + vport->height-1; y >= vport->y + lines; y--) |
308 | memcpy(&screen.fbaddress[POINTPOS(vport->x,y)], |
305 | memcpy(&screen.fbaddress[POINTPOS(vport->x,y)], |
309 | &screen.fbaddress[POINTPOS(vport->x,y - lines)], |
306 | &screen.fbaddress[POINTPOS(vport->x,y - lines)], |
310 | screen.pixelbytes * vport->width); |
307 | screen.pixelbytes * vport->width); |
311 | draw_rectangle(vp, 0, 0, vport->width, lines, vport->style.bg_color); |
308 | draw_rectangle(vport, 0, 0, vport->width, lines, vport->style.bg_color); |
312 | } |
309 | } |
313 | } |
310 | } |
314 | 311 | ||
315 | /** Refresh given viewport from double buffer */ |
312 | /** Refresh given viewport from double buffer */ |
316 | static void refresh_viewport_db(int vp) |
313 | static void refresh_viewport_db(viewport_t *vport) |
317 | { |
314 | { |
318 | unsigned int y, srcy, srcoff, dsty, dstx; |
315 | unsigned int y, srcy, srcoff, dsty, dstx; |
319 | 316 | ||
320 | for (y = 0; y < viewports[vp].height; y++) { |
317 | for (y = 0; y < vport->height; y++) { |
321 | srcy = (y + viewports[vp].dboffset) % viewports[vp].height; |
318 | srcy = (y + vport->dboffset) % vport->height; |
322 | srcoff = (viewports[vp].width * srcy) * screen.pixelbytes; |
319 | srcoff = (vport->width * srcy) * screen.pixelbytes; |
323 | 320 | ||
324 | dstx = viewports[vp].x; |
321 | dstx = vport->x; |
325 | dsty = viewports[vp].y + y; |
322 | dsty = vport->y + y; |
326 | 323 | ||
327 | memcpy(&screen.fbaddress[POINTPOS(dstx,dsty)], |
324 | memcpy(&screen.fbaddress[POINTPOS(dstx,dsty)], |
328 | &viewports[vp].dbdata[srcoff], |
325 | &vport->dbdata[srcoff], |
329 | viewports[vp].width*screen.pixelbytes); |
326 | vport->width*screen.pixelbytes); |
330 | } |
327 | } |
331 | } |
328 | } |
332 | 329 | ||
333 | /** Scroll viewport that has double buffering enabled */ |
330 | /** Scroll viewport that has double buffering enabled */ |
334 | static void scroll_port_db(int vp, int lines) |
331 | static void scroll_port_db(viewport_t *vport, int lines) |
335 | { |
332 | { |
336 | ++viewports[vp].paused; |
333 | ++vport->paused; |
337 | if (lines > 0) { |
334 | if (lines > 0) { |
338 | draw_rectangle(vp, 0, 0, viewports[vp].width, lines, |
335 | draw_rectangle(vport, 0, 0, vport->width, lines, |
339 | viewports[vp].style.bg_color); |
336 | vport->style.bg_color); |
340 | viewports[vp].dboffset += lines; |
337 | vport->dboffset += lines; |
341 | viewports[vp].dboffset %= viewports[vp].height; |
338 | vport->dboffset %= vport->height; |
342 | } else if (lines < 0) { |
339 | } else if (lines < 0) { |
343 | lines = -lines; |
340 | lines = -lines; |
344 | draw_rectangle(vp, 0, viewports[vp].height-lines, |
341 | draw_rectangle(vport, 0, vport->height-lines, |
345 | viewports[vp].width, lines, |
342 | vport->width, lines, |
346 | viewports[vp].style.bg_color); |
343 | vport->style.bg_color); |
347 | 344 | ||
348 | if (viewports[vp].dboffset < lines) |
345 | if (vport->dboffset < lines) |
349 | viewports[vp].dboffset += viewports[vp].height; |
346 | vport->dboffset += vport->height; |
350 | viewports[vp].dboffset -= lines; |
347 | vport->dboffset -= lines; |
351 | } |
348 | } |
352 | 349 | ||
353 | --viewports[vp].paused; |
350 | --vport->paused; |
354 | - | ||
355 | refresh_viewport_db(vp); |
- | |
356 | 351 | ||
- | 352 | refresh_viewport_db(vport); |
|
357 | } |
353 | } |
358 | 354 | ||
359 | /** Scrolls viewport given number of lines */ |
355 | /** Scrolls viewport given number of lines */ |
360 | static void scroll_port(int vp, int lines) |
356 | static void scroll_port(viewport_t *vport, int lines) |
361 | { |
357 | { |
362 | if (viewports[vp].dbdata) |
358 | if (vport->dbdata) |
363 | scroll_port_db(vp, lines); |
359 | scroll_port_db(vport, lines); |
364 | else |
360 | else |
365 | scroll_port_nodb(vp, lines); |
361 | scroll_port_nodb(vport, lines); |
366 | 362 | ||
367 | } |
363 | } |
368 | 364 | ||
369 | static void invert_pixel(int vp,unsigned int x, unsigned int y) |
365 | static void invert_pixel(viewport_t *vport, unsigned int x, unsigned int y) |
370 | { |
366 | { |
371 | putpixel(vp, x, y, ~getpixel(vp, x, y)); |
367 | putpixel(vport, x, y, ~getpixel(vport, x, y)); |
372 | } |
368 | } |
373 | 369 | ||
374 | 370 | ||
375 | /***************************************************************/ |
371 | /***************************************************************/ |
376 | /* Character-console functions */ |
372 | /* Character-console functions */ |
Line 381... | Line 377... | ||
381 | * @param sx Coordinates of top-left of the character |
377 | * @param sx Coordinates of top-left of the character |
382 | * @param sy Coordinates of top-left of the character |
378 | * @param sy Coordinates of top-left of the character |
383 | * @param style Color of the character |
379 | * @param style Color of the character |
384 | * @param transparent If false, print background color |
380 | * @param transparent If false, print background color |
385 | */ |
381 | */ |
386 | static void draw_glyph(int vp,__u8 glyph, unsigned int sx, unsigned int sy, |
382 | static void draw_glyph(viewport_t *vport,__u8 glyph, unsigned int sx, unsigned int sy, |
387 | style_t style, int transparent) |
383 | style_t style, int transparent) |
388 | { |
384 | { |
389 | int i; |
385 | int i; |
390 | unsigned int y; |
386 | unsigned int y; |
391 | unsigned int glline; |
387 | unsigned int glline; |
392 | 388 | ||
393 | for (y = 0; y < FONT_SCANLINES; y++) { |
389 | for (y = 0; y < FONT_SCANLINES; y++) { |
394 | glline = fb_font[glyph * FONT_SCANLINES + y]; |
390 | glline = fb_font[glyph * FONT_SCANLINES + y]; |
395 | for (i = 0; i < 8; i++) { |
391 | for (i = 0; i < 8; i++) { |
396 | if (glline & (1 << (7 - i))) |
392 | if (glline & (1 << (7 - i))) |
397 | putpixel(vp, sx + i, sy + y, style.fg_color); |
393 | putpixel(vport, sx + i, sy + y, style.fg_color); |
398 | else if (!transparent) |
394 | else if (!transparent) |
399 | putpixel(vp, sx + i, sy + y, style.bg_color); |
395 | putpixel(vport, sx + i, sy + y, style.bg_color); |
400 | } |
396 | } |
401 | } |
397 | } |
402 | } |
398 | } |
403 | 399 | ||
404 | /** Invert character at given position */ |
400 | /** Invert character at given position */ |
405 | static void invert_char(int vp,unsigned int row, unsigned int col) |
401 | static void invert_char(viewport_t *vport,unsigned int row, unsigned int col) |
406 | { |
402 | { |
407 | unsigned int x; |
403 | unsigned int x; |
408 | unsigned int y; |
404 | unsigned int y; |
409 | 405 | ||
410 | for (x = 0; x < COL_WIDTH; x++) |
406 | for (x = 0; x < COL_WIDTH; x++) |
411 | for (y = 0; y < FONT_SCANLINES; y++) |
407 | for (y = 0; y < FONT_SCANLINES; y++) |
412 | invert_pixel(vp, col * COL_WIDTH + x, row * FONT_SCANLINES + y); |
408 | invert_pixel(vport, col * COL_WIDTH + x, row * FONT_SCANLINES + y); |
413 | } |
409 | } |
414 | 410 | ||
415 | /***************************************************************/ |
411 | /***************************************************************/ |
416 | /* Stdout specific functions */ |
412 | /* Stdout specific functions */ |
417 | 413 | ||
Line 502... | Line 498... | ||
502 | /* Create first viewport */ |
498 | /* Create first viewport */ |
503 | viewport_create(0,0,xres,yres); |
499 | viewport_create(0,0,xres,yres); |
504 | } |
500 | } |
505 | 501 | ||
506 | /** Hide cursor if it is shown */ |
502 | /** Hide cursor if it is shown */ |
507 | static void cursor_hide(int vp) |
503 | static void cursor_hide(viewport_t *vport) |
508 | { |
504 | { |
509 | viewport_t *vport = &viewports[vp]; |
- | |
510 | - | ||
511 | if (vport->cursor_active && vport->cursor_shown) { |
505 | if (vport->cursor_active && vport->cursor_shown) { |
512 | invert_char(vp, vport->cur_row, vport->cur_col); |
506 | invert_char(vport, vport->cur_row, vport->cur_col); |
513 | vport->cursor_shown = 0; |
507 | vport->cursor_shown = 0; |
514 | } |
508 | } |
515 | } |
509 | } |
516 | 510 | ||
517 | /** Show cursor if cursor showing is enabled */ |
511 | /** Show cursor if cursor showing is enabled */ |
518 | static void cursor_print(int vp) |
512 | static void cursor_print(viewport_t *vport) |
519 | { |
513 | { |
520 | viewport_t *vport = &viewports[vp]; |
- | |
521 | - | ||
522 | /* Do not check for cursor_shown */ |
514 | /* Do not check for cursor_shown */ |
523 | if (vport->cursor_active) { |
515 | if (vport->cursor_active) { |
524 | invert_char(vp, vport->cur_row, vport->cur_col); |
516 | invert_char(vport, vport->cur_row, vport->cur_col); |
525 | vport->cursor_shown = 1; |
517 | vport->cursor_shown = 1; |
526 | } |
518 | } |
527 | } |
519 | } |
528 | 520 | ||
529 | /** Invert cursor, if it is enabled */ |
521 | /** Invert cursor, if it is enabled */ |
530 | static void cursor_blink(int vp) |
522 | static void cursor_blink(viewport_t *vport) |
531 | { |
523 | { |
532 | viewport_t *vport = &viewports[vp]; |
- | |
533 | - | ||
534 | if (vport->cursor_shown) |
524 | if (vport->cursor_shown) |
535 | cursor_hide(vp); |
525 | cursor_hide(vport); |
536 | else |
526 | else |
537 | cursor_print(vp); |
527 | cursor_print(vport); |
538 | } |
528 | } |
539 | 529 | ||
540 | /** Draw character at given position relative to viewport |
530 | /** Draw character at given position relative to viewport |
541 | * |
531 | * |
542 | * @param vp Viewport identification |
532 | * @param vp Viewport identification |
543 | * @param c Character to print |
533 | * @param c Character to print |
544 | * @param row Screen position relative to viewport |
534 | * @param row Screen position relative to viewport |
545 | * @param col Screen position relative to viewport |
535 | * @param col Screen position relative to viewport |
546 | * @param transparent If false, print background color with character |
536 | * @param transparent If false, print background color with character |
547 | */ |
537 | */ |
548 | static void draw_char(int vp, char c, unsigned int row, unsigned int col, style_t style, int transparent) |
538 | static void draw_char(viewport_t *vport, char c, unsigned int row, unsigned int col, |
- | 539 | style_t style, int transparent) |
|
549 | { |
540 | { |
550 | viewport_t *vport = &viewports[vp]; |
- | |
551 | - | ||
552 | /* Optimize - do not hide cursor if we are going to overwrite it */ |
541 | /* Optimize - do not hide cursor if we are going to overwrite it */ |
553 | if (vport->cursor_active && vport->cursor_shown && |
542 | if (vport->cursor_active && vport->cursor_shown && |
554 | (vport->cur_col != col || vport->cur_row != row)) |
543 | (vport->cur_col != col || vport->cur_row != row)) |
555 | invert_char(vp, vport->cur_row, vport->cur_col); |
544 | invert_char(vport, vport->cur_row, vport->cur_col); |
556 | 545 | ||
557 | draw_glyph(vp, c, col * COL_WIDTH, row * FONT_SCANLINES, style, transparent); |
546 | draw_glyph(vport, c, col * COL_WIDTH, row * FONT_SCANLINES, style, transparent); |
558 | 547 | ||
559 | vport->cur_col = col; |
548 | vport->cur_col = col; |
560 | vport->cur_row = row; |
549 | vport->cur_row = row; |
561 | 550 | ||
562 | vport->cur_col++; |
551 | vport->cur_col++; |
Line 564... | Line 553... | ||
564 | vport->cur_col = 0; |
553 | vport->cur_col = 0; |
565 | vport->cur_row++; |
554 | vport->cur_row++; |
566 | if (vport->cur_row >= vport->rows) |
555 | if (vport->cur_row >= vport->rows) |
567 | vport->cur_row--; |
556 | vport->cur_row--; |
568 | } |
557 | } |
569 | cursor_print(vp); |
558 | cursor_print(vport); |
570 | } |
559 | } |
571 | 560 | ||
572 | /** Draw text data to viewport |
561 | /** Draw text data to viewport |
573 | * |
562 | * |
574 | * @param vp Viewport id |
563 | * @param vp Viewport id |
575 | * @param data Text data fitting exactly into viewport |
564 | * @param data Text data fitting exactly into viewport |
576 | */ |
565 | */ |
577 | static void draw_text_data(int vp, keyfield_t *data) |
566 | static void draw_text_data(viewport_t *vport, keyfield_t *data) |
578 | { |
567 | { |
579 | viewport_t *vport = &viewports[vp]; |
- | |
580 | int i; |
568 | int i; |
581 | char c; |
569 | char c; |
582 | int col,row; |
570 | int col,row; |
583 | 571 | ||
584 | clear_port(vp); |
572 | clear_port(vport); |
585 | for (i=0; i < vport->cols * vport->rows; i++) { |
573 | for (i=0; i < vport->cols * vport->rows; i++) { |
586 | if (data[i].character == ' ' && style_same(data[i].style,vport->style)) |
574 | if (data[i].character == ' ' && style_same(data[i].style,vport->style)) |
587 | continue; |
575 | continue; |
588 | col = i % vport->cols; |
576 | col = i % vport->cols; |
589 | row = i / vport->cols; |
577 | row = i / vport->cols; |
590 | draw_glyph(vp, data[i].character, col * COL_WIDTH, row * FONT_SCANLINES, |
578 | draw_glyph(vport, data[i].character, col * COL_WIDTH, row * FONT_SCANLINES, |
591 | data[i].style, style_same(data[i].style,vport->style)); |
579 | data[i].style, style_same(data[i].style,vport->style)); |
592 | } |
580 | } |
593 | cursor_print(vp); |
581 | cursor_print(vport); |
594 | } |
582 | } |
595 | 583 | ||
596 | 584 | ||
597 | /** Return first free pixmap */ |
585 | /** Return first free pixmap */ |
598 | static int find_free_pixmap(void) |
586 | static int find_free_pixmap(void) |
Line 630... | Line 618... | ||
630 | pmap->data = malloc(pmap->width * pmap->height * screen.pixelbytes); |
618 | pmap->data = malloc(pmap->width * pmap->height * screen.pixelbytes); |
631 | if (!pmap->data) |
619 | if (!pmap->data) |
632 | return ENOMEM; |
620 | return ENOMEM; |
633 | 621 | ||
634 | ppm_draw(shm, size, 0, 0, pmap->width, pmap->height, |
622 | ppm_draw(shm, size, 0, 0, pmap->width, pmap->height, |
635 | putpixel_pixmap, pm); |
623 | (putpixel_cb_t)putpixel_pixmap, (void *)pm); |
636 | 624 | ||
637 | return pm; |
625 | return pm; |
638 | } |
626 | } |
639 | 627 | ||
640 | /** Handle shared memory communication calls |
628 | /** Handle shared memory communication calls |
Line 723... | Line 711... | ||
723 | retval = EINVAL; |
711 | retval = EINVAL; |
724 | break; |
712 | break; |
725 | } |
713 | } |
726 | 714 | ||
727 | ppm_draw(shm, shm_size, IPC_GET_ARG1(*call), IPC_GET_ARG2(*call), |
715 | ppm_draw(shm, shm_size, IPC_GET_ARG1(*call), IPC_GET_ARG2(*call), |
728 | vport->width - x, vport->height - y, putpixel, vp); |
716 | vport->width - x, vport->height - y, (putpixel_cb_t)putpixel, vport); |
729 | break; |
717 | break; |
730 | case FB_DRAW_TEXT_DATA: |
718 | case FB_DRAW_TEXT_DATA: |
731 | if (!interbuffer) { |
719 | if (!interbuffer) { |
732 | retval = EINVAL; |
720 | retval = EINVAL; |
733 | break; |
721 | break; |
734 | } |
722 | } |
735 | if (intersize < vport->cols*vport->rows*sizeof(*interbuffer)) { |
723 | if (intersize < vport->cols*vport->rows*sizeof(*interbuffer)) { |
736 | retval = EINVAL; |
724 | retval = EINVAL; |
737 | break; |
725 | break; |
738 | } |
726 | } |
739 | draw_text_data(vp, interbuffer); |
727 | draw_text_data(vport, interbuffer); |
740 | break; |
728 | break; |
741 | default: |
729 | default: |
742 | handled = 0; |
730 | handled = 0; |
743 | } |
731 | } |
744 | 732 | ||
Line 993... | Line 981... | ||
993 | callid = async_get_call_timeout(&call,250000); |
981 | callid = async_get_call_timeout(&call,250000); |
994 | else |
982 | else |
995 | callid = async_get_call(&call); |
983 | callid = async_get_call(&call); |
996 | 984 | ||
997 | if (!callid) { |
985 | if (!callid) { |
998 | cursor_blink(vp); |
986 | cursor_blink(vport); |
999 | anims_tick(); |
987 | anims_tick(); |
1000 | continue; |
988 | continue; |
1001 | } |
989 | } |
1002 | if (shm_handle(callid, &call, vp)) |
990 | if (shm_handle(callid, &call, vp)) |
1003 | continue; |
991 | continue; |
Line 1023... | Line 1011... | ||
1023 | retval = EINVAL; |
1011 | retval = EINVAL; |
1024 | break; |
1012 | break; |
1025 | } |
1013 | } |
1026 | ipc_answer_fast(callid,0,0,0); |
1014 | ipc_answer_fast(callid,0,0,0); |
1027 | 1015 | ||
1028 | draw_char(vp, c, row, col, vport->style, IPC_GET_METHOD(call) == FB_TRANS_PUTCHAR); |
1016 | draw_char(vport, c, row, col, vport->style, IPC_GET_METHOD(call) == FB_TRANS_PUTCHAR); |
1029 | continue; /* msg already answered */ |
1017 | continue; /* msg already answered */ |
1030 | case FB_CLEAR: |
1018 | case FB_CLEAR: |
1031 | clear_port(vp); |
1019 | clear_port(vport); |
1032 | cursor_print(vp); |
1020 | cursor_print(vport); |
1033 | retval = 0; |
1021 | retval = 0; |
1034 | break; |
1022 | break; |
1035 | case FB_CURSOR_GOTO: |
1023 | case FB_CURSOR_GOTO: |
1036 | row = IPC_GET_ARG1(call); |
1024 | row = IPC_GET_ARG1(call); |
1037 | col = IPC_GET_ARG2(call); |
1025 | col = IPC_GET_ARG2(call); |
1038 | if (row >= vport->rows || col >= vport->cols) { |
1026 | if (row >= vport->rows || col >= vport->cols) { |
1039 | retval = EINVAL; |
1027 | retval = EINVAL; |
1040 | break; |
1028 | break; |
1041 | } |
1029 | } |
1042 | retval = 0; |
1030 | retval = 0; |
1043 | cursor_hide(vp); |
1031 | cursor_hide(vport); |
1044 | vport->cur_col = col; |
1032 | vport->cur_col = col; |
1045 | vport->cur_row = row; |
1033 | vport->cur_row = row; |
1046 | cursor_print(vp); |
1034 | cursor_print(vport); |
1047 | break; |
1035 | break; |
1048 | case FB_CURSOR_VISIBILITY: |
1036 | case FB_CURSOR_VISIBILITY: |
1049 | cursor_hide(vp); |
1037 | cursor_hide(vport); |
1050 | vport->cursor_active = IPC_GET_ARG1(call); |
1038 | vport->cursor_active = IPC_GET_ARG1(call); |
1051 | cursor_print(vp); |
1039 | cursor_print(vport); |
1052 | retval = 0; |
1040 | retval = 0; |
1053 | break; |
1041 | break; |
1054 | case FB_GET_CSIZE: |
1042 | case FB_GET_CSIZE: |
1055 | ipc_answer_fast(callid, 0, vport->rows, vport->cols); |
1043 | ipc_answer_fast(callid, 0, vport->rows, vport->cols); |
1056 | continue; |
1044 | continue; |
Line 1058... | Line 1046... | ||
1058 | i = IPC_GET_ARG1(call); |
1046 | i = IPC_GET_ARG1(call); |
1059 | if (i > vport->rows || i < (- (int)vport->rows)) { |
1047 | if (i > vport->rows || i < (- (int)vport->rows)) { |
1060 | retval = EINVAL; |
1048 | retval = EINVAL; |
1061 | break; |
1049 | break; |
1062 | } |
1050 | } |
1063 | cursor_hide(vp); |
1051 | cursor_hide(vport); |
1064 | scroll_port(vp, i*FONT_SCANLINES); |
1052 | scroll_port(vport, i*FONT_SCANLINES); |
1065 | cursor_print(vp); |
1053 | cursor_print(vport); |
1066 | retval = 0; |
1054 | retval = 0; |
1067 | break; |
1055 | break; |
1068 | case FB_VIEWPORT_DB: |
1056 | case FB_VIEWPORT_DB: |
1069 | /* Enable double buffering */ |
1057 | /* Enable double buffering */ |
1070 | i = IPC_GET_ARG1(call); |
1058 | i = IPC_GET_ARG1(call); |
Line 1097... | Line 1085... | ||
1097 | } |
1085 | } |
1098 | if (! viewports[i].initialized ) { |
1086 | if (! viewports[i].initialized ) { |
1099 | retval = EADDRNOTAVAIL; |
1087 | retval = EADDRNOTAVAIL; |
1100 | break; |
1088 | break; |
1101 | } |
1089 | } |
1102 | cursor_hide(vp); |
1090 | cursor_hide(vport); |
1103 | vp = i; |
1091 | vp = i; |
1104 | vport = &viewports[vp]; |
1092 | vport = &viewports[vp]; |
1105 | cursor_print(vp); |
1093 | cursor_print(vport); |
1106 | retval = 0; |
1094 | retval = 0; |
1107 | break; |
1095 | break; |
1108 | case FB_VIEWPORT_CREATE: |
1096 | case FB_VIEWPORT_CREATE: |
1109 | retval = viewport_create(IPC_GET_ARG1(call) >> 16, |
1097 | retval = viewport_create(IPC_GET_ARG1(call) >> 16, |
1110 | IPC_GET_ARG1(call) & 0xffff, |
1098 | IPC_GET_ARG1(call) & 0xffff, |