From 5bd76a2c84d9ad80faebf066acf6efedd24bd797 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 1 May 2010 12:18:42 +0800 Subject: [PATCH] Fixes to VTerm to make vterms with resolutions lower than the current one print to the center of the screen. --- Kernel/drv/vterm.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Kernel/drv/vterm.c b/Kernel/drv/vterm.c index b73e8dea..d0106253 100644 --- a/Kernel/drv/vterm.c +++ b/Kernel/drv/vterm.c @@ -390,26 +390,36 @@ Uint64 VT_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) { if( giVT_RealWidth > term->Width || giVT_RealHeight > term->Height ) { - #if 0 - int x, y, h; + int x, y, w, h; x = Offset/4; y = x / term->Width; x %= term->Width; w = Length/4+x; h = w / term->Width; w %= term->Width; + // Center + x += (giVT_RealWidth - term->Width) / 2; + y += (giVT_RealHeight - term->Height) / 2; while(h--) { VFS_WriteAt( giVT_OutputDevHandle, - (x+y*term->RealWidth)*4, + (x + y * giVT_RealWidth)*4, term->Width * 4, Buffer ); - Buffer = (void*)( (Uint)Buffer + term->Width*term->Height*4 ); + Buffer = (void*)( (Uint)Buffer + term->Width*4 ); + y ++; } - #endif return 0; } else { return VFS_WriteAt( giVT_OutputDevHandle, Offset, Length, Buffer ); } } + + case TERM_MODE_2DACCEL: + //case TERM_MODE_3DACCEL: + if( Node->Inode == giVT_CurrentTerminal ) + { + VFS_Write( giVT_OutputDevHandle, Length, Buffer ); + } + break; } return 0; -- 2.20.1