Rev 3725 | Rev 3739 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3725 | Rev 3726 | ||
---|---|---|---|
Line 306... | Line 306... | ||
306 | * @param lines Number of lines to scroll |
306 | * @param lines Number of lines to scroll |
307 | * |
307 | * |
308 | */ |
308 | */ |
309 | static void vport_scroll(viewport_t *vport, int lines) |
309 | static void vport_scroll(viewport_t *vport, int lines) |
310 | { |
310 | { |
- | 311 | unsigned int row, col; |
|
- | 312 | ||
311 | /* |
313 | /* |
312 | * Scroll backbuffer. |
314 | * Scroll backbuffer. |
313 | */ |
315 | */ |
314 | 316 | ||
315 | if (lines > 0) { |
317 | if (lines > 0) { |
316 | memmove(vport->backbuf, vport->backbuf + vport->cols * lines, |
318 | memcpy(vport->backbuf, vport->backbuf + vport->cols * lines, |
317 | vport->cols * (vport->rows - lines)); |
319 | vport->cols * (vport->rows - lines)); |
318 | memset(&vport->backbuf[BB_POS(vport, 0, vport->rows - lines)], |
320 | memset(&vport->backbuf[BB_POS(vport, 0, vport->rows - lines)], |
319 | 0, vport->cols * lines); |
321 | 0, vport->cols * lines); |
320 | } else { |
322 | } else { |
321 | memmove(vport->backbuf - vport->cols * lines, vport->backbuf, |
323 | memcpy(vport->backbuf - vport->cols * lines, vport->backbuf, |
322 | vport->cols * (vport->rows + lines)); |
324 | vport->cols * (vport->rows + lines)); |
323 | memset(vport->backbuf, 0, - vport->cols * lines); |
325 | memset(vport->backbuf, 0, - vport->cols * lines); |
324 | } |
326 | } |
325 | 327 | ||
326 | /* |
328 | /* |
327 | * Scroll pixels. |
329 | * Redraw. |
328 | */ |
330 | */ |
329 | 331 | ||
330 | unsigned int dist, height, alines; |
- | |
331 | unsigned int y, ry; |
- | |
332 | uint8_t *sp, *dp; |
- | |
333 | - | ||
334 | alines = lines > 0 ? lines : -lines; |
- | |
335 | dist = alines * FONT_SCANLINES; |
- | |
336 | height = (vport->rows - alines) * FONT_SCANLINES; |
- | |
337 | - | ||
338 | if (lines > 0) { |
- | |
339 | dp = &screen.fb_addr[FB_POS(vport->x, vport->y + 0)]; |
332 | for (row = 0; row < vport->rows; row++) { |
340 | sp = &screen.fb_addr[FB_POS(vport->x, vport->y + dist)]; |
- | |
341 | ry = height; |
- | |
342 | } else { |
- | |
343 | dp = &screen.fb_addr[FB_POS(vport->x, vport->y + dist)]; |
333 | for (col = 0; col < vport->cols; col++) { |
344 | sp = &screen.fb_addr[FB_POS(vport->x, vport->y + 0)]; |
334 | draw_glyph(vport, false, col, row); |
345 | ry = 0; |
- | |
346 | } |
335 | } |
347 | - | ||
348 | /* Move pixels line by line. */ |
- | |
349 | for (y = 0; y < height; y++) { |
- | |
350 | memcpy(dp, sp, vport->cols * FONT_WIDTH |
- | |
351 | * screen.pixelbytes); |
- | |
352 | - | ||
353 | sp += screen.scanline; |
- | |
354 | dp += screen.scanline; |
- | |
355 | } |
336 | } |
356 | - | ||
357 | /* Fill emptied area with background color. */ |
- | |
358 | draw_filled_rect(vport->x, vport->y + ry, |
- | |
359 | vport->x + COL2X(vport->cols), vport->y + ry + dist, |
- | |
360 | vport->style.bg_color); |
- | |
361 | } |
337 | } |
362 | 338 | ||
363 | /** Render glyphs |
339 | /** Render glyphs |
364 | * |
340 | * |
365 | * Convert glyphs from device independent font |
341 | * Convert glyphs from device independent font |