Changeset 4527fb5 in mainline
- Timestamp:
- 2009-04-04T21:13:26Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f2b8cdc
- Parents:
- 67ebf21
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fb/fb.c
r67ebf21 r4527fb5 94 94 unsigned int pixelbytes; 95 95 unsigned int glyphbytes; 96 97 /** Pre-rendered mask for rendering glyphs. Specific for the visual. */ 98 uint8_t *glyphs; 96 99 97 100 rgb_conv_t rgb_conv; … … 123 126 attr_rgb_t attr; 124 127 125 /** Pre-rendered mask for rendering glyphs. Different viewports 128 uint8_t *bgpixel; 129 130 /** 131 * Glyph drawing function for this viewport. Different viewports 126 132 * might use different drawing functions depending on whether their 127 * scanlines are aligned on a word boundary.*/ 128 uint8_t *glyphs; 129 130 uint8_t *bgpixel; 131 132 /** Glyph drawing function for this viewport. */ 133 * scanlines are aligned on a word boundary. 134 */ 133 135 dg_t dglyph; 134 136 … … 422 424 } 423 425 424 (*vport->dglyph)(x, y, false, vport->glyphs, glyph,426 (*vport->dglyph)(x, y, false, screen.glyphs, glyph, 425 427 fg_color, bg_color); 426 428 x += FONT_WIDTH; … … 450 452 * Convert glyphs from device independent font 451 453 * description to current visual representation. 452 * 453 * @param vport Viewport 454 * 455 */ 456 static void render_glyphs(viewport_t* vport) 454 */ 455 static void render_glyphs(void) 457 456 { 458 457 unsigned int glyph; 459 458 460 459 for (glyph = 0; glyph < FONT_GLYPHS; glyph++) { 461 460 unsigned int y; 462 461 463 462 for (y = 0; y < FONT_SCANLINES; y++) { 464 463 unsigned int x; 465 464 466 465 for (x = 0; x < FONT_WIDTH; x++) { 467 screen.rgb_conv(& vport->glyphs[GLYPH_POS(glyph, y, false) + x * screen.pixelbytes],466 screen.rgb_conv(&screen.glyphs[GLYPH_POS(glyph, y, false) + x * screen.pixelbytes], 468 467 (fb_font[glyph][y] & (1 << (7 - x))) 469 468 ? 0xffffff : 0x000000); 470 471 screen.rgb_conv(& vport->glyphs[GLYPH_POS(glyph, y, true) + x * screen.pixelbytes],469 470 screen.rgb_conv(&screen.glyphs[GLYPH_POS(glyph, y, true) + x * screen.pixelbytes], 472 471 (fb_font[glyph][y] & (1 << (7 - x))) 473 472 ? 0x000000 : 0xffffff); … … 475 474 } 476 475 } 477 478 screen.rgb_conv(vport->bgpixel, vport->attr.bg_color);479 476 } 480 477 … … 505 502 unsigned int rows = height / FONT_SCANLINES; 506 503 unsigned int bbsize = cols * rows * sizeof(bb_cell_t); 507 unsigned int glyphsize = 2 * FONT_GLYPHS * screen.glyphbytes;508 504 unsigned int word_size = sizeof(unsigned long); 509 505 … … 512 508 return ENOMEM; 513 509 514 uint8_t * glyphs = (uint8_t *) malloc(glyphsize);515 if (! glyphs) {510 uint8_t *bgpixel = (uint8_t *) malloc(screen.pixelbytes); 511 if (!bgpixel) { 516 512 free(backbuf); 517 513 return ENOMEM; 518 514 } 519 520 uint8_t *bgpixel = (uint8_t *) malloc(screen.pixelbytes);521 if (!bgpixel) {522 free(glyphs);523 free(backbuf);524 return ENOMEM;525 }526 515 527 516 backbuf_clear(backbuf, cols * rows, DEFAULT_FGCOLOR, DEFAULT_BGCOLOR); 528 memset(glyphs, 0, glyphsize);529 517 memset(bgpixel, 0, screen.pixelbytes); 530 518 … … 540 528 viewports[i].attr.fg_color = DEFAULT_FGCOLOR; 541 529 542 viewports[i].glyphs = glyphs;543 530 viewports[i].bgpixel = bgpixel; 544 531 … … 570 557 viewports[i].initialized = true; 571 558 572 render_glyphs(&viewports[i]);559 screen.rgb_conv(viewports[i].bgpixel, viewports[i].attr.bg_color); 573 560 574 561 return i; … … 588 575 unsigned int scan, unsigned int visual) 589 576 { 577 unsigned int glyphsize; 578 uint8_t *glyphs; 590 579 switch (visual) { 591 580 case VISUAL_INDIRECT_8: … … 632 621 screen.glyphscanline = FONT_WIDTH * screen.pixelbytes; 633 622 screen.glyphbytes = screen.glyphscanline * FONT_SCANLINES; 623 624 glyphsize = 2 * FONT_GLYPHS * screen.glyphbytes; 625 glyphs = (uint8_t *) malloc(glyphsize); 626 if (!glyphs) 627 return false; 628 629 memset(glyphs, 0, glyphsize); 630 screen.glyphs = glyphs; 631 632 render_glyphs(); 634 633 635 634 /* Create first viewport */ … … 789 788 bg_color = vport->backbuf[BB_POS(vport, col, row)].bg_color; 790 789 791 (*vport->dglyph)(x, y, cursor, vport->glyphs, glyph,790 (*vport->dglyph)(x, y, cursor, screen.glyphs, glyph, 792 791 fg_color, bg_color); 793 792 } … … 1635 1634 } 1636 1635 viewports[i].initialized = false; 1637 if (viewports[i].glyphs)1638 free(viewports[i].glyphs);1639 1636 if (viewports[i].bgpixel) 1640 1637 free(viewports[i].bgpixel);
Note:
See TracChangeset
for help on using the changeset viewer.