Assorted bug fixes.
keyboard.c - Call tcsetattr() in VGLKeyboardEnd() to restore tty, only when tty attributes have been previously saved. PR: misc/9524 Submitted by: Katusyuki 'kei' Maeda (kei@nanet.co.jp) - Set up the tty raw mode correctly. main.c - Restore VESA_800x600 raster text mode correctly in VGLEnd(). Submitted by: des text.c - Allocate the correct size of a font buffer in VGLSetFontFile(). I forgot the submitter ;-( simple.c, bitmap.c - Fix address calculation for the VGA mode X in VGLGetXY() and VGLBitmapCopy(). - Fix typo (dsty -> dstx) in __VGLBitmapCopy(). Reviewed by: sos
This commit is contained in:
parent
4f2a0d4f96
commit
5e7a62b28b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50141
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bitmap.c,v 1.8 1997/08/15 12:32:59 sos Exp $
|
||||
* $Id: bitmap.c,v 1.1 1997/08/17 21:09:34 sos Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -89,14 +89,15 @@ WriteVerticalLine(VGLBitmap *dst, int x, int y, int width, byte *line)
|
||||
}
|
||||
break;
|
||||
case VIDBUF8X:
|
||||
address = dst->Bitmap + ((dst->Xsize * y) + x)/2;
|
||||
address = dst->Bitmap + (dst->Xsize/2 * y) + x/4;
|
||||
for (i=0; i<4; i++) {
|
||||
outb(0x3c4, 0x02);
|
||||
outb(0x3c5, 0x01<<i);
|
||||
pos = i;
|
||||
for (planepos=0; planepos<width/4; planepos++, pos+=4)
|
||||
outb(0x3c5, 0x01 << ((x + i)%4));
|
||||
for (planepos=0, pos=i; pos<width; planepos++, pos+=4)
|
||||
address[planepos] = line[pos];
|
||||
}
|
||||
if ((x + i)%4 == 3)
|
||||
++address;
|
||||
}
|
||||
break;
|
||||
case VIDBUF8:
|
||||
case MEMBUF:
|
||||
@ -145,14 +146,15 @@ ReadVerticalLine(VGLBitmap *src, int x, int y, int width, byte *line)
|
||||
}
|
||||
break;
|
||||
case VIDBUF8X:
|
||||
address = src->Bitmap + ((src->Xsize * y) + x)/2;
|
||||
address = src->Bitmap + (src->Xsize/2 * y) + x/4;
|
||||
for (i=0; i<4; i++) {
|
||||
outb(0x3ce, 0x04);
|
||||
outb(0x3cf, i);
|
||||
pos = i;
|
||||
for (planepos=0; planepos<width/4; planepos++, pos+=4)
|
||||
outb(0x3cf, (x + i)%4);
|
||||
for (planepos=0, pos=i; pos<width; planepos++, pos+=4)
|
||||
line[pos] = address[planepos];
|
||||
}
|
||||
if ((x + i)%4 == 3)
|
||||
++address;
|
||||
}
|
||||
break;
|
||||
case VIDBUF8:
|
||||
case MEMBUF:
|
||||
@ -169,7 +171,7 @@ __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
|
||||
{
|
||||
int srcline, dstline;
|
||||
|
||||
if (srcx>src->Xsize||srcy>src->Ysize||dsty>dst->Xsize||dsty>dst->Ysize)
|
||||
if (srcx>src->Xsize||srcy>src->Ysize||dstx>dst->Xsize||dsty>dst->Ysize)
|
||||
return -1;
|
||||
if (srcx < 0) {
|
||||
width=width+srcx; dstx-=srcx; srcx=0;
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: keyboard.c,v 1.1 1997/10/01 20:53:38 sos Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -48,6 +48,7 @@ VGLKeyboardInit(int mode)
|
||||
tcgetattr(0, &VGLKeyboardTty);
|
||||
|
||||
term = VGLKeyboardTty;
|
||||
cfmakeraw(&term);
|
||||
term.c_iflag = IGNPAR | IGNBRK;
|
||||
term.c_oflag = 0;
|
||||
term.c_cflag = CREAD | CS8;
|
||||
@ -75,9 +76,10 @@ VGLKeyboardInit(int mode)
|
||||
void
|
||||
VGLKeyboardEnd()
|
||||
{
|
||||
if (VGLKeyboardMode != -1)
|
||||
if (VGLKeyboardMode != -1) {
|
||||
ioctl(0, KDSKBMODE, VGLKeyboardMode);
|
||||
tcsetattr(0, TCSANOW, &VGLKeyboardTty);
|
||||
tcsetattr(0, TCSANOW, &VGLKeyboardTty);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: main.c,v 1.1 1997/08/17 21:09:34 sos Exp $
|
||||
* $Id: main.c,v 1.2 1997/10/01 20:53:39 sos Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -61,7 +61,19 @@ struct vt_mode smode;
|
||||
outb(0x3c4, 0x02);
|
||||
outb(0x3c5, 0x0f);
|
||||
bzero(VGLMem, 64*1024);
|
||||
ioctl(0, _IO('S', VGLOldMode), 0);
|
||||
if (VGLOldMode >= M_VESA_BASE) {
|
||||
/* ugly, but necessary */
|
||||
ioctl(0, _IO('V', VGLOldMode - M_VESA_BASE), 0);
|
||||
if (VGLOldMode == M_VESA_800x600) {
|
||||
int size[3];
|
||||
size[0] = 80;
|
||||
size[1] = 25;
|
||||
size[2] = 16;
|
||||
ioctl(0, KDRASTER, size);
|
||||
}
|
||||
} else {
|
||||
ioctl(0, _IO('S', VGLOldMode), 0);
|
||||
}
|
||||
ioctl(0, KDDISABIO, 0);
|
||||
ioctl(0, KDSETMODE, KD_TEXT);
|
||||
smode.mode = VT_AUTO;
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: simple.c,v 1.8 1997/08/15 12:32:59 sos Exp $
|
||||
* $Id: simple.c,v 1.1 1997/08/17 21:09:35 sos Exp $
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
@ -94,7 +94,7 @@ VGLGetXY(VGLBitmap *object, int x, int y)
|
||||
break;
|
||||
case VIDBUF8X:
|
||||
outb(0x3ce, 0x04); outb(0x3cf, x & 0x3);
|
||||
return object->Bitmap[(unsigned)(object->Xsize/4*y)+(x/4)];
|
||||
return object->Bitmap[(unsigned)(object->Xsize/2*y)+(x/4)];
|
||||
break;
|
||||
case VIDBUF4:
|
||||
return (object->Bitmap[((y*object->Xsize/8)+x/8)]&(0x80>>(x%8))) ? 1 : 0;
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: text.c,v 1.4 1997/08/13 19:34:23 sos Exp $
|
||||
* $Id: text.c,v 1.1 1997/08/17 21:09:35 sos Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -60,7 +60,7 @@ FILE *fd;
|
||||
fread(&VGLTextFont->Width, 1 , 1, fd);
|
||||
fread(&VGLTextFont->Height, 1 , 1, fd);
|
||||
VGLTextFont->BitmapArray =
|
||||
(byte*)malloc(256*VGLTextFont->Width*VGLTextFont->Height);
|
||||
(byte*)malloc(256*((VGLTextFont->Width + 7)/8)*VGLTextFont->Height);
|
||||
fread(VGLTextFont->BitmapArray, 1,
|
||||
(256*VGLTextFont->Width* VGLTextFont->Height), fd);
|
||||
fclose(fd);
|
||||
|
Loading…
Reference in New Issue
Block a user