Changeset 8dc12ac in mainline


Ignore:
Timestamp:
2009-06-03T18:41:27Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d0e461
Parents:
424cd43
Message:

framebuffer server rewrite: cleanup, always use canonical order of coordinates (x, y)

Location:
uspace/srv/fb
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fb/ega.c

    r424cd43 r8dc12ac  
    5050#include <ipc/services.h>
    5151#include <libarch/ddi.h>
    52 #include <console/style.h>
    53 #include <console/color.h>
     52#include <io/style.h>
     53#include <io/color.h>
    5454#include <sys/types.h>
    5555
     
    7171int ega_inverted_color = 0xf0;
    7272
    73 #define NORMAL_COLOR            ega_normal_color       
     73#define NORMAL_COLOR            ega_normal_color
    7474#define INVERTED_COLOR          ega_inverted_color
    7575
     
    9696}
    9797
    98 static void cursor_goto(unsigned int row, unsigned int col)
     98static void cursor_goto(unsigned int col, unsigned int row)
    9999{
    100100        int ega_cursor;
     
    145145}
    146146
    147 static void printchar(wchar_t c, unsigned int row, unsigned int col)
     147static void printchar(wchar_t c, unsigned int col, unsigned int row)
    148148{
    149149        scr_addr[(row * scr_width + col) * 2] = ega_glyph(c);
     
    242242{
    243243        switch (a->t) {
    244         case at_style: return style_to_ega_style(a->a.s.style);
    245         case at_rgb: return rgb_to_ega_style(a->a.r.fg_color, a->a.r.bg_color);
    246         case at_idx: return color_to_ega_style(a->a.i.fg_color,
    247             a->a.i.bg_color, a->a.i.flags);
    248         default: return INVERTED_COLOR;
     244        case at_style:
     245                return style_to_ega_style(a->a.s.style);
     246        case at_rgb:
     247                return rgb_to_ega_style(a->a.r.fg_color, a->a.r.bg_color);
     248        case at_idx:
     249                return color_to_ega_style(a->a.i.fg_color,
     250                    a->a.i.bg_color, a->a.i.flags);
     251        default:
     252                return INVERTED_COLOR;
    249253        }
    250254}
     
    321325                case FB_PUTCHAR:
    322326                        c = IPC_GET_ARG1(call);
     327                        col = IPC_GET_ARG2(call);
     328                        row = IPC_GET_ARG3(call);
     329                        if (col >= scr_width || row >= scr_height) {
     330                                retval = EINVAL;
     331                                break;
     332                        }
     333                        printchar(c, col, row);
     334                        retval = 0;
     335                        break;
     336                case FB_CURSOR_GOTO:
     337                        col = IPC_GET_ARG1(call);
    323338                        row = IPC_GET_ARG2(call);
    324                         col = IPC_GET_ARG3(call);
    325                         if (col >= scr_width || row >= scr_height) {
    326                                 retval = EINVAL;
    327                                 break;
    328                         }
    329                         printchar(c, row, col);
    330                         retval = 0;
    331                         break;
    332                 case FB_CURSOR_GOTO:
    333                         row = IPC_GET_ARG1(call);
    334                         col = IPC_GET_ARG2(call);
    335339                        if (row >= scr_height || col >= scr_width) {
    336340                                retval = EINVAL;
    337341                                break;
    338342                        }
    339                         cursor_goto(row, col);
     343                        cursor_goto(col, row);
    340344                        retval = 0;
    341345                        break;
  • uspace/srv/fb/ega.h

    r424cd43 r8dc12ac  
    2828
    2929/** @addtogroup egafb
    30  * @brief       HelenOS EGA framebuffer.
     30 * @brief HelenOS EGA framebuffer.
    3131 * @ingroup fbs
    3232 * @{
    33  */ 
     33 */
    3434/** @file
    3535 */
     
    4444/** @}
    4545 */
    46 
  • uspace/srv/fb/fb.c

    r424cd43 r8dc12ac  
    5252#include <kernel/errno.h>
    5353#include <kernel/genarch/fb/visuals.h>
    54 #include <console/color.h>
    55 #include <console/style.h>
     54#include <io/color.h>
     55#include <io/style.h>
    5656#include <async.h>
    5757#include <bool.h>
     
    376376static void vport_redraw(viewport_t *vport)
    377377{
     378        unsigned int col;
    378379        unsigned int row;
    379         unsigned int col;
    380380       
    381381        for (row = 0; row < vport->rows; row++) {
     
    432432static void vport_scroll(viewport_t *vport, int lines)
    433433{
     434        unsigned int col;
    434435        unsigned int row;
    435         unsigned int col;
    436436        unsigned int x;
    437437        unsigned int y;
     
    15651565                int scroll;
    15661566                wchar_t ch;
    1567                 unsigned int row, col;
     1567                unsigned int col, row;
    15681568               
    15691569                if ((vport->cursor_active) || (anims_enabled))
     
    16021602                case FB_PUTCHAR:
    16031603                        ch = IPC_GET_ARG1(call);
    1604                         row = IPC_GET_ARG2(call);
    1605                         col = IPC_GET_ARG3(call);
     1604                        col = IPC_GET_ARG2(call);
     1605                        row = IPC_GET_ARG3(call);
    16061606                       
    16071607                        if ((col >= vport->cols) || (row >= vport->rows)) {
     
    16211621                        break;
    16221622                case FB_CURSOR_GOTO:
    1623                         row = IPC_GET_ARG1(call);
    1624                         col = IPC_GET_ARG2(call);
     1623                        col = IPC_GET_ARG1(call);
     1624                        row = IPC_GET_ARG2(call);
    16251625                       
    16261626                        if ((col >= vport->cols) || (row >= vport->rows)) {
     
    16421642                        break;
    16431643                case FB_GET_CSIZE:
    1644                         ipc_answer_2(callid, EOK, vport->rows, vport->cols);
     1644                        ipc_answer_2(callid, EOK, vport->cols, vport->rows);
    16451645                        continue;
    16461646                case FB_SCROLL:
  • uspace/srv/fb/serial_console.c

    r424cd43 r8dc12ac  
    4444#include <bool.h>
    4545#include <errno.h>
    46 #include <console/color.h>
    47 #include <console/style.h>
     46#include <io/color.h>
     47#include <io/style.h>
     48#include <string.h>
    4849
    4950#include "../console/screenbuffer.h"
     
    129130}
    130131
    131 void serial_goto(const unsigned int row, const unsigned int col)
    132 {
    133         if ((row > scr_height) || (col > scr_width))
     132void serial_goto(const unsigned int col, const unsigned int row)
     133{
     134        if ((col > scr_width) || (row > scr_height))
    134135                return;
    135136       
     
    154155{
    155156        if (i > 0) {
    156                 serial_goto(scr_height - 1, 0);
     157                serial_goto(0, scr_height - 1);
    157158                while (i--)
    158159                        serial_puts("\033D");
     
    236237                serial_sgr(SGR_REVERSE_OFF);
    237238        else
    238                 serial_sgr(SGR_REVERSE);       
     239                serial_sgr(SGR_REVERSE);
    239240}
    240241
     
    242243{
    243244        switch (a->t) {
    244         case at_style: serial_set_style(a->a.s.style); break;
    245         case at_rgb: serial_set_rgb(a->a.r.fg_color, a->a.r.bg_color); break;
    246         case at_idx: serial_set_idx(a->a.i.fg_color,
    247             a->a.i.bg_color, a->a.i.flags); break;
    248         default: break;
     245        case at_style:
     246                serial_set_style(a->a.s.style);
     247                break;
     248        case at_rgb:
     249                serial_set_rgb(a->a.r.fg_color, a->a.r.bg_color);
     250                break;
     251        case at_idx:
     252                serial_set_idx(a->a.i.fg_color,
     253                    a->a.i.bg_color, a->a.i.flags);
     254                break;
     255        default:
     256                break;
    249257        }
    250258}
     
    266274        attrs_t *a0, *a1;
    267275
    268         serial_goto(y, x);
     276        serial_goto(x, y);
    269277        a0 = &data[0].attrs;
    270278        serial_set_attrs(a0);
     
    272280        for (j = 0; j < h; j++) {
    273281                if (j > 0 && w != scr_width)
    274                         serial_goto(y, x);
     282                        serial_goto(x, j);
    275283
    276284                for (i = 0; i < w; i++) {
     
    355363                        }
    356364                        draw_text_data(interbuf, col, row, w, h);
     365                        lastcol = col + w;
    357366                        lastrow = row + h - 1;
    358                         lastcol = col + w;
    359367                        retval = 0;
    360368                        break;
    361369                case FB_PUTCHAR:
    362370                        c = IPC_GET_ARG1(call);
    363                         row = IPC_GET_ARG2(call);
    364                         col = IPC_GET_ARG3(call);
     371                        col = IPC_GET_ARG2(call);
     372                        row = IPC_GET_ARG3(call);
    365373                        if ((lastcol != col) || (lastrow != row))
    366                                 serial_goto(row, col);
     374                                serial_goto(col, row);
    367375                        lastcol = col + 1;
    368376                        lastrow = row;
     
    371379                        break;
    372380                case FB_CURSOR_GOTO:
    373                         row = IPC_GET_ARG1(call);
    374                         col = IPC_GET_ARG2(call);
    375                         serial_goto(row, col);
     381                        col = IPC_GET_ARG1(call);
     382                        row = IPC_GET_ARG2(call);
     383                        serial_goto(col, row);
     384                        lastcol = col;
    376385                        lastrow = row;
    377                         lastcol = col;
    378386                        retval = 0;
    379387                        break;
    380388                case FB_GET_CSIZE:
    381                         ipc_answer_2(callid, EOK, scr_height, scr_width);
     389                        ipc_answer_2(callid, EOK, scr_width, scr_height);
    382390                        continue;
    383391                case FB_CLEAR:
     
    417425                        }
    418426                        serial_scroll(i);
    419                         serial_goto(lastrow, lastcol);
     427                        serial_goto(lastcol, lastrow);
    420428                        retval = 0;
    421429                        break;
     
    446454}
    447455
    448 /** 
     456/**
    449457 * @}
    450458 */
  • uspace/srv/fb/serial_console.h

    r424cd43 r8dc12ac  
    4444
    4545void serial_puts(char *str);
    46 void serial_goto(const unsigned int row, const unsigned int col);
     46void serial_goto(const unsigned int col, const unsigned int row);
    4747void serial_clrscr(void);
    4848void serial_scroll(int i);
Note: See TracChangeset for help on using the changeset viewer.