Changeset 8dc12ac in mainline for uspace/srv/fb/serial_console.c


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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 */
Note: See TracChangeset for help on using the changeset viewer.