Subversion Repositories HelenOS

Rev

Rev 4226 | Rev 4233 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4226 Rev 4232
Line 386... Line 386...
386
 */
386
 */
387
static void vport_scroll(viewport_t *vport, int lines)
387
static void vport_scroll(viewport_t *vport, int lines)
388
{
388
{
389
    unsigned int row, col;
389
    unsigned int row, col;
390
    unsigned int x, y;
390
    unsigned int x, y;
391
    uint8_t glyph;
391
    uint32_t glyph;
392
    uint32_t fg_color;
392
    uint32_t fg_color;
393
    uint32_t bg_color;
393
    uint32_t bg_color;
394
    bb_cell_t *bbp, *xbp;
394
    bb_cell_t *bbp, *xbp;
395
 
395
 
396
    /*
396
    /*
Line 463... Line 463...
463
        for (y = 0; y < FONT_SCANLINES; y++) {
463
        for (y = 0; y < FONT_SCANLINES; y++) {
464
            unsigned int x;
464
            unsigned int x;
465
           
465
           
466
            for (x = 0; x < FONT_WIDTH; x++) {
466
            for (x = 0; x < FONT_WIDTH; x++) {
467
                screen.rgb_conv(&vport->glyphs[GLYPH_POS(glyph, y, false) + x * screen.pixelbytes],
467
                screen.rgb_conv(&vport->glyphs[GLYPH_POS(glyph, y, false) + x * screen.pixelbytes],
468
                    (fb_font[glyph * FONT_SCANLINES + y] & (1 << (7 - x)))
468
                    (fb_font[glyph][y] & (1 << (7 - x)))
469
                    ? 0xffffff : 0x000000);
469
                    ? 0xffffff : 0x000000);
470
               
470
               
471
                screen.rgb_conv(&vport->glyphs[GLYPH_POS(glyph, y, true) + x * screen.pixelbytes],
471
                screen.rgb_conv(&vport->glyphs[GLYPH_POS(glyph, y, true) + x * screen.pixelbytes],
472
                    (fb_font[glyph * FONT_SCANLINES + y] & (1 << (7 - x)))
472
                    (fb_font[glyph][y] & (1 << (7 - x)))
473
                    ? 0x000000 : 0xffffff);
473
                    ? 0x000000 : 0xffffff);
474
            }
474
            }
475
        }
475
        }
476
    }
476
    }
477
   
477
   
Line 667... Line 667...
667
    unsigned long fg_buf, bg_buf;
667
    unsigned long fg_buf, bg_buf;
668
    unsigned long *maskp, *dp;
668
    unsigned long *maskp, *dp;
669
    unsigned long mask;
669
    unsigned long mask;
670
    unsigned int ww, d_add;
670
    unsigned int ww, d_add;
671
 
671
 
672
    /* Check glyph range. */
-
 
673
    if (glyph >= FONT_GLYPHS)
-
 
674
        glyph = GLYPH_UNAVAIL;
-
 
675
 
-
 
676
    /*
672
    /*
677
     * Prepare a pair of words, one filled with foreground-color
673
     * Prepare a pair of words, one filled with foreground-color
678
     * pattern and the other filled with background-color pattern.
674
     * pattern and the other filled with background-color pattern.
679
     */
675
     */
680
    for (i = 0; i < sizeof(unsigned long) / screen.pixelbytes; i++) {
676
    for (i = 0; i < sizeof(unsigned long) / screen.pixelbytes; i++) {
Line 731... Line 727...
731
    uint8_t fg_buf[4], bg_buf[4];
727
    uint8_t fg_buf[4], bg_buf[4];
732
    uint8_t *dp, *sp;
728
    uint8_t *dp, *sp;
733
    unsigned int d_add;
729
    unsigned int d_add;
734
    uint8_t b;
730
    uint8_t b;
735
 
731
 
736
    /* Check glyph range. */
-
 
737
    if (glyph >= FONT_GLYPHS)
-
 
738
        glyph = GLYPH_UNAVAIL;
-
 
739
 
-
 
740
    /* Pre-render 1x the foreground and background color pixels. */
732
    /* Pre-render 1x the foreground and background color pixels. */
741
    if (cursor) {
733
    if (cursor) {
742
        screen.rgb_conv(fg_buf, bg_color);
734
        screen.rgb_conv(fg_buf, bg_color);
743
        screen.rgb_conv(bg_buf, fg_color);
735
        screen.rgb_conv(bg_buf, fg_color);
744
    } else {
736
    } else {
Line 752... Line 744...
752
    /* Offset to add when moving to another screen scanline. */
744
    /* Offset to add when moving to another screen scanline. */
753
    d_add = screen.scanline - FONT_WIDTH * screen.pixelbytes;
745
    d_add = screen.scanline - FONT_WIDTH * screen.pixelbytes;
754
 
746
 
755
    for (yd = 0; yd < FONT_SCANLINES; yd++) {
747
    for (yd = 0; yd < FONT_SCANLINES; yd++) {
756
        /* Byte containing bits of the glyph scanline. */
748
        /* Byte containing bits of the glyph scanline. */
757
        b = fb_font[glyph * FONT_SCANLINES + yd];
749
        b = fb_font[glyph][yd];
758
 
750
 
759
        for (i = 0; i < FONT_WIDTH; i++) {
751
        for (i = 0; i < FONT_WIDTH; i++) {
760
            /* Choose color based on the current bit. */
752
            /* Choose color based on the current bit. */
761
            sp = (b & 0x80) ? fg_buf : bg_buf;
753
            sp = (b & 0x80) ? fg_buf : bg_buf;
762
 
754
 
Line 853... Line 845...
853
    if ((vport->cursor_active) && (vport->cursor_shown) &&
845
    if ((vport->cursor_active) && (vport->cursor_shown) &&
854
        ((vport->cur_col != col) || (vport->cur_row != row)))
846
        ((vport->cur_col != col) || (vport->cur_row != row)))
855
        cursor_hide(vport);
847
        cursor_hide(vport);
856
 
848
 
857
    bbp = &vport->backbuf[BB_POS(vport, col, row)];
849
    bbp = &vport->backbuf[BB_POS(vport, col, row)];
858
    bbp->glyph = (uint32_t) c;
850
    bbp->glyph = fb_font_glyph(c);
859
    bbp->fg_color = vport->attr.fg_color;
851
    bbp->fg_color = vport->attr.fg_color;
860
    bbp->bg_color = vport->attr.bg_color;
852
    bbp->bg_color = vport->attr.bg_color;
861
 
853
 
862
    draw_vp_glyph(vport, false, col, row);
854
    draw_vp_glyph(vport, false, col, row);
863
   
855
   
Line 896... Line 888...
896
        for (i = 0; i < w; i++) {
888
        for (i = 0; i < w; i++) {
897
            unsigned int col = x + i;
889
            unsigned int col = x + i;
898
            unsigned int row = y + j;
890
            unsigned int row = y + j;
899
 
891
 
900
            bbp = &vport->backbuf[BB_POS(vport, col, row)];
892
            bbp = &vport->backbuf[BB_POS(vport, col, row)];
901
            uint32_t glyph = bbp->glyph;
-
 
902
 
893
 
903
            a = &data[j * w + i].attrs;
894
            a = &data[j * w + i].attrs;
904
            rgb_from_attr(&rgb, a);
895
            rgb_from_attr(&rgb, a);
905
 
896
 
906
            bbp->glyph = data[j * w + i].character;
897
            bbp->glyph = fb_font_glyph(data[j * w + i].character);
907
            bbp->fg_color = rgb.fg_color;
898
            bbp->fg_color = rgb.fg_color;
908
            bbp->bg_color = rgb.bg_color;
899
            bbp->bg_color = rgb.bg_color;
909
 
900
 
910
            draw_vp_glyph(vport, false, col, row);
901
            draw_vp_glyph(vport, false, col, row);
911
        }
902
        }
Line 1517... Line 1508...
1517
        ipc_callid_t callid;
1508
        ipc_callid_t callid;
1518
        ipc_call_t call;
1509
        ipc_call_t call;
1519
        int retval;
1510
        int retval;
1520
        unsigned int i;
1511
        unsigned int i;
1521
        int scroll;
1512
        int scroll;
1522
        uint32_t glyph;
1513
        wchar_t ch;
1523
        unsigned int row, col;
1514
        unsigned int row, col;
1524
       
1515
       
1525
        if ((vport->cursor_active) || (anims_enabled))
1516
        if ((vport->cursor_active) || (anims_enabled))
1526
            callid = async_get_call_timeout(&call, 250000);
1517
            callid = async_get_call_timeout(&call, 250000);
1527
        else
1518
        else
Line 1554... Line 1545...
1554
           
1545
           
1555
            /* Exit thread */
1546
            /* Exit thread */
1556
            return;
1547
            return;
1557
       
1548
       
1558
        case FB_PUTCHAR:
1549
        case FB_PUTCHAR:
1559
            glyph = IPC_GET_ARG1(call);
1550
            ch = IPC_GET_ARG1(call);
1560
            row = IPC_GET_ARG2(call);
1551
            row = IPC_GET_ARG2(call);
1561
            col = IPC_GET_ARG3(call);
1552
            col = IPC_GET_ARG3(call);
1562
           
1553
           
1563
            if ((col >= vport->cols) || (row >= vport->rows)) {
1554
            if ((col >= vport->cols) || (row >= vport->rows)) {
1564
                retval = EINVAL;
1555
                retval = EINVAL;
1565
                break;
1556
                break;
1566
            }
1557
            }
1567
            ipc_answer_0(callid, EOK);
1558
            ipc_answer_0(callid, EOK);
1568
           
1559
           
1569
            draw_char(vport, glyph, col, row);
1560
            draw_char(vport, ch, col, row);
1570
           
1561
           
1571
            /* Message already answered */
1562
            /* Message already answered */
1572
            continue;
1563
            continue;
1573
        case FB_CLEAR:
1564
        case FB_CLEAR:
1574
            vport_clear(vport);
1565
            vport_clear(vport);