Changeset a728ed3 in mainline


Ignore:
Timestamp:
2008-12-22T22:13:11Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d410328
Parents:
2d32081
Message:

When scrolling viewport, do not redraw glyphs. Instead use a (not very smart) blit.

File:
1 edited

Legend:

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

    r2d32081 ra728ed3  
    272272
    273273
    274 /** Clear viewport
     274/** Clear viewport.
    275275 *
    276276 * @param vport Viewport to clear
     
    283283}
    284284
    285 /** Scroll viewport by given number of lines
     285/** Scroll viewport by the specified number of lines.
    286286 *
    287287 * @param vport Viewport to scroll
     
    291291static void vport_scroll(viewport_t *vport, int lines)
    292292{
    293         unsigned int row, col;
     293        /*
     294         * Scroll backbuffer.
     295         */
    294296
    295297        if (lines > 0) {
    296                 memcpy(vport->backbuf, vport->backbuf + vport->cols * lines,
     298                memmove(vport->backbuf, vport->backbuf + vport->cols * lines,
    297299                    vport->cols * (vport->rows - lines));
    298300                memset(&vport->backbuf[BB_POS(vport, 0, vport->rows - lines)],
    299301                    0, vport->cols * lines);
    300302        } else {
    301                 memcpy(vport->backbuf - vport->cols * lines, vport->backbuf,
     303                memmove(vport->backbuf - vport->cols * lines, vport->backbuf,
    302304                    vport->cols * (vport->rows + lines));
    303305                memset(vport->backbuf, 0, - vport->cols * lines);
    304306        }
    305307
    306         for (row = 0; row < vport->rows; row++) {
    307                 for (col = 0; col < vport->cols; col++) {
    308                         draw_glyph(vport, false, col, row);
    309                 }
    310         }
     308        /*
     309         * Scroll pixels.
     310         */
     311
     312        unsigned int dist, height, alines;
     313        unsigned int y, ry;
     314        uint8_t *sp, *dp;
     315
     316        alines = lines > 0 ? lines : -lines;
     317        dist = alines * FONT_SCANLINES;
     318        height = (vport->rows - alines) * FONT_SCANLINES;
     319
     320        if (lines > 0) {
     321                dp = &screen.fb_addr[FB_POS(vport->x, vport->y + 0)];
     322                sp = &screen.fb_addr[FB_POS(vport->x, vport->y + dist)];
     323                ry = height;
     324        } else {
     325                dp = &screen.fb_addr[FB_POS(vport->x, vport->y + dist)];
     326                sp = &screen.fb_addr[FB_POS(vport->x, vport->y + 0)];
     327                ry = 0;
     328        }
     329
     330        /* Move pixels line by line. */
     331        for (y = 0; y < height; y++) {
     332                memcpy(dp, sp, vport->cols * FONT_WIDTH
     333                    * screen.pixelbytes);
     334
     335                sp += screen.scanline;
     336                dp += screen.scanline;
     337        }
     338
     339        /* Fill emptied area with background color. */
     340        draw_filled_rect(vport->x, vport->y + ry,
     341            vport->x + COL2X(vport->cols), vport->y + ry + dist,
     342            vport->style.bg_color);
    311343}
    312344
Note: See TracChangeset for help on using the changeset viewer.