Subversion Repositories HelenOS

Rev

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

Rev 3723 Rev 3724
Line 269... Line 269...
269
            vport->style.bg_color);
269
            vport->style.bg_color);
270
    }
270
    }
271
}
271
}
272
 
272
 
273
 
273
 
274
/** Clear viewport
274
/** Clear viewport.
275
 *
275
 *
276
 * @param vport Viewport to clear
276
 * @param vport Viewport to clear
277
 *
277
 *
278
 */
278
 */
279
static void vport_clear(viewport_t *vport)
279
static void vport_clear(viewport_t *vport)
280
{
280
{
281
    memset(vport->backbuf, 0, vport->bbsize);
281
    memset(vport->backbuf, 0, vport->bbsize);
282
    vport_redraw(vport);
282
    vport_redraw(vport);
283
}
283
}
284
 
284
 
285
/** Scroll viewport by given number of lines
285
/** Scroll viewport by the specified number of lines.
286
 *
286
 *
287
 * @param vport Viewport to scroll
287
 * @param vport Viewport to scroll
288
 * @param lines Number of lines to scroll
288
 * @param lines Number of lines to scroll
289
 *
289
 *
290
 */
290
 */
291
static void vport_scroll(viewport_t *vport, int lines)
291
static void vport_scroll(viewport_t *vport, int lines)
292
{
292
{
-
 
293
    /*
293
    unsigned int row, col;
294
     * Scroll backbuffer.
-
 
295
     */
294
 
296
 
295
    if (lines > 0) {
297
    if (lines > 0) {
296
        memcpy(vport->backbuf, vport->backbuf + vport->cols * lines,
298
        memmove(vport->backbuf, vport->backbuf + vport->cols * lines,
297
            vport->cols * (vport->rows - lines));
299
            vport->cols * (vport->rows - lines));
298
        memset(&vport->backbuf[BB_POS(vport, 0, vport->rows - lines)],
300
        memset(&vport->backbuf[BB_POS(vport, 0, vport->rows - lines)],
299
            0, vport->cols * lines);
301
            0, vport->cols * lines);
300
    } else {
302
    } else {
301
        memcpy(vport->backbuf - vport->cols * lines, vport->backbuf,
303
        memmove(vport->backbuf - vport->cols * lines, vport->backbuf,
302
            vport->cols * (vport->rows + lines));
304
            vport->cols * (vport->rows + lines));
303
        memset(vport->backbuf, 0, - vport->cols * lines);
305
        memset(vport->backbuf, 0, - vport->cols * lines);
304
    }
306
    }
305
 
307
 
-
 
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) {
306
    for (row = 0; row < vport->rows; row++) {
321
        dp = &screen.fb_addr[FB_POS(vport->x, vport->y + 0)];
307
        for (col = 0; col < vport->cols; col++) {
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)];
308
            draw_glyph(vport, false, col, row);
326
        sp = &screen.fb_addr[FB_POS(vport->x, vport->y + 0)];
309
        }
327
        ry = 0;
310
    }
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);
311
}
343
}
312
 
344
 
313
/** Render glyphs
345
/** Render glyphs
314
 *
346
 *
315
 * Convert glyphs from device independent font
347
 * Convert glyphs from device independent font