Subversion Repositories HelenOS

Rev

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

Rev 4263 Rev 4327
Line 28... Line 28...
28
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
 */
29
 */
30
 
30
 
31
/**
31
/**
32
 * @defgroup fb Graphical framebuffer
32
 * @defgroup fb Graphical framebuffer
33
 * @brief   HelenOS graphical framebuffer.
33
 * @brief HelenOS graphical framebuffer.
34
 * @ingroup fbs
34
 * @ingroup fbs
35
 * @{
35
 * @{
36
 */
36
 */
37
 
37
 
38
/** @file
38
/** @file
Line 66... Line 66...
66
#include "pointer_mask.xbm"
66
#include "pointer_mask.xbm"
67
 
67
 
68
#define DEFAULT_BGCOLOR  0xf0f0f0
68
#define DEFAULT_BGCOLOR  0xf0f0f0
69
#define DEFAULT_FGCOLOR  0x000000
69
#define DEFAULT_FGCOLOR  0x000000
70
 
70
 
71
#define GLYPH_UNAVAIL   '?'
71
#define GLYPH_UNAVAIL    '?'
72
 
72
 
73
#define MAX_ANIM_LEN     8
73
#define MAX_ANIM_LEN     8
74
#define MAX_ANIMATIONS   4
74
#define MAX_ANIMATIONS   4
75
#define MAX_PIXMAPS      256  /**< Maximum number of saved pixmaps */
75
#define MAX_PIXMAPS      256  /**< Maximum number of saved pixmaps */
76
#define MAX_VIEWPORTS    128  /**< Viewport is a rectangular area on the screen */
76
#define MAX_VIEWPORTS    128  /**< Viewport is a rectangular area on the screen */
77
 
77
 
78
/** Function to render a pixel from a RGB value. */
78
/** Function to render a pixel from a RGB value. */
79
typedef void (*rgb_conv_t)(void *, uint32_t);
79
typedef void (*rgb_conv_t)(void *, uint32_t);
80
 
80
 
-
 
81
/** Function to render a bit mask. */
-
 
82
typedef void (*mask_conv_t)(void *, bool);
-
 
83
 
81
/** Function to draw a glyph. */
84
/** Function to draw a glyph. */
82
typedef void (*dg_t)(unsigned int x, unsigned int y, bool cursor,
85
typedef void (*dg_t)(unsigned int x, unsigned int y, bool cursor,
83
    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color);
86
    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color);
84
 
87
 
85
struct {
88
struct {
Line 91... Line 94...
91
    unsigned int scanline;
94
    unsigned int scanline;
92
    unsigned int glyphscanline;
95
    unsigned int glyphscanline;
93
   
96
   
94
    unsigned int pixelbytes;
97
    unsigned int pixelbytes;
95
    unsigned int glyphbytes;
98
    unsigned int glyphbytes;
96
 
99
   
97
    /** Pre-rendered mask for rendering glyphs. Specific for the visual. */
100
    /** Pre-rendered mask for rendering glyphs. Specific for the visual. */
98
    uint8_t *glyphs;
101
    uint8_t *glyphs;
99
   
102
   
100
    rgb_conv_t rgb_conv;
103
    rgb_conv_t rgb_conv;
-
 
104
    mask_conv_t mask_conv;
101
} screen;
105
} screen;
102
 
106
 
103
/** Backbuffer character cell. */
107
/** Backbuffer character cell. */
104
typedef struct {
108
typedef struct {
105
    uint32_t glyph;
109
    uint32_t glyph;
Line 119... Line 123...
119
    unsigned int rows;
123
    unsigned int rows;
120
   
124
   
121
    /*
125
    /*
122
     * Style and glyphs for text printing
126
     * Style and glyphs for text printing
123
     */
127
     */
124
 
128
   
125
    /** Current attributes. */
129
    /** Current attributes. */
126
    attr_rgb_t attr;
130
    attr_rgb_t attr;
127
 
131
   
128
    uint8_t *bgpixel;
132
    uint8_t *bgpixel;
129
 
133
   
130
    /**
134
    /**
131
     * Glyph drawing function for this viewport.  Different viewports
135
     * Glyph drawing function for this viewport.  Different viewports
132
     * might use different drawing functions depending on whether their
136
     * might use different drawing functions depending on whether their
133
     * scanlines are aligned on a word boundary.
137
     * scanlines are aligned on a word boundary.
134
     */
138
     */
Line 168... Line 172...
168
static viewport_t viewports[128];
172
static viewport_t viewports[128];
169
 
173
 
170
static bool client_connected = false;  /**< Allow only 1 connection */
174
static bool client_connected = false;  /**< Allow only 1 connection */
171
 
175
 
172
static uint32_t color_table[16] = {
176
static uint32_t color_table[16] = {
173
    [COLOR_BLACK]       = 0x000000,
177
    [COLOR_BLACK]       = 0x000000,
174
    [COLOR_BLUE]        = 0x0000f0,
178
    [COLOR_BLUE]        = 0x0000f0,
175
    [COLOR_GREEN]       = 0x00f000,
179
    [COLOR_GREEN]       = 0x00f000,
176
    [COLOR_CYAN]        = 0x00f0f0,
180
    [COLOR_CYAN]        = 0x00f0f0,
177
    [COLOR_RED]     = 0xf00000,
181
    [COLOR_RED]         = 0xf00000,
178
    [COLOR_MAGENTA]     = 0xf000f0,
182
    [COLOR_MAGENTA]     = 0xf000f0,
179
    [COLOR_YELLOW]      = 0xf0f000,
183
    [COLOR_YELLOW]      = 0xf0f000,
180
    [COLOR_WHITE]       = 0xf0f0f0,
184
    [COLOR_WHITE]       = 0xf0f0f0,
181
 
185
   
182
    [8 + COLOR_BLACK]   = 0x000000,
186
    [8 + COLOR_BLACK]   = 0x000000,
183
    [8 + COLOR_BLUE]    = 0x0000ff,
187
    [8 + COLOR_BLUE]    = 0x0000ff,
184
    [8 + COLOR_GREEN]   = 0x00ff00,
188
    [8 + COLOR_GREEN]   = 0x00ff00,
185
    [8 + COLOR_CYAN]    = 0x00ffff,
189
    [8 + COLOR_CYAN]    = 0x00ffff,
186
    [8 + COLOR_RED]     = 0xff0000,
190
    [8 + COLOR_RED]     = 0xff0000,
187
    [8 + COLOR_MAGENTA] = 0xff00ff,
191
    [8 + COLOR_MAGENTA] = 0xff00ff,
188
    [8 + COLOR_YELLOW]  = 0xffff00,
192
    [8 + COLOR_YELLOW]  = 0xffff00,
189
    [8 + COLOR_WHITE]   = 0xffffff,
193
    [8 + COLOR_WHITE]   = 0xffffff,
190
};
194
};
191
 
195
 
192
static int rgb_from_attr(attr_rgb_t *rgb, const attrs_t *a);
196
static int rgb_from_attr(attr_rgb_t *rgb, const attrs_t *a);
193
static int rgb_from_style(attr_rgb_t *rgb, int style);
197
static int rgb_from_style(attr_rgb_t *rgb, int style);
194
static int rgb_from_idx(attr_rgb_t *rgb, ipcarg_t fg_color,
198
static int rgb_from_idx(attr_rgb_t *rgb, ipcarg_t fg_color,
Line 224... Line 228...
224
/** ARGB 8:8:8:8 conversion
228
/** ARGB 8:8:8:8 conversion
225
 *
229
 *
226
 */
230
 */
227
static void rgb_0888(void *dst, uint32_t rgb)
231
static void rgb_0888(void *dst, uint32_t rgb)
228
{
232
{
229
    *((uint32_t *) dst) = rgb & 0xffffff;
233
    *((uint32_t *) dst) = rgb & 0x00ffffff;
-
 
234
}
-
 
235
 
-
 
236
static void mask_0888(void *dst, bool mask)
-
 
237
{
-
 
238
    *((uint32_t *) dst) = (mask ? 0x00ffffff : 0);
230
}
239
}
231
 
240
 
232
 
241
 
233
/** ABGR 8:8:8:8 conversion
242
/** ABGR 8:8:8:8 conversion
234
 *
243
 *
Line 248... Line 257...
248
    ((uint8_t *) dst)[0] = BLUE(rgb, 8);
257
    ((uint8_t *) dst)[0] = BLUE(rgb, 8);
249
    ((uint8_t *) dst)[1] = GREEN(rgb, 8);
258
    ((uint8_t *) dst)[1] = GREEN(rgb, 8);
250
    ((uint8_t *) dst)[2] = RED(rgb, 8);
259
    ((uint8_t *) dst)[2] = RED(rgb, 8);
251
}
260
}
252
 
261
 
-
 
262
static void mask_888(void *dst, bool mask)
-
 
263
{
-
 
264
    if (mask) {
-
 
265
        ((uint8_t *) dst)[0] = 0xff;
-
 
266
        ((uint8_t *) dst)[1] = 0xff;
-
 
267
        ((uint8_t *) dst)[2] = 0xff;
-
 
268
    } else {
-
 
269
        ((uint8_t *) dst)[0] = 0;
-
 
270
        ((uint8_t *) dst)[1] = 0;
-
 
271
        ((uint8_t *) dst)[2] = 0;
-
 
272
    }
-
 
273
}
-
 
274
 
253
 
275
 
254
/** BGR 8:8:8 conversion
276
/** BGR 8:8:8 conversion
255
 *
277
 *
256
 */
278
 */
257
static void bgr_888(void *dst, uint32_t rgb)
279
static void bgr_888(void *dst, uint32_t rgb)
Line 269... Line 291...
269
{
291
{
270
    *((uint16_t *) dst)
292
    *((uint16_t *) dst)
271
        = (RED(rgb, 5) << 10) | (GREEN(rgb, 5) << 5) | BLUE(rgb, 5);
293
        = (RED(rgb, 5) << 10) | (GREEN(rgb, 5) << 5) | BLUE(rgb, 5);
272
}
294
}
273
 
295
 
-
 
296
static void mask_555(void *dst, bool mask)
-
 
297
{
-
 
298
    *((uint16_t *) dst) = (mask ? 0x7fff : 0);
-
 
299
}
-
 
300
 
274
 
301
 
275
/** RGB 5:6:5 conversion
302
/** RGB 5:6:5 conversion
276
 *
303
 *
277
 */
304
 */
278
static void rgb_565(void *dst, uint32_t rgb)
305
static void rgb_565(void *dst, uint32_t rgb)
279
{
306
{
280
    *((uint16_t *) dst)
307
    *((uint16_t *) dst)
281
        = (RED(rgb, 5) << 11) | (GREEN(rgb, 6) << 5) | BLUE(rgb, 5);
308
        = (RED(rgb, 5) << 11) | (GREEN(rgb, 6) << 5) | BLUE(rgb, 5);
282
}
309
}
283
 
310
 
-
 
311
static void mask_565(void *dst, bool mask)
-
 
312
{
-
 
313
    *((uint16_t *) dst) = (mask ? 0xffff : 0);
-
 
314
}
-
 
315
 
284
 
316
 
285
/** RGB 3:2:3
317
/** RGB 3:2:3
286
 *
318
 *
287
 */
319
 */
288
static void rgb_323(void *dst, uint32_t rgb)
320
static void rgb_323(void *dst, uint32_t rgb)
289
{
321
{
290
    *((uint8_t *) dst)
322
    *((uint8_t *) dst)
291
        = ~((RED(rgb, 3) << 5) | (GREEN(rgb, 2) << 3) | BLUE(rgb, 3));
323
        = ~((RED(rgb, 3) << 5) | (GREEN(rgb, 2) << 3) | BLUE(rgb, 3));
292
}
324
}
293
 
325
 
-
 
326
static void mask_323(void *dst, bool mask)
-
 
327
{
-
 
328
    *((uint8_t *) dst) = (mask ? 0xff : 0);
-
 
329
}
-
 
330
 
294
/** Draw a filled rectangle.
331
/** Draw a filled rectangle.
295
 *
332
 *
296
 * @note Need real implementation that does not access VRAM twice.
333
 * @note Need real implementation that does not access VRAM twice.
-
 
334
 *
297
 */
335
 */
298
static void draw_filled_rect(unsigned int x0, unsigned int y0, unsigned int x1,
336
static void draw_filled_rect(unsigned int x0, unsigned int y0, unsigned int x1,
299
    unsigned int y1, uint32_t color)
337
    unsigned int y1, uint32_t color)
300
{
338
{
-
 
339
    unsigned int x;
301
    unsigned int x, y;
340
    unsigned int y;
302
    unsigned int copy_bytes;
341
    unsigned int copy_bytes;
303
 
342
   
304
    uint8_t *sp, *dp;
343
    uint8_t *sp;
-
 
344
    uint8_t *dp;
305
    uint8_t cbuf[4];
345
    uint8_t cbuf[4];
306
 
346
   
307
    if (y0 >= y1 || x0 >= x1) return;
347
    if ((y0 >= y1) || (x0 >= x1))
-
 
348
        return;
-
 
349
   
308
    screen.rgb_conv(cbuf, color);
350
    screen.rgb_conv(cbuf, color);
309
 
351
   
310
    sp = &screen.fb_addr[FB_POS(x0, y0)];
352
    sp = &screen.fb_addr[FB_POS(x0, y0)];
311
    dp = sp;
353
    dp = sp;
312
 
354
   
313
    /* Draw the first line. */
355
    /* Draw the first line. */
314
    for (x = x0; x < x1; x++) {
356
    for (x = x0; x < x1; x++) {
315
        memcpy(dp, cbuf, screen.pixelbytes);
357
        memcpy(dp, cbuf, screen.pixelbytes);
316
        dp += screen.pixelbytes;
358
        dp += screen.pixelbytes;
317
    }
359
    }
318
 
360
   
319
    dp = sp + screen.scanline;
361
    dp = sp + screen.scanline;
320
    copy_bytes = (x1 - x0) * screen.pixelbytes;
362
    copy_bytes = (x1 - x0) * screen.pixelbytes;
321
 
363
   
322
    /* Draw the remaining lines by copying. */
364
    /* Draw the remaining lines by copying. */
323
    for (y = y0 + 1; y < y1; y++) {
365
    for (y = y0 + 1; y < y1; y++) {
324
        memcpy(dp, sp, copy_bytes);
366
        memcpy(dp, sp, copy_bytes);
325
        dp += screen.scanline;
367
        dp += screen.scanline;
326
    }
368
    }
Line 331... Line 373...
331
 * @param vport Viewport to redraw
373
 * @param vport Viewport to redraw
332
 *
374
 *
333
 */
375
 */
334
static void vport_redraw(viewport_t *vport)
376
static void vport_redraw(viewport_t *vport)
335
{
377
{
-
 
378
    unsigned int row;
336
    unsigned int row, col;
379
    unsigned int col;
337
 
380
   
338
    for (row = 0; row < vport->rows; row++) {
381
    for (row = 0; row < vport->rows; row++) {
339
        for (col = 0; col < vport->cols; col++) {
382
        for (col = 0; col < vport->cols; col++) {
340
            draw_vp_glyph(vport, false, col, row);
383
            draw_vp_glyph(vport, false, col, row);
341
        }
384
        }
342
    }
385
    }
343
 
386
   
344
    if (COL2X(vport->cols) < vport->width) {
387
    if (COL2X(vport->cols) < vport->width) {
345
        draw_filled_rect(
388
        draw_filled_rect(
346
            vport->x + COL2X(vport->cols), vport->y,
389
            vport->x + COL2X(vport->cols), vport->y,
347
            vport->x + vport->width, vport->y + vport->height,
390
            vport->x + vport->width, vport->y + vport->height,
348
            vport->attr.bg_color);
391
            vport->attr.bg_color);
349
    }
392
    }
350
 
393
   
351
    if (ROW2Y(vport->rows) < vport->height) {
394
    if (ROW2Y(vport->rows) < vport->height) {
352
        draw_filled_rect(
395
        draw_filled_rect(
353
            vport->x, vport->y + ROW2Y(vport->rows),
396
            vport->x, vport->y + ROW2Y(vport->rows),
354
            vport->x + vport->width, vport->y + vport->height,
397
            vport->x + vport->width, vport->y + vport->height,
355
            vport->attr.bg_color);
398
            vport->attr.bg_color);
Line 357... Line 400...
357
}
400
}
358
 
401
 
359
static void backbuf_clear(bb_cell_t *backbuf, size_t len, uint32_t fg_color,
402
static void backbuf_clear(bb_cell_t *backbuf, size_t len, uint32_t fg_color,
360
    uint32_t bg_color)
403
    uint32_t bg_color)
361
{
404
{
362
    unsigned i;
405
    size_t i;
363
 
406
   
364
    for (i = 0; i < len; i++) {
407
    for (i = 0; i < len; i++) {
365
        backbuf[i].glyph = 0;
408
        backbuf[i].glyph = 0;
366
        backbuf[i].fg_color = fg_color;
409
        backbuf[i].fg_color = fg_color;
367
        backbuf[i].bg_color = bg_color;
410
        backbuf[i].bg_color = bg_color;
368
    }
411
    }
Line 386... Line 429...
386
 * @param lines Number of lines to scroll
429
 * @param lines Number of lines to scroll
387
 *
430
 *
388
 */
431
 */
389
static void vport_scroll(viewport_t *vport, int lines)
432
static void vport_scroll(viewport_t *vport, int lines)
390
{
433
{
-
 
434
    unsigned int row;
391
    unsigned int row, col;
435
    unsigned int col;
-
 
436
    unsigned int x;
392
    unsigned int x, y;
437
    unsigned int y;
393
    uint32_t glyph;
438
    uint32_t glyph;
394
    uint32_t fg_color;
439
    uint32_t fg_color;
395
    uint32_t bg_color;
440
    uint32_t bg_color;
-
 
441
    bb_cell_t *bbp;
396
    bb_cell_t *bbp, *xbp;
442
    bb_cell_t *xbp;
397
 
443
   
398
    /*
444
    /*
399
     * Redraw.
445
     * Redraw.
400
     */
446
     */
401
 
447
   
402
    y = vport->y;
448
    y = vport->y;
403
    for (row = 0; row < vport->rows; row++) {
449
    for (row = 0; row < vport->rows; row++) {
404
        x = vport->x;
450
        x = vport->x;
405
        for (col = 0; col < vport->cols; col++) {
451
        for (col = 0; col < vport->cols; col++) {
406
            if ((row + lines >= 0) && (row + lines < vport->rows)) {
452
            if ((row + lines >= 0) && (row + lines < vport->rows)) {
407
                xbp = &vport->backbuf[BB_POS(vport, col, row + lines)];
453
                xbp = &vport->backbuf[BB_POS(vport, col, row + lines)];
408
                bbp = &vport->backbuf[BB_POS(vport, col, row)];
454
                bbp = &vport->backbuf[BB_POS(vport, col, row)];
409
 
455
               
410
                glyph = xbp->glyph;
456
                glyph = xbp->glyph;
411
                fg_color = xbp->fg_color;
457
                fg_color = xbp->fg_color;
412
                bg_color = xbp->bg_color;
458
                bg_color = xbp->bg_color;
413
 
459
               
414
                if (bbp->glyph == glyph &&
460
                if ((bbp->glyph == glyph)
415
                    bbp->fg_color == xbp->fg_color &&
461
                   && (bbp->fg_color == xbp->fg_color)
416
                    bbp->bg_color == xbp->bg_color) {
462
                   && (bbp->bg_color == xbp->bg_color)) {
417
                    x += FONT_WIDTH;
463
                    x += FONT_WIDTH;
418
                    continue;
464
                    continue;
419
                }
465
                }
420
            } else {
466
            } else {
421
                glyph = 0;
467
                glyph = 0;
422
                fg_color = vport->attr.fg_color;
468
                fg_color = vport->attr.fg_color;
423
                bg_color = vport->attr.bg_color;
469
                bg_color = vport->attr.bg_color;
424
            }
470
            }
425
 
471
           
426
            (*vport->dglyph)(x, y, false, screen.glyphs, glyph,
472
            (*vport->dglyph)(x, y, false, screen.glyphs, glyph,
427
                fg_color, bg_color);
473
                fg_color, bg_color);
428
            x += FONT_WIDTH;
474
            x += FONT_WIDTH;
429
        }
475
        }
430
        y += FONT_SCANLINES;
476
        y += FONT_SCANLINES;
431
    }
477
    }
432
 
478
   
433
    /*
479
    /*
434
     * Scroll backbuffer.
480
     * Scroll backbuffer.
435
     */
481
     */
436
 
482
   
437
    if (lines > 0) {
483
    if (lines > 0) {
438
        memmove(vport->backbuf, vport->backbuf + vport->cols * lines,
484
        memmove(vport->backbuf, vport->backbuf + vport->cols * lines,
439
            vport->cols * (vport->rows - lines) * sizeof(bb_cell_t));
485
            vport->cols * (vport->rows - lines) * sizeof(bb_cell_t));
440
        backbuf_clear(&vport->backbuf[BB_POS(vport, 0, vport->rows - lines)],
486
        backbuf_clear(&vport->backbuf[BB_POS(vport, 0, vport->rows - lines)],
441
            vport->cols * lines, vport->attr.fg_color, vport->attr.bg_color);
487
            vport->cols * lines, vport->attr.fg_color, vport->attr.bg_color);
Line 449... Line 495...
449
 
495
 
450
/** Render glyphs
496
/** Render glyphs
451
 *
497
 *
452
 * Convert glyphs from device independent font
498
 * Convert glyphs from device independent font
453
 * description to current visual representation.
499
 * description to current visual representation.
-
 
500
 *
454
 */
501
 */
455
static void render_glyphs(void)
502
static void render_glyphs(void)
456
{
503
{
457
    unsigned int glyph;
504
    unsigned int glyph;
458
 
505
   
459
    for (glyph = 0; glyph < FONT_GLYPHS; glyph++) {
506
    for (glyph = 0; glyph < FONT_GLYPHS; glyph++) {
460
        unsigned int y;
507
        unsigned int y;
461
 
508
       
462
        for (y = 0; y < FONT_SCANLINES; y++) {
509
        for (y = 0; y < FONT_SCANLINES; y++) {
463
            unsigned int x;
510
            unsigned int x;
464
 
511
           
465
            for (x = 0; x < FONT_WIDTH; x++) {
512
            for (x = 0; x < FONT_WIDTH; x++) {
466
                screen.rgb_conv(&screen.glyphs[GLYPH_POS(glyph, y, false) + x * screen.pixelbytes],
513
                screen.mask_conv(&screen.glyphs[GLYPH_POS(glyph, y, false) + x * screen.pixelbytes],
467
                    (fb_font[glyph][y] & (1 << (7 - x)))
514
                    (fb_font[glyph][y] & (1 << (7 - x))) ? true : false);
468
                    ? 0xffffff : 0x000000);
-
 
469
 
515
               
470
                screen.rgb_conv(&screen.glyphs[GLYPH_POS(glyph, y, true) + x * screen.pixelbytes],
516
                screen.mask_conv(&screen.glyphs[GLYPH_POS(glyph, y, true) + x * screen.pixelbytes],
471
                    (fb_font[glyph][y] & (1 << (7 - x)))
517
                    (fb_font[glyph][y] & (1 << (7 - x))) ? false : true);
472
                    ? 0x000000 : 0xffffff);
-
 
473
            }
518
            }
474
        }
519
        }
475
    }
520
    }
476
}
521
}
477
 
522
 
478
 
-
 
479
/** Create new viewport
523
/** Create new viewport
480
 *
524
 *
481
 * @param x      Origin of the viewport (x).
525
 * @param x      Origin of the viewport (x).
482
 * @param y      Origin of the viewport (y).
526
 * @param y      Origin of the viewport (y).
483
 * @param width  Width of the viewport.
527
 * @param width  Width of the viewport.
Line 493... Line 537...
493
   
537
   
494
    for (i = 0; i < MAX_VIEWPORTS; i++) {
538
    for (i = 0; i < MAX_VIEWPORTS; i++) {
495
        if (!viewports[i].initialized)
539
        if (!viewports[i].initialized)
496
            break;
540
            break;
497
    }
541
    }
-
 
542
   
498
    if (i == MAX_VIEWPORTS)
543
    if (i == MAX_VIEWPORTS)
499
        return ELIMIT;
544
        return ELIMIT;
500
   
545
   
501
    unsigned int cols = width / FONT_WIDTH;
546
    unsigned int cols = width / FONT_WIDTH;
502
    unsigned int rows = height / FONT_SCANLINES;
547
    unsigned int rows = height / FONT_SCANLINES;
Line 510... Line 555...
510
    uint8_t *bgpixel = (uint8_t *) malloc(screen.pixelbytes);
555
    uint8_t *bgpixel = (uint8_t *) malloc(screen.pixelbytes);
511
    if (!bgpixel) {
556
    if (!bgpixel) {
512
        free(backbuf);
557
        free(backbuf);
513
        return ENOMEM;
558
        return ENOMEM;
514
    }
559
    }
515
 
560
   
516
    backbuf_clear(backbuf, cols * rows, DEFAULT_FGCOLOR, DEFAULT_BGCOLOR);
561
    backbuf_clear(backbuf, cols * rows, DEFAULT_FGCOLOR, DEFAULT_BGCOLOR);
517
    memset(bgpixel, 0, screen.pixelbytes);
562
    memset(bgpixel, 0, screen.pixelbytes);
518
   
563
   
519
    viewports[i].x = x;
564
    viewports[i].x = x;
520
    viewports[i].y = y;
565
    viewports[i].y = y;
Line 526... Line 571...
526
   
571
   
527
    viewports[i].attr.bg_color = DEFAULT_BGCOLOR;
572
    viewports[i].attr.bg_color = DEFAULT_BGCOLOR;
528
    viewports[i].attr.fg_color = DEFAULT_FGCOLOR;
573
    viewports[i].attr.fg_color = DEFAULT_FGCOLOR;
529
   
574
   
530
    viewports[i].bgpixel = bgpixel;
575
    viewports[i].bgpixel = bgpixel;
531
 
576
   
532
    /*
577
    /*
533
     * Conditions necessary  to select aligned version:
578
     * Conditions necessary to select aligned version:
-
 
579
     *  - word size is divisible by pixelbytes
-
 
580
     *  - cell scanline size is divisible by word size
-
 
581
     *  - cell scanlines are word-aligned
534
     *
582
     *
535
     *   - word size is divisible by pixelbytes
-
 
536
     *   - cell scanline size is divisible by word size
-
 
537
     *   - cell scanlines are word-aligned
-
 
538
     */
583
     */
539
    if ((word_size % screen.pixelbytes) == 0 &&
584
    if (((word_size % screen.pixelbytes) == 0)
540
        (FONT_WIDTH * screen.pixelbytes) % word_size == 0 &&
585
        && ((FONT_WIDTH * screen.pixelbytes) % word_size == 0)
541
        (x * screen.pixelbytes) % word_size == 0 &&
586
        && ((x * screen.pixelbytes) % word_size == 0)
542
        screen.scanline % word_size == 0) {
587
        && (screen.scanline % word_size == 0)) {
543
 
-
 
544
        viewports[i].dglyph = draw_glyph_aligned;
588
        viewports[i].dglyph = draw_glyph_aligned;
545
    } else {
589
    } else {
546
        viewports[i].dglyph = draw_glyph_fallback;
590
        viewports[i].dglyph = draw_glyph_fallback;
547
    }
591
    }
548
 
592
   
549
    viewports[i].cur_col = 0;
593
    viewports[i].cur_col = 0;
550
    viewports[i].cur_row = 0;
594
    viewports[i].cur_row = 0;
551
    viewports[i].cursor_active = false;
595
    viewports[i].cursor_active = false;
552
    viewports[i].cursor_shown = false;
596
    viewports[i].cursor_shown = false;
553
   
597
   
Line 572... Line 616...
572
 *
616
 *
573
 */
617
 */
574
static bool screen_init(void *addr, unsigned int xres, unsigned int yres,
618
static bool screen_init(void *addr, unsigned int xres, unsigned int yres,
575
    unsigned int scan, unsigned int visual)
619
    unsigned int scan, unsigned int visual)
576
{
620
{
577
    unsigned int glyphsize;
621
   
578
    uint8_t *glyphs;
622
   
579
    switch (visual) {
623
    switch (visual) {
580
    case VISUAL_INDIRECT_8:
624
    case VISUAL_INDIRECT_8:
581
        screen.rgb_conv = rgb_323;
625
        screen.rgb_conv = rgb_323;
-
 
626
        screen.mask_conv = mask_323;
582
        screen.pixelbytes = 1;
627
        screen.pixelbytes = 1;
583
        break;
628
        break;
584
    case VISUAL_RGB_5_5_5:
629
    case VISUAL_RGB_5_5_5:
585
        screen.rgb_conv = rgb_555;
630
        screen.rgb_conv = rgb_555;
-
 
631
        screen.mask_conv = mask_555;
586
        screen.pixelbytes = 2;
632
        screen.pixelbytes = 2;
587
        break;
633
        break;
588
    case VISUAL_RGB_5_6_5:
634
    case VISUAL_RGB_5_6_5:
589
        screen.rgb_conv = rgb_565;
635
        screen.rgb_conv = rgb_565;
-
 
636
        screen.mask_conv = mask_565;
590
        screen.pixelbytes = 2;
637
        screen.pixelbytes = 2;
591
        break;
638
        break;
592
    case VISUAL_RGB_8_8_8:
639
    case VISUAL_RGB_8_8_8:
593
        screen.rgb_conv = rgb_888;
640
        screen.rgb_conv = rgb_888;
-
 
641
        screen.mask_conv = mask_888;
594
        screen.pixelbytes = 3;
642
        screen.pixelbytes = 3;
595
        break;
643
        break;
596
    case VISUAL_BGR_8_8_8:
644
    case VISUAL_BGR_8_8_8:
597
        screen.rgb_conv = bgr_888;
645
        screen.rgb_conv = bgr_888;
-
 
646
        screen.mask_conv = mask_888;
598
        screen.pixelbytes = 3;
647
        screen.pixelbytes = 3;
599
        break;
648
        break;
600
    case VISUAL_RGB_8_8_8_0:
649
    case VISUAL_RGB_8_8_8_0:
601
        screen.rgb_conv = rgb_888;
650
        screen.rgb_conv = rgb_888;
-
 
651
        screen.mask_conv = mask_888;
602
        screen.pixelbytes = 4;
652
        screen.pixelbytes = 4;
603
        break;
653
        break;
604
    case VISUAL_RGB_0_8_8_8:
654
    case VISUAL_RGB_0_8_8_8:
605
        screen.rgb_conv = rgb_0888;
655
        screen.rgb_conv = rgb_0888;
-
 
656
        screen.mask_conv = mask_0888;
606
        screen.pixelbytes = 4;
657
        screen.pixelbytes = 4;
607
        break;
658
        break;
608
    case VISUAL_BGR_0_8_8_8:
659
    case VISUAL_BGR_0_8_8_8:
609
        screen.rgb_conv = bgr_0888;
660
        screen.rgb_conv = bgr_0888;
-
 
661
        screen.mask_conv = mask_0888;
610
        screen.pixelbytes = 4;
662
        screen.pixelbytes = 4;
611
        break;
663
        break;
612
    default:
664
    default:
613
        return false;
665
        return false;
614
    }
666
    }
615
 
667
   
616
    screen.fb_addr = (unsigned char *) addr;
668
    screen.fb_addr = (unsigned char *) addr;
617
    screen.xres = xres;
669
    screen.xres = xres;
618
    screen.yres = yres;
670
    screen.yres = yres;
619
    screen.scanline = scan;
671
    screen.scanline = scan;
620
   
672
   
621
    screen.glyphscanline = FONT_WIDTH * screen.pixelbytes;
673
    screen.glyphscanline = FONT_WIDTH * screen.pixelbytes;
622
    screen.glyphbytes = screen.glyphscanline * FONT_SCANLINES;
674
    screen.glyphbytes = screen.glyphscanline * FONT_SCANLINES;
623
 
675
   
624
    glyphsize = 2 * FONT_GLYPHS * screen.glyphbytes;
676
    size_t glyphsize = 2 * FONT_GLYPHS * screen.glyphbytes;
625
    glyphs = (uint8_t *) malloc(glyphsize);
677
    uint8_t *glyphs = (uint8_t *) malloc(glyphsize);
626
    if (!glyphs)
678
    if (!glyphs)
627
        return false;
679
        return false;
628
   
680
   
629
    memset(glyphs, 0, glyphsize);
681
    memset(glyphs, 0, glyphsize);
630
    screen.glyphs = glyphs;
682
    screen.glyphs = glyphs;
631
 
683
   
632
    render_glyphs();
684
    render_glyphs();
633
   
685
   
634
    /* Create first viewport */
686
    /* Create first viewport */
635
    vport_create(0, 0, xres, yres);
687
    vport_create(0, 0, xres, yres);
636
   
688
   
Line 649... Line 701...
649
 * It makes use of the pre-rendered mask to process (possibly) several
701
 * It makes use of the pre-rendered mask to process (possibly) several
650
 * pixels at once (word size / pixelbytes pixels at a time are processed)
702
 * pixels at once (word size / pixelbytes pixels at a time are processed)
651
 * making it very fast. Most notably this version is not applicable at 24 bits
703
 * making it very fast. Most notably this version is not applicable at 24 bits
652
 * per pixel.
704
 * per pixel.
653
 *
705
 *
654
 * @param x     x coordinate of top-left corner on screen.
706
 * @param x        x coordinate of top-left corner on screen.
655
 * @param y     y coordinate of top-left corner on screen.
707
 * @param y        y coordinate of top-left corner on screen.
656
 * @param cursor    Draw glyph with cursor
708
 * @param cursor   Draw glyph with cursor
657
 * @param glyphs    Pointer to font bitmap.
709
 * @param glyphs   Pointer to font bitmap.
658
 * @param glyph     Code of the glyph to draw.
710
 * @param glyph    Code of the glyph to draw.
659
 * @param fg_color  Foreground color.
711
 * @param fg_color Foreground color.
660
 * @param bg_color  Backgroudn color.
712
 * @param bg_color Backgroudn color.
-
 
713
 *
661
 */
714
 */
662
static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor,
715
static void draw_glyph_aligned(unsigned int x, unsigned int y, bool cursor,
663
    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
716
    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
664
{
717
{
-
 
718
    unsigned int i;
665
    unsigned int i, yd;
719
    unsigned int yd;
666
    unsigned long fg_buf, bg_buf;
720
    unsigned long fg_buf;
667
    unsigned long *maskp, *dp;
721
    unsigned long bg_buf;
668
    unsigned long mask;
722
    unsigned long mask;
669
    unsigned int ww, d_add;
-
 
670
 
723
   
671
    /*
724
    /*
672
     * Prepare a pair of words, one filled with foreground-color
725
     * Prepare a pair of words, one filled with foreground-color
673
     * pattern and the other filled with background-color pattern.
726
     * pattern and the other filled with background-color pattern.
674
     */
727
     */
675
    for (i = 0; i < sizeof(unsigned long) / screen.pixelbytes; i++) {
728
    for (i = 0; i < sizeof(unsigned long) / screen.pixelbytes; i++) {
676
        screen.rgb_conv(&((uint8_t *)&fg_buf)[i * screen.pixelbytes],
729
        screen.rgb_conv(&((uint8_t *) &fg_buf)[i * screen.pixelbytes],
677
            fg_color);
730
            fg_color);
678
        screen.rgb_conv(&((uint8_t *)&bg_buf)[i * screen.pixelbytes],
731
        screen.rgb_conv(&((uint8_t *) &bg_buf)[i * screen.pixelbytes],
679
            bg_color);
732
            bg_color);
680
    }
733
    }
681
 
734
   
682
    /* Pointer to the current position in the mask. */
735
    /* Pointer to the current position in the mask. */
683
    maskp = (unsigned long *) &glyphs[GLYPH_POS(glyph, 0, cursor)];
736
    unsigned long *maskp = (unsigned long *) &glyphs[GLYPH_POS(glyph, 0, cursor)];
684
 
737
   
685
    /* Pointer to the current position on the screen. */
738
    /* Pointer to the current position on the screen. */
686
    dp = (unsigned long *) &screen.fb_addr[FB_POS(x, y)];
739
    unsigned long *dp = (unsigned long *) &screen.fb_addr[FB_POS(x, y)];
687
 
740
   
688
    /* Width of the character cell in words. */
741
    /* Width of the character cell in words. */
689
    ww = FONT_WIDTH * screen.pixelbytes / sizeof(unsigned long);
742
    unsigned int ww = FONT_WIDTH * screen.pixelbytes / sizeof(unsigned long);
690
 
743
   
691
    /* Offset to add when moving to another screen scanline. */
744
    /* Offset to add when moving to another screen scanline. */
692
    d_add = screen.scanline - FONT_WIDTH * screen.pixelbytes;
745
    unsigned int d_add = screen.scanline - FONT_WIDTH * screen.pixelbytes;
693
 
746
   
694
    for (yd = 0; yd < FONT_SCANLINES; yd++) {
747
    for (yd = 0; yd < FONT_SCANLINES; yd++) {
695
        /*
748
        /*
696
         * Now process the cell scanline, combining foreground
749
         * Now process the cell scanline, combining foreground
697
         * and background color patters using the pre-rendered mask.
750
         * and background color patters using the pre-rendered mask.
698
         */
751
         */
699
        for (i = 0; i < ww; i++) {
752
        for (i = 0; i < ww; i++) {
700
            mask = *maskp++;
753
            mask = *maskp++;
701
            *dp++ = (fg_buf & mask) | (bg_buf & ~mask);
754
            *dp++ = (fg_buf & mask) | (bg_buf & ~mask);
702
        }
755
        }
703
 
756
       
704
        /* Move to the beginning of the next scanline of the cell. */
757
        /* Move to the beginning of the next scanline of the cell. */
705
        dp = (unsigned long *) ((uint8_t *) dp + d_add);
758
        dp = (unsigned long *) ((uint8_t *) dp + d_add);
706
    }
759
    }
707
}
760
}
708
 
761
 
709
/** Draw a glyph, fallback version.
762
/** Draw a glyph, fallback version.
710
 *
763
 *
711
 * This version does not make use of the pre-rendered mask, it uses
764
 * This version does not make use of the pre-rendered mask, it uses
712
 * the font bitmap directly. It works always, but it is slower.
765
 * the font bitmap directly. It works always, but it is slower.
713
 *
766
 *
714
 * @param x     x coordinate of top-left corner on screen.
767
 * @param x        x coordinate of top-left corner on screen.
715
 * @param y     y coordinate of top-left corner on screen.
768
 * @param y        y coordinate of top-left corner on screen.
716
 * @param cursor    Draw glyph with cursor
769
 * @param cursor   Draw glyph with cursor
717
 * @param glyphs    Pointer to font bitmap.
770
 * @param glyphs   Pointer to font bitmap.
718
 * @param glyph     Code of the glyph to draw.
771
 * @param glyph    Code of the glyph to draw.
719
 * @param fg_color  Foreground color.
772
 * @param fg_color Foreground color.
720
 * @param bg_color  Backgroudn color.
773
 * @param bg_color Backgroudn color.
-
 
774
 *
721
 */
775
 */
722
void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor,
776
void draw_glyph_fallback(unsigned int x, unsigned int y, bool cursor,
723
    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
777
    uint8_t *glyphs, uint32_t glyph, uint32_t fg_color, uint32_t bg_color)
724
{
778
{
-
 
779
    unsigned int i;
-
 
780
    unsigned int j;
725
    unsigned int i, j, yd;
781
    unsigned int yd;
726
    uint8_t fg_buf[4], bg_buf[4];
782
    uint8_t fg_buf[4];
727
    uint8_t *dp, *sp;
783
    uint8_t bg_buf[4];
728
    unsigned int d_add;
784
    uint8_t *sp;
729
    uint8_t b;
785
    uint8_t b;
730
 
786
   
731
    /* Pre-render 1x the foreground and background color pixels. */
787
    /* Pre-render 1x the foreground and background color pixels. */
732
    if (cursor) {
788
    if (cursor) {
733
        screen.rgb_conv(fg_buf, bg_color);
789
        screen.rgb_conv(fg_buf, bg_color);
734
        screen.rgb_conv(bg_buf, fg_color);
790
        screen.rgb_conv(bg_buf, fg_color);
735
    } else {
791
    } else {
736
        screen.rgb_conv(fg_buf, fg_color);
792
        screen.rgb_conv(fg_buf, fg_color);
737
        screen.rgb_conv(bg_buf, bg_color);
793
        screen.rgb_conv(bg_buf, bg_color);
738
    }
794
    }
739
 
795
   
740
    /* Pointer to the current position on the screen. */
796
    /* Pointer to the current position on the screen. */
741
    dp = (uint8_t *) &screen.fb_addr[FB_POS(x, y)];
797
    uint8_t *dp = (uint8_t *) &screen.fb_addr[FB_POS(x, y)];
742
 
798
   
743
    /* Offset to add when moving to another screen scanline. */
799
    /* Offset to add when moving to another screen scanline. */
744
    d_add = screen.scanline - FONT_WIDTH * screen.pixelbytes;
800
    unsigned int d_add = screen.scanline - FONT_WIDTH * screen.pixelbytes;
745
 
801
   
746
    for (yd = 0; yd < FONT_SCANLINES; yd++) {
802
    for (yd = 0; yd < FONT_SCANLINES; yd++) {
747
        /* Byte containing bits of the glyph scanline. */
803
        /* Byte containing bits of the glyph scanline. */
748
        b = fb_font[glyph][yd];
804
        b = fb_font[glyph][yd];
749
 
805
       
750
        for (i = 0; i < FONT_WIDTH; i++) {
806
        for (i = 0; i < FONT_WIDTH; i++) {
751
            /* Choose color based on the current bit. */
807
            /* Choose color based on the current bit. */
752
            sp = (b & 0x80) ? fg_buf : bg_buf;
808
            sp = (b & 0x80) ? fg_buf : bg_buf;
753
 
809
           
754
            /* Copy the pixel. */
810
            /* Copy the pixel. */
755
            for (j = 0; j < screen.pixelbytes; j++) {
811
            for (j = 0; j < screen.pixelbytes; j++) {
756
                *dp++ = *sp++;
812
                *dp++ = *sp++;
757
            }
813
            }
758
 
814
           
759
            /* Move to the next bit. */
815
            /* Move to the next bit. */
760
            b = b << 1;
816
            b = b << 1;
761
        }
817
        }
762
       
818
       
763
        /* Move to the beginning of the next scanline of the cell. */
819
        /* Move to the beginning of the next scanline of the cell. */
764
        dp += d_add;
820
        dp += d_add;
765
    }
821
    }
766
}
822
}
767
 
823
 
768
/** Draw glyph at specified position in viewport.
824
/** Draw glyph at specified position in viewport.
769
 *
825
 *
770
 * @param vport  Viewport identification
826
 * @param vport  Viewport identification
771
 * @param cursor Draw glyph with cursor
827
 * @param cursor Draw glyph with cursor
772
 * @param col    Screen position relative to viewport
828
 * @param col    Screen position relative to viewport
773
 * @param row    Screen position relative to viewport
829
 * @param row    Screen position relative to viewport
Line 776... Line 832...
776
static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col,
832
static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col,
777
    unsigned int row)
833
    unsigned int row)
778
{
834
{
779
    unsigned int x = vport->x + COL2X(col);
835
    unsigned int x = vport->x + COL2X(col);
780
    unsigned int y = vport->y + ROW2Y(row);
836
    unsigned int y = vport->y + ROW2Y(row);
781
 
-
 
782
    uint32_t glyph;
-
 
783
    uint32_t fg_color;
-
 
784
    uint32_t bg_color;
-
 
785
   
837
   
786
    glyph = vport->backbuf[BB_POS(vport, col, row)].glyph;
838
    uint32_t glyph = vport->backbuf[BB_POS(vport, col, row)].glyph;
787
    fg_color = vport->backbuf[BB_POS(vport, col, row)].fg_color;
839
    uint32_t fg_color = vport->backbuf[BB_POS(vport, col, row)].fg_color;
788
    bg_color = vport->backbuf[BB_POS(vport, col, row)].bg_color;
840
    uint32_t bg_color = vport->backbuf[BB_POS(vport, col, row)].bg_color;
789
 
841
   
790
    (*vport->dglyph)(x, y, cursor, screen.glyphs, glyph,
842
    (*vport->dglyph)(x, y, cursor, screen.glyphs, glyph,
791
        fg_color, bg_color);
843
        fg_color, bg_color);
792
}
844
}
793
 
845
 
794
/** Hide cursor if it is shown
846
/** Hide cursor if it is shown
Line 837... Line 889...
837
 *
889
 *
838
 */
890
 */
839
static void draw_char(viewport_t *vport, wchar_t c, unsigned int col, unsigned int row)
891
static void draw_char(viewport_t *vport, wchar_t c, unsigned int col, unsigned int row)
840
{
892
{
841
    bb_cell_t *bbp;
893
    bb_cell_t *bbp;
842
 
894
   
843
    /* Do not hide cursor if we are going to overwrite it */
895
    /* Do not hide cursor if we are going to overwrite it */
844
    if ((vport->cursor_active) && (vport->cursor_shown) &&
896
    if ((vport->cursor_active) && (vport->cursor_shown) &&
845
        ((vport->cur_col != col) || (vport->cur_row != row)))
897
        ((vport->cur_col != col) || (vport->cur_row != row)))
846
        cursor_hide(vport);
898
        cursor_hide(vport);
847
 
899
   
848
    bbp = &vport->backbuf[BB_POS(vport, col, row)];
900
    bbp = &vport->backbuf[BB_POS(vport, col, row)];
849
    bbp->glyph = fb_font_glyph(c);
901
    bbp->glyph = fb_font_glyph(c);
850
    bbp->fg_color = vport->attr.fg_color;
902
    bbp->fg_color = vport->attr.fg_color;
851
    bbp->bg_color = vport->attr.bg_color;
903
    bbp->bg_color = vport->attr.bg_color;
852
 
904
   
853
    draw_vp_glyph(vport, false, col, row);
905
    draw_vp_glyph(vport, false, col, row);
854
   
906
   
855
    vport->cur_col = col;
907
    vport->cur_col = col;
856
    vport->cur_row = row;
908
    vport->cur_row = row;
857
   
909
   
Line 868... Line 920...
868
 
920
 
869
/** Draw text data to viewport.
921
/** Draw text data to viewport.
870
 *
922
 *
871
 * @param vport Viewport id
923
 * @param vport Viewport id
872
 * @param data  Text data.
924
 * @param data  Text data.
873
 * @param x Leftmost column of the area.
925
 * @param x     Leftmost column of the area.
874
 * @param y Topmost row of the area.
926
 * @param y     Topmost row of the area.
875
 * @param w Number of rows.
927
 * @param w     Number of rows.
876
 * @param h Number of columns.
928
 * @param h     Number of columns.
-
 
929
 *
877
 */
930
 */
878
static void draw_text_data(viewport_t *vport, keyfield_t *data, unsigned int x,
931
static void draw_text_data(viewport_t *vport, keyfield_t *data, unsigned int x,
879
    unsigned int y, unsigned int w, unsigned int h)
932
    unsigned int y, unsigned int w, unsigned int h)
880
{
933
{
-
 
934
    unsigned int i;
881
    unsigned int i, j;
935
    unsigned int j;
882
    bb_cell_t *bbp;
936
    bb_cell_t *bbp;
883
    attrs_t *a;
937
    attrs_t *a;
884
    attr_rgb_t rgb;
938
    attr_rgb_t rgb;
885
 
939
   
886
    for (j = 0; j < h; j++) {
940
    for (j = 0; j < h; j++) {
887
        for (i = 0; i < w; i++) {
941
        for (i = 0; i < w; i++) {
888
            unsigned int col = x + i;
942
            unsigned int col = x + i;
889
            unsigned int row = y + j;
943
            unsigned int row = y + j;
890
 
944
           
891
            bbp = &vport->backbuf[BB_POS(vport, col, row)];
945
            bbp = &vport->backbuf[BB_POS(vport, col, row)];
892
 
946
           
893
            a = &data[j * w + i].attrs;
947
            a = &data[j * w + i].attrs;
894
            rgb_from_attr(&rgb, a);
948
            rgb_from_attr(&rgb, a);
895
 
949
           
896
            bbp->glyph = fb_font_glyph(data[j * w + i].character);
950
            bbp->glyph = fb_font_glyph(data[j * w + i].character);
897
            bbp->fg_color = rgb.fg_color;
951
            bbp->fg_color = rgb.fg_color;
898
            bbp->bg_color = rgb.bg_color;
952
            bbp->bg_color = rgb.bg_color;
899
 
953
           
900
            draw_vp_glyph(vport, false, col, row);
954
            draw_vp_glyph(vport, false, col, row);
901
        }
955
        }
902
    }
956
    }
903
    cursor_show(vport);
957
    cursor_show(vport);
904
}
958
}
Line 1190... Line 1244...
1190
   
1244
   
1191
    /* Limit redrawing */
1245
    /* Limit redrawing */
1192
    counts = (counts + 1) % 8;
1246
    counts = (counts + 1) % 8;
1193
    if (counts)
1247
    if (counts)
1194
        return;
1248
        return;
1195
 
1249
   
1196
    for (i = 0; i < MAX_ANIMATIONS; i++) {
1250
    for (i = 0; i < MAX_ANIMATIONS; i++) {
1197
        if ((!animations[i].animlen) || (!animations[i].initialized) ||
1251
        if ((!animations[i].animlen) || (!animations[i].initialized) ||
1198
            (!animations[i].enabled))
1252
            (!animations[i].enabled))
1199
            continue;
1253
            continue;
1200
       
1254
       
Line 1657... Line 1711...
1657
        case FB_POINTER_MOVE:
1711
        case FB_POINTER_MOVE:
1658
            pointer_enabled = true;
1712
            pointer_enabled = true;
1659
            mouse_move(IPC_GET_ARG1(call), IPC_GET_ARG2(call));
1713
            mouse_move(IPC_GET_ARG1(call), IPC_GET_ARG2(call));
1660
            retval = EOK;
1714
            retval = EOK;
1661
            break;
1715
            break;
-
 
1716
        case FB_SCREEN_YIELD:
-
 
1717
        case FB_SCREEN_RECLAIM:
-
 
1718
            retval = EOK;
-
 
1719
            break;
1662
        default:
1720
        default:
1663
            retval = ENOENT;
1721
            retval = ENOENT;
1664
        }
1722
        }
1665
        ipc_answer_0(callid, retval);
1723
        ipc_answer_0(callid, retval);
1666
    }
1724
    }