Subversion Repositories HelenOS-historic

Rev

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

Rev 1555 Rev 1558
Line 264... Line 264...
264
 
264
 
265
 
265
 
266
/***************************************************************/
266
/***************************************************************/
267
/* Character-console functions */
267
/* Character-console functions */
268
 
268
 
269
/** Draw character at given position */
269
/** Draw character at given position
-
 
270
 *
-
 
271
 * @param vp Viewport where the character is printed
-
 
272
 * @param sx Coordinates of top-left of the character
-
 
273
 * @param sy Coordinates of top-left of the character
-
 
274
 * @param style Color of the character
-
 
275
 * @param transparent If false, print background color
-
 
276
 */
270
static void draw_glyph(int vp,__u8 glyph, unsigned int sx, unsigned int sy, style_t style)
277
static void draw_glyph(int vp,__u8 glyph, unsigned int sx, unsigned int sy,
-
 
278
               style_t style, int transparent)
271
{
279
{
272
    int i;
280
    int i;
273
    unsigned int y;
281
    unsigned int y;
274
    unsigned int glline;
282
    unsigned int glline;
275
 
283
 
276
    for (y = 0; y < FONT_SCANLINES; y++) {
284
    for (y = 0; y < FONT_SCANLINES; y++) {
277
        glline = fb_font[glyph * FONT_SCANLINES + y];
285
        glline = fb_font[glyph * FONT_SCANLINES + y];
278
        for (i = 0; i < 8; i++) {
286
        for (i = 0; i < 8; i++) {
279
            if (glline & (1 << (7 - i)))
287
            if (glline & (1 << (7 - i)))
280
                putpixel(vp, sx + i, sy + y, style.fg_color);
288
                putpixel(vp, sx + i, sy + y, style.fg_color);
281
            else
289
            else if (!transparent)
282
                putpixel(vp, sx + i, sy + y, style.bg_color);
290
                putpixel(vp, sx + i, sy + y, style.bg_color);
283
        }
291
        }
284
    }
292
    }
285
}
293
}
286
 
294
 
Line 424... Line 432...
424
 *
432
 *
425
 * @param vp Viewport identification
433
 * @param vp Viewport identification
426
 * @param c Character to print
434
 * @param c Character to print
427
 * @param row Screen position relative to viewport
435
 * @param row Screen position relative to viewport
428
 * @param col Screen position relative to viewport
436
 * @param col Screen position relative to viewport
-
 
437
 * @param transparent If false, print background color with character
429
 */
438
 */
430
static void draw_char(int vp, char c, unsigned int row, unsigned int col, style_t style)
439
static void draw_char(int vp, char c, unsigned int row, unsigned int col, style_t style, int transparent)
431
{
440
{
432
    viewport_t *vport = &viewports[vp];
441
    viewport_t *vport = &viewports[vp];
433
 
442
 
434
    /* Optimize - do not hide cursor if we are going to overwrite it */
443
    /* Optimize - do not hide cursor if we are going to overwrite it */
435
    if (vport->cursor_active && vport->cursor_shown &&
444
    if (vport->cursor_active && vport->cursor_shown &&
436
        (vport->cur_col != col || vport->cur_row != row))
445
        (vport->cur_col != col || vport->cur_row != row))
437
        invert_char(vp, vport->cur_row, vport->cur_col);
446
        invert_char(vp, vport->cur_row, vport->cur_col);
438
   
447
   
439
    draw_glyph(vp, c, col * COL_WIDTH, row * FONT_SCANLINES, style);
448
    draw_glyph(vp, c, col * COL_WIDTH, row * FONT_SCANLINES, style, transparent);
440
 
449
 
441
    vport->cur_col = col;
450
    vport->cur_col = col;
442
    vport->cur_row = row;
451
    vport->cur_row = row;
443
 
452
 
444
    vport->cur_col++;
453
    vport->cur_col++;
Line 467... Line 476...
467
    for (i=0; i < vport->cols * vport->rows; i++) {
476
    for (i=0; i < vport->cols * vport->rows; i++) {
468
        if (data[i].character == ' ' && style_same(data[i].style,vport->style))
477
        if (data[i].character == ' ' && style_same(data[i].style,vport->style))
469
            continue;
478
            continue;
470
        col = i % vport->cols;
479
        col = i % vport->cols;
471
        row = i / vport->cols;
480
        row = i / vport->cols;
472
        draw_glyph(vp, data[i].character, col * COL_WIDTH, row * FONT_SCANLINES, data[i].style);
481
        draw_glyph(vp, data[i].character, col * COL_WIDTH, row * FONT_SCANLINES,
-
 
482
               data[i].style, style_same(data[i].style,vport->style));
473
    }
483
    }
474
    cursor_print(vp);
484
    cursor_print(vp);
475
}
485
}
476
 
486
 
477
 
487
 
Line 776... Line 786...
776
                vport->initialized = 0;
786
                vport->initialized = 0;
777
            ipc_answer_fast(callid,0,0,0);
787
            ipc_answer_fast(callid,0,0,0);
778
            return; /* Exit thread */
788
            return; /* Exit thread */
779
 
789
 
780
        case FB_PUTCHAR:
790
        case FB_PUTCHAR:
-
 
791
        case FB_TRANS_PUTCHAR:
781
            c = IPC_GET_ARG1(call);
792
            c = IPC_GET_ARG1(call);
782
            row = IPC_GET_ARG2(call);
793
            row = IPC_GET_ARG2(call);
783
            col = IPC_GET_ARG3(call);
794
            col = IPC_GET_ARG3(call);
784
            if (row >= vport->rows || col >= vport->cols) {
795
            if (row >= vport->rows || col >= vport->cols) {
785
                retval = EINVAL;
796
                retval = EINVAL;
786
                break;
797
                break;
787
            }
798
            }
788
            ipc_answer_fast(callid,0,0,0);
799
            ipc_answer_fast(callid,0,0,0);
789
 
800
 
790
            draw_char(vp, c, row, col, vport->style);
801
            draw_char(vp, c, row, col, vport->style, IPC_GET_METHOD(call) == FB_TRANS_PUTCHAR);
791
            continue; /* msg already answered */
802
            continue; /* msg already answered */
792
        case FB_CLEAR:
803
        case FB_CLEAR:
793
            clear_port(vp);
804
            clear_port(vp);
794
            cursor_print(vp);
805
            cursor_print(vp);
795
            retval = 0;
806
            retval = 0;