Improved VGA scroll performance using memcpy(3).
This commit is contained in:
parent
ebc0b064c3
commit
476ba278da
1 changed files with 13 additions and 14 deletions
|
@ -24,9 +24,12 @@
|
|||
|
||||
#include <sortix/kernel/platform.h>
|
||||
#include <sortix/kernel/log.h>
|
||||
#include <libmaxsi/memory.h>
|
||||
#include "vga.h"
|
||||
#include "vgaterminal.h"
|
||||
|
||||
using namespace Maxsi;
|
||||
|
||||
namespace Sortix
|
||||
{
|
||||
namespace VGATerminal
|
||||
|
@ -102,13 +105,11 @@ namespace Sortix
|
|||
{
|
||||
for ( nat y = 1; y < height; y++ )
|
||||
{
|
||||
for ( nat x = 0; x < width; x++ )
|
||||
{
|
||||
unsigned oldindex = y * width + x;
|
||||
unsigned newindex = (y-1) * width + x;
|
||||
vga[newindex] = vga[oldindex];
|
||||
vgaattr[newindex] = vgaattr[oldindex];
|
||||
}
|
||||
size_t linesize = width * sizeof(uint16_t);
|
||||
size_t fromoff = (y-0) * width;
|
||||
size_t destoff = (y-1) * width;
|
||||
Memory::Copy(vga + destoff, vga + fromoff, linesize);
|
||||
Memory::Copy(vgaattr + destoff, vgaattr + fromoff, linesize);
|
||||
}
|
||||
|
||||
for ( nat x = 0; x < width; x++ )
|
||||
|
@ -124,13 +125,11 @@ namespace Sortix
|
|||
{
|
||||
for ( nat y = 1; y < height; y++ )
|
||||
{
|
||||
for ( nat x = 0; x < width; x++ )
|
||||
{
|
||||
unsigned oldindex = (y-1) * width + x;
|
||||
unsigned newindex = y * width + x;
|
||||
vga[newindex] = vga[oldindex];
|
||||
vgaattr[newindex] = vgaattr[oldindex];
|
||||
}
|
||||
size_t linesize = width * sizeof(uint16_t);
|
||||
size_t fromoff = (y-1) * width;
|
||||
size_t destoff = (y-0) * width;
|
||||
Memory::Copy(vga + destoff, vga + fromoff, linesize);
|
||||
Memory::Copy(vgaattr + destoff, vgaattr + fromoff, linesize);
|
||||
}
|
||||
|
||||
for ( nat x = 0; x < width; x++ )
|
||||
|
|
Loading…
Reference in a new issue