From 44b3528f71ac1ae527033f99567598f386e8905d Mon Sep 17 00:00:00 2001 From: Jason Filby Date: Sun, 23 Mar 2003 09:18:51 +0000 Subject: [PATCH] Line drawing fixes svn path=/trunk/; revision=4405 --- .../dd/vga/display/vgavideo/vgavideo.c | 72 +++++++++++-------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/reactos/drivers/dd/vga/display/vgavideo/vgavideo.c b/reactos/drivers/dd/vga/display/vgavideo/vgavideo.c index 15bb477c202..7d9aa8d025a 100644 --- a/reactos/drivers/dd/vga/display/vgavideo/vgavideo.c +++ b/reactos/drivers/dd/vga/display/vgavideo/vgavideo.c @@ -266,49 +266,65 @@ BOOL vgaHLine(INT x, INT y, INT len, UCHAR c) { for (i=x; i0) - { - // Write left pixels - WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); // set the mask - WRITE_PORT_UCHAR((PUCHAR)0x3cf,startmasks[ileftpix]); + if(ileftpix == 8) + { + ileftpix = 0; + imidpix++; + } - a = READ_REGISTER_UCHAR(vidmem + pre1); - WRITE_REGISTER_UCHAR(vidmem + pre1, c); + pre1=xconv[x-(8-ileftpix)]+y80[y]; + orgpre1=pre1; - // Prepare new x for the middle - x=orgx+8; - } + // Left + if(ileftpix>0) + { + // Write left pixels + WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); // set the mask + WRITE_PORT_UCHAR((PUCHAR)0x3cf,startmasks[ileftpix]); - if(imidpix>0) - { - midpre1=xconv[x]+y80[y]; + a = READ_REGISTER_UCHAR(vidmem + pre1); + WRITE_REGISTER_UCHAR(vidmem + pre1, c); - // Set mask to all pixels in byte - WRITE_PORT_UCHAR((PUCHAR)0x3ce, 0x08); - WRITE_PORT_UCHAR((PUCHAR)0x3cf, 0xff); - memset(vidmem+midpre1, c, imidpix); // write middle pixels, no need to read in latch because of the width - } + // Prepare new x for the middle + x=orgx+8; + } + if(imidpix>0) + { + midpre1=xconv[x]+y80[y]; + + // Set mask to all pixels in byte + WRITE_PORT_UCHAR((PUCHAR)0x3ce, 0x08); + WRITE_PORT_UCHAR((PUCHAR)0x3cf, 0xff); + memset(vidmem+midpre1, c, imidpix); // write middle pixels, no need to read in latch because of the width + } + + if(irightpix>0) + { x=orgx+len-irightpix; - pre1=xconv[x]+y80[y]; + + for(i=x; i