X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2Fx86%2FVGAText%2Fvga.c;h=1ae1ece69010c6a5bf17b1450b43c2d8f042462d;hb=349e14ded0e8bf502cc9f672f3c6e2c6ec5f6fa1;hp=9fa9fd21019f941614e5c8f762858e30616ad1b2;hpb=2bfc6ebcda05e20572ff78920cb3bbca756cb635;p=tpg%2Facess2.git diff --git a/Modules/x86/VGAText/vga.c b/Modules/x86/VGAText/vga.c index 9fa9fd21..1ae1ece6 100644 --- a/Modules/x86/VGAText/vga.c +++ b/Modules/x86/VGAText/vga.c @@ -230,10 +230,10 @@ void VGA_int_SetCursor(Sint16 x, Sint16 y) int pos = x+y*VGA_WIDTH; if(x == -1 || y == -1) pos = -1; - outb(0x3D4, 14); - outb(0x3D5, pos >> 8); - outb(0x3D4, 15); - outb(0x3D5, pos); + outb(0x3D4, 14); + outb(0x3D5, pos >> 8); + outb(0x3D4, 15); + outb(0x3D5, pos); } void VGA_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour) @@ -246,18 +246,20 @@ void VGA_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colou Y /= giVT_CharHeight; H /= giVT_CharHeight; - if( X > VGA_WIDTH || Y > VGA_HEIGHT ) return ; - if( X + W > VGA_WIDTH ) W = VGA_WIDTH - X; - if( Y + H > VGA_HEIGHT ) H = VGA_HEIGHT - Y; - ch.Ch = 0x20; ch.BGCol = (Colour & 0x0F0000) >> (16-8); ch.BGCol |= (Colour & 0x000F00) >> (8-4); ch.BGCol |= (Colour & 0x00000F); + word = VGA_int_GetWord(&ch); + + Log("Fill (%i,%i) %ix%i with 0x%x", X, Y, W, H, word); + + if( X > VGA_WIDTH || Y > VGA_HEIGHT ) return ; + if( X + W > VGA_WIDTH ) W = VGA_WIDTH - X; + if( Y + H > VGA_HEIGHT ) H = VGA_HEIGHT - Y; buf = gVGA_Framebuffer + Y*VGA_WIDTH + X; - word = VGA_int_GetWord(&ch); while( H -- ) { int i; @@ -281,6 +283,14 @@ void VGA_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY, // Log("(%i,%i) from (%i,%i) %ix%i", DstX, DstY, SrcX, SrcY, W, H); + if( SrcX > VGA_WIDTH || SrcY > VGA_HEIGHT ) return ; + if( SrcX + W > VGA_WIDTH ) W = VGA_WIDTH - SrcX; + if( SrcY + H > VGA_HEIGHT ) H = VGA_HEIGHT - SrcY; + if( DstX > VGA_WIDTH || DstY > VGA_HEIGHT ) return ; + if( DstX + W > VGA_WIDTH ) W = VGA_WIDTH - DstX; + if( DstY + H > VGA_HEIGHT ) H = VGA_HEIGHT - DstY; + + src = gVGA_Framebuffer + SrcY*VGA_WIDTH + SrcX; dst = gVGA_Framebuffer + DstY*VGA_WIDTH + DstX;