Changeset 67c6c651 in mainline


Ignore:
Timestamp:
2008-12-24T15:26:25Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c484842
Parents:
ab25d30
Message:

Re-instate accidentaly lost fb scrolling implementation. Also re-apply accidentaly reverted fix of unsing memmove() instead of memcpy().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fb/fb.c

    rab25d30 r67c6c651  
    140140static bool client_connected = false;  /**< Allow only 1 connection */
    141141
    142 static void draw_glyph(viewport_t *vport, bool cursor, unsigned int col,
     142static void draw_glyph(unsigned int x, unsigned int y, bool cursor,
     143    uint8_t *glyphs, uint8_t glyph);
     144static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col,
    143145    unsigned int row);
    144146
     
    270272        for (row = 0; row < vport->rows; row++) {
    271273                for (col = 0; col < vport->cols; col++) {
    272                         draw_glyph(vport, false, col, row);
     274                        draw_vp_glyph(vport, false, col, row);
    273275                }
    274276        }
     
    310312{
    311313        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        }
    312341
    313342        /*
     
    316345
    317346        if (lines > 0) {
    318                 memcpy(vport->backbuf, vport->backbuf + vport->cols * lines,
     347                memmove(vport->backbuf, vport->backbuf + vport->cols * lines,
    319348                    vport->cols * (vport->rows - lines));
    320349                memset(&vport->backbuf[BB_POS(vport, 0, vport->rows - lines)],
    321350                    0, vport->cols * lines);
    322351        } else {
    323                 memcpy(vport->backbuf - vport->cols * lines, vport->backbuf,
     352                memmove(vport->backbuf - vport->cols * lines, vport->backbuf,
    324353                    vport->cols * (vport->rows + lines));
    325354                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                 }
    336355        }
    337356}
     
    516535
    517536
    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 */
     546static 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.
    519557 *
    520558 * @param vport  Viewport identification
     
    524562 *
    525563 */
    526 static void draw_glyph(viewport_t *vport, bool cursor, unsigned int col, unsigned int row)
     564static void draw_vp_glyph(viewport_t *vport, bool cursor, unsigned int col,
     565    unsigned int row)
    527566{
    528567        unsigned int x = vport->x + COL2X(col);
    529568        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);
    537573}
    538574
     
    544580{
    545581        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);
    547583                vport->cursor_shown = false;
    548584        }
     
    557593        /* Do not check for cursor_shown */
    558594        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);
    560596                vport->cursor_shown = true;
    561597        }
     
    591627       
    592628        vport->backbuf[BB_POS(vport, col, row)] = c;
    593         draw_glyph(vport, false, col, row);
     629        draw_vp_glyph(vport, false, col, row);
    594630       
    595631        vport->cur_col = col;
     
    628664                if (glyph != data[i].character) {
    629665                        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);
    631667                }
    632668        }
Note: See TracChangeset for help on using the changeset viewer.