Changeset 67c6c651 in mainline
- Timestamp:
- 2008-12-24T15:26:25Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c484842
- Parents:
- ab25d30
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fb/fb.c
rab25d30 r67c6c651 140 140 static bool client_connected = false; /**< Allow only 1 connection */ 141 141 142 static void draw_glyph(viewport_t *vport, bool cursor, unsigned int col, 142 static void draw_glyph(unsigned int x, unsigned int y, bool cursor, 143 uint8_t *glyphs, uint8_t glyph); 144 static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col, 143 145 unsigned int row); 144 146 … … 270 272 for (row = 0; row < vport->rows; row++) { 271 273 for (col = 0; col < vport->cols; col++) { 272 draw_ glyph(vport, false, col, row);274 draw_vp_glyph(vport, false, col, row); 273 275 } 274 276 } … … 310 312 { 311 313 unsigned int row, col; 314 unsigned int x, y; 315 uint8_t glyph; 316 317 /* 318 * Redraw. 319 */ 320 321 y = vport->y; 322 for (row = 0; row < vport->rows; row++) { 323 x = vport->x; 324 for (col = 0; col < vport->cols; col++) { 325 if ((row + lines >= 0) && (row + lines < vport->rows)) { 326 glyph = vport->backbuf[BB_POS(vport, col, row + lines)]; 327 328 if (vport->backbuf[BB_POS(vport, col, row)] == glyph) { 329 x += FONT_WIDTH; 330 continue; 331 } 332 } else { 333 glyph = 0; 334 } 335 336 draw_glyph(x, y, false, vport->glyphs, glyph); 337 x += FONT_WIDTH; 338 } 339 y += FONT_SCANLINES; 340 } 312 341 313 342 /* … … 316 345 317 346 if (lines > 0) { 318 mem cpy(vport->backbuf, vport->backbuf + vport->cols * lines,347 memmove(vport->backbuf, vport->backbuf + vport->cols * lines, 319 348 vport->cols * (vport->rows - lines)); 320 349 memset(&vport->backbuf[BB_POS(vport, 0, vport->rows - lines)], 321 350 0, vport->cols * lines); 322 351 } else { 323 mem cpy(vport->backbuf - vport->cols * lines, vport->backbuf,352 memmove(vport->backbuf - vport->cols * lines, vport->backbuf, 324 353 vport->cols * (vport->rows + lines)); 325 354 memset(vport->backbuf, 0, - vport->cols * lines); 326 }327 328 /*329 * Redraw.330 */331 332 for (row = 0; row < vport->rows; row++) {333 for (col = 0; col < vport->cols; col++) {334 draw_glyph(vport, false, col, row);335 }336 355 } 337 356 } … … 516 535 517 536 518 /** Draw glyph at given position relative to viewport 537 /** Draw a glyph. 538 * 539 * @param x x coordinate of top-left corner on screen. 540 * @param y y coordinate of top-left corner on screen. 541 * @param cursor Draw glyph with cursor 542 * @param glyphs Pointer to font bitmap. 543 * @param glyph Code of the glyph to draw. 544 * 545 */ 546 static void draw_glyph(unsigned int x, unsigned int y, bool cursor, 547 uint8_t *glyphs, uint8_t glyph) 548 { 549 unsigned int yd; 550 551 for (yd = 0; yd < FONT_SCANLINES; yd++) 552 memcpy(&screen.fb_addr[FB_POS(x, y + yd)], 553 &glyphs[GLYPH_POS(glyph, yd, cursor)], screen.glyphscanline); 554 } 555 556 /** Draw glyph at specified position in viewport. 519 557 * 520 558 * @param vport Viewport identification … … 524 562 * 525 563 */ 526 static void draw_glyph(viewport_t *vport, bool cursor, unsigned int col, unsigned int row) 564 static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col, 565 unsigned int row) 527 566 { 528 567 unsigned int x = vport->x + COL2X(col); 529 568 unsigned int y = vport->y + ROW2Y(row); 530 unsigned int yd; 531 532 uint8_t glyph = vport->backbuf[BB_POS(vport, col, row)]; 533 534 for (yd = 0; yd < FONT_SCANLINES; yd++) 535 memcpy(&screen.fb_addr[FB_POS(x, y + yd)], 536 &vport->glyphs[GLYPH_POS(glyph, yd, cursor)], screen.glyphscanline); 569 uint8_t glyph; 570 571 glyph = vport->backbuf[BB_POS(vport, col, row)]; 572 draw_glyph(x, y, cursor, vport->glyphs, glyph); 537 573 } 538 574 … … 544 580 { 545 581 if ((vport->cursor_active) && (vport->cursor_shown)) { 546 draw_ glyph(vport, false, vport->cur_col, vport->cur_row);582 draw_vp_glyph(vport, false, vport->cur_col, vport->cur_row); 547 583 vport->cursor_shown = false; 548 584 } … … 557 593 /* Do not check for cursor_shown */ 558 594 if (vport->cursor_active) { 559 draw_ glyph(vport, true, vport->cur_col, vport->cur_row);595 draw_vp_glyph(vport, true, vport->cur_col, vport->cur_row); 560 596 vport->cursor_shown = true; 561 597 } … … 591 627 592 628 vport->backbuf[BB_POS(vport, col, row)] = c; 593 draw_ glyph(vport, false, col, row);629 draw_vp_glyph(vport, false, col, row); 594 630 595 631 vport->cur_col = col; … … 628 664 if (glyph != data[i].character) { 629 665 vport->backbuf[BB_POS(vport, col, row)] = data[i].character; 630 draw_ glyph(vport, false, col, row);666 draw_vp_glyph(vport, false, col, row); 631 667 } 632 668 }
Note:
See TracChangeset
for help on using the changeset viewer.