Index: head/lib/libvgl/bitmap.c =================================================================== --- head/lib/libvgl/bitmap.c (revision 345477) +++ head/lib/libvgl/bitmap.c (revision 345478) @@ -1,408 +1,409 @@ /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include "vgl.h" #define min(x, y) (((x) < (y)) ? (x) : (y)) static byte mask[8] = {0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01}; static int color2bit[16] = {0x00000000, 0x00000001, 0x00000100, 0x00000101, 0x00010000, 0x00010001, 0x00010100, 0x00010101, 0x01000000, 0x01000001, 0x01000100, 0x01000101, 0x01010000, 0x01010001, 0x01010100, 0x01010101}; static void WriteVerticalLine(VGLBitmap *dst, int x, int y, int width, byte *line) { int i, pos, last, planepos, start_offset, end_offset, offset; int len; unsigned int word = 0; byte *address; byte *VGLPlane[4]; switch (dst->Type) { case VIDBUF4: case VIDBUF4S: start_offset = (x & 0x07); end_offset = (x + width) & 0x07; i = (width + start_offset) / 8; if (end_offset) i++; VGLPlane[0] = VGLBuf; VGLPlane[1] = VGLPlane[0] + i; VGLPlane[2] = VGLPlane[1] + i; VGLPlane[3] = VGLPlane[2] + i; pos = 0; planepos = 0; last = 8 - start_offset; while (pos < width) { word = 0; while (pos < last && pos < width) word = (word<<1) | color2bit[line[pos++]&0x0f]; VGLPlane[0][planepos] = word; VGLPlane[1][planepos] = word>>8; VGLPlane[2][planepos] = word>>16; VGLPlane[3][planepos] = word>>24; planepos++; last += 8; } planepos--; if (end_offset) { word <<= (8 - end_offset); VGLPlane[0][planepos] = word; VGLPlane[1][planepos] = word>>8; VGLPlane[2][planepos] = word>>16; VGLPlane[3][planepos] = word>>24; } if (start_offset || end_offset) width+=8; width /= 8; outb(0x3ce, 0x01); outb(0x3cf, 0x00); /* set/reset enable */ outb(0x3ce, 0x08); outb(0x3cf, 0xff); /* bit mask */ for (i=0; i<4; i++) { outb(0x3c4, 0x02); outb(0x3c5, 0x01<Type == VIDBUF4) { if (end_offset) VGLPlane[i][planepos] |= dst->Bitmap[pos+planepos] & mask[end_offset]; if (start_offset) VGLPlane[i][0] |= dst->Bitmap[pos] & ~mask[start_offset]; bcopy(&VGLPlane[i][0], dst->Bitmap + pos, width); } else { /* VIDBUF4S */ if (end_offset) { offset = VGLSetSegment(pos + planepos); VGLPlane[i][planepos] |= dst->Bitmap[offset] & mask[end_offset]; } offset = VGLSetSegment(pos); if (start_offset) VGLPlane[i][0] |= dst->Bitmap[offset] & ~mask[start_offset]; for (last = width; ; ) { len = min(VGLAdpInfo.va_window_size - offset, last); bcopy(&VGLPlane[i][width - last], dst->Bitmap + offset, len); pos += len; last -= len; if (last <= 0) break; offset = VGLSetSegment(pos); } } } break; case VIDBUF8X: address = dst->Bitmap + VGLAdpInfo.va_line_width * y + x/4; for (i=0; i<4; i++) { outb(0x3c4, 0x02); outb(0x3c5, 0x01 << ((x + i)%4)); for (planepos=0, pos=i; posVXsize * y + x; while (width > 0) { offset = VGLSetSegment(pos); i = min(VGLAdpInfo.va_window_size - offset, width); bcopy(line, dst->Bitmap + offset, i); line += i; pos += i; width -= i; } break; case VIDBUF16S: case VIDBUF24S: case VIDBUF32S: width = width * dst->PixelBytes; pos = (dst->VXsize * y + x) * dst->PixelBytes; while (width > 0) { offset = VGLSetSegment(pos); i = min(VGLAdpInfo.va_window_size - offset, width); bcopy(line, dst->Bitmap + offset, i); line += i; pos += i; width -= i; } break; case VIDBUF8: case MEMBUF: address = dst->Bitmap + dst->VXsize * y + x; bcopy(line, address, width); break; case VIDBUF16: case VIDBUF24: case VIDBUF32: address = dst->Bitmap + (dst->VXsize * y + x) * dst->PixelBytes; bcopy(line, address, width * dst->PixelBytes); break; default: ; } } static void ReadVerticalLine(VGLBitmap *src, int x, int y, int width, byte *line) { int i, bit, pos, count, planepos, start_offset, end_offset, offset; int width2, len; byte *address; byte *VGLPlane[4]; switch (src->Type) { case VIDBUF4S: start_offset = (x & 0x07); end_offset = (x + width) & 0x07; count = (width + start_offset) / 8; if (end_offset) count++; VGLPlane[0] = VGLBuf; VGLPlane[1] = VGLPlane[0] + count; VGLPlane[2] = VGLPlane[1] + count; VGLPlane[3] = VGLPlane[2] + count; for (i=0; i<4; i++) { outb(0x3ce, 0x04); outb(0x3cf, i); pos = VGLAdpInfo.va_line_width*y + x/8; for (width2 = count; width2 > 0; ) { offset = VGLSetSegment(pos); len = min(VGLAdpInfo.va_window_size - offset, width2); bcopy(src->Bitmap + offset, &VGLPlane[i][count - width2], len); pos += len; width2 -= len; } } goto read_planar; case VIDBUF4: address = src->Bitmap + VGLAdpInfo.va_line_width * y + x/8; start_offset = (x & 0x07); end_offset = (x + width) & 0x07; count = (width + start_offset) / 8; if (end_offset) count++; VGLPlane[0] = VGLBuf; VGLPlane[1] = VGLPlane[0] + count; VGLPlane[2] = VGLPlane[1] + count; VGLPlane[3] = VGLPlane[2] + count; for (i=0; i<4; i++) { outb(0x3ce, 0x04); outb(0x3cf, i); bcopy(address, &VGLPlane[i][0], count); } read_planar: pos = 0; planepos = 0; bit = 7 - start_offset; while (pos < width) { for (; bit >= 0 && pos < width; bit--, pos++) { line[pos] = (VGLPlane[0][planepos] & (1<Bitmap + VGLAdpInfo.va_line_width * y + x/4; for (i=0; i<4; i++) { outb(0x3ce, 0x04); outb(0x3cf, (x + i)%4); for (planepos=0, pos=i; posVXsize * y + x; while (width > 0) { offset = VGLSetSegment(pos); i = min(VGLAdpInfo.va_window_size - offset, width); bcopy(src->Bitmap + offset, line, i); line += i; pos += i; width -= i; } break; case VIDBUF16S: case VIDBUF24S: case VIDBUF32S: width = width * src->PixelBytes; pos = (src->VXsize * y + x) * src->PixelBytes; while (width > 0) { offset = VGLSetSegment(pos); i = min(VGLAdpInfo.va_window_size - offset, width); bcopy(src->Bitmap + offset, line, i); line += i; pos += i; width -= i; } break; case VIDBUF8: case MEMBUF: address = src->Bitmap + src->VXsize * y + x; bcopy(address, line, width); break; case VIDBUF16: case VIDBUF24: case VIDBUF32: address = src->Bitmap + (src->VXsize * y + x) * src->PixelBytes; bcopy(address, line, width * src->PixelBytes); break; default: ; } } int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight) { int srcline, dstline; if (srcx>src->VXsize || srcy>src->VYsize || dstx>dst->VXsize || dsty>dst->VYsize) return -1; if (srcx < 0) { width=width+srcx; dstx-=srcx; srcx=0; } if (srcy < 0) { hight=hight+srcy; dsty-=srcy; srcy=0; } if (dstx < 0) { width=width+dstx; srcx-=dstx; dstx=0; } if (dsty < 0) { hight=hight+dsty; srcy-=dsty; dsty=0; } if (srcx+width > src->VXsize) width=src->VXsize-srcx; if (srcy+hight > src->VYsize) hight=src->VYsize-srcy; if (dstx+width > dst->VXsize) width=dst->VXsize-dstx; if (dsty+hight > dst->VYsize) hight=dst->VYsize-dsty; if (width < 0 || hight < 0) return -1; if (src->Type == MEMBUF) { for (srcline=srcy, dstline=dsty; srclineBitmap+(srcline*src->VXsize)+srcx)); } } else if (dst->Type == MEMBUF) { for (srcline=srcy, dstline=dsty; srclineBitmap+(dstline*dst->VXsize)+dstx)); } } else { byte buffer[2048]; /* XXX */ byte *p; - if (width > sizeof(buffer)) { - p = malloc(width); + if (width * src->PixelBytes > sizeof(buffer)) { + p = malloc(width * src->PixelBytes); if (p == NULL) return 1; } else { p = buffer; } for (srcline=srcy, dstline=dsty; srcline sizeof(buffer)) + if (width * src->PixelBytes > sizeof(buffer)) free(p); } return 0; } int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight) { int error; VGLMouseFreeze(dstx, dsty, width, hight, 0); error = __VGLBitmapCopy(src, srcx, srcy, dst, dstx, dsty, width, hight); VGLMouseUnFreeze(); return error; } VGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits) { VGLBitmap *object; if (type != MEMBUF) return NULL; if (xsize < 0 || ysize < 0) return NULL; object = (VGLBitmap *)malloc(sizeof(*object)); if (object == NULL) return NULL; object->Type = type; object->Xsize = xsize; object->Ysize = ysize; object->VXsize = xsize; object->VYsize = ysize; object->Xorigin = 0; object->Yorigin = 0; object->Bitmap = bits; + object->PixelBytes = VGLDisplay->PixelBytes; return object; } void VGLBitmapDestroy(VGLBitmap *object) { if (object->Bitmap) free(object->Bitmap); free(object); } int VGLBitmapAllocateBits(VGLBitmap *object) { - object->Bitmap = (byte *)malloc(object->VXsize*object->VYsize); + object->Bitmap = malloc(object->VXsize*object->VYsize*object->PixelBytes); if (object->Bitmap == NULL) return -1; return 0; } Index: head/lib/libvgl/main.c =================================================================== --- head/lib/libvgl/main.c (revision 345477) +++ head/lib/libvgl/main.c (revision 345478) @@ -1,576 +1,585 @@ /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include "vgl.h" /* XXX Direct Color 24bits modes unsupported */ #define min(x, y) (((x) < (y)) ? (x) : (y)) #define max(x, y) (((x) > (y)) ? (x) : (y)) VGLBitmap *VGLDisplay; video_info_t VGLModeInfo; video_adapter_info_t VGLAdpInfo; byte *VGLBuf; static int VGLMode; static int VGLOldMode; static size_t VGLBufSize; static byte *VGLMem = MAP_FAILED; static int VGLSwitchPending; static int VGLAbortPending; static int VGLOnDisplay; static unsigned int VGLCurWindow; static int VGLInitDone = 0; static vid_info_t VGLOldVInfo; void VGLEnd() { struct vt_mode smode; if (!VGLInitDone) return; VGLInitDone = 0; VGLSwitchPending = 0; VGLAbortPending = 0; signal(SIGUSR1, SIG_IGN); if (VGLMem != MAP_FAILED) { VGLClear(VGLDisplay, 0); munmap(VGLMem, VGLAdpInfo.va_window_size); } 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] = VGLOldVInfo.mv_csz; size[1] = VGLOldVInfo.mv_rsz; 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; ioctl(0, VT_SETMODE, &smode); if (VGLBuf) free(VGLBuf); VGLBuf = NULL; free(VGLDisplay); VGLDisplay = NULL; VGLKeyboardEnd(); } static void VGLAbort(int arg __unused) { VGLAbortPending = 1; signal(SIGINT, SIG_IGN); signal(SIGTERM, SIG_IGN); signal(SIGSEGV, SIG_IGN); signal(SIGBUS, SIG_IGN); signal(SIGUSR2, SIG_IGN); } static void VGLSwitch(int arg __unused) { if (!VGLOnDisplay) VGLOnDisplay = 1; else VGLOnDisplay = 0; VGLSwitchPending = 1; signal(SIGUSR1, VGLSwitch); } int VGLInit(int mode) { struct vt_mode smode; - int adptype; + int adptype, depth; if (VGLInitDone) return -1; signal(SIGUSR1, VGLSwitch); signal(SIGINT, VGLAbort); signal(SIGTERM, VGLAbort); signal(SIGSEGV, VGLAbort); signal(SIGBUS, VGLAbort); signal(SIGUSR2, SIG_IGN); VGLOnDisplay = 1; VGLSwitchPending = 0; VGLAbortPending = 0; if (ioctl(0, CONS_GET, &VGLOldMode) || ioctl(0, CONS_CURRENT, &adptype)) return -1; if (IOCGROUP(mode) == 'V') /* XXX: this is ugly */ VGLModeInfo.vi_mode = (mode & 0x0ff) + M_VESA_BASE; else VGLModeInfo.vi_mode = mode & 0x0ff; if (ioctl(0, CONS_MODEINFO, &VGLModeInfo)) /* FBIO_MODEINFO */ return -1; /* If current mode is VESA_800x600 then save its geometry to restore later */ if ((VGLOldMode >= M_VESA_BASE) && (VGLOldMode == M_VESA_800x600)) { VGLOldVInfo.size = sizeof(VGLOldVInfo); if (ioctl(0, CONS_GETINFO, &VGLOldVInfo)) return -1; } VGLDisplay = (VGLBitmap *)malloc(sizeof(VGLBitmap)); if (VGLDisplay == NULL) return -2; if (ioctl(0, KDENABIO, 0)) { free(VGLDisplay); return -3; } VGLInitDone = 1; /* * vi_mem_model specifies the memory model of the current video mode * in -CURRENT. */ switch (VGLModeInfo.vi_mem_model) { case V_INFO_MM_PLANAR: /* we can handle EGA/VGA planner modes only */ if (VGLModeInfo.vi_depth != 4 || VGLModeInfo.vi_planes != 4 || (adptype != KD_EGA && adptype != KD_VGA)) { VGLEnd(); return -4; } VGLDisplay->Type = VIDBUF4; + VGLDisplay->PixelBytes = 1; break; case V_INFO_MM_PACKED: /* we can do only 256 color packed modes */ if (VGLModeInfo.vi_depth != 8) { VGLEnd(); return -4; } VGLDisplay->Type = VIDBUF8; VGLDisplay->PixelBytes = 1; break; case V_INFO_MM_VGAX: VGLDisplay->Type = VIDBUF8X; VGLDisplay->PixelBytes = 1; break; case V_INFO_MM_DIRECT: VGLDisplay->PixelBytes = VGLModeInfo.vi_pixel_size; switch (VGLDisplay->PixelBytes) { case 2: VGLDisplay->Type = VIDBUF16; break; #if notyet case 3: VGLDisplay->Type = VIDBUF24; break; #endif case 4: VGLDisplay->Type = VIDBUF32; break; default: VGLEnd(); return -4; } break; default: VGLEnd(); return -4; } ioctl(0, VT_WAITACTIVE, 0); ioctl(0, KDSETMODE, KD_GRAPHICS); if (ioctl(0, mode, 0)) { VGLEnd(); return -5; } if (ioctl(0, CONS_ADPINFO, &VGLAdpInfo)) { /* FBIO_ADPINFO */ VGLEnd(); return -6; } /* * Calculate the shadow screen buffer size. In -CURRENT, va_buffer_size * always holds the entire frame buffer size, wheather it's in the linear * mode or windowed mode. * VGLBufSize = VGLAdpInfo.va_buffer_size; * In -STABLE, va_buffer_size holds the frame buffer size, only if * the linear frame buffer mode is supported. Otherwise the field is zero. * We shall calculate the minimal size in this case: * VGLAdpInfo.va_line_width*VGLModeInfo.vi_height*VGLModeInfo.vi_planes * or * VGLAdpInfo.va_window_size*VGLModeInfo.vi_planes; * Use whichever is larger. */ if (VGLAdpInfo.va_buffer_size != 0) VGLBufSize = VGLAdpInfo.va_buffer_size; else VGLBufSize = max(VGLAdpInfo.va_line_width*VGLModeInfo.vi_height, VGLAdpInfo.va_window_size)*VGLModeInfo.vi_planes; VGLBuf = malloc(VGLBufSize); if (VGLBuf == NULL) { VGLEnd(); return -7; } #ifdef LIBVGL_DEBUG fprintf(stderr, "VGLBufSize:0x%x\n", VGLBufSize); #endif /* see if we are in the windowed buffer mode or in the linear buffer mode */ if (VGLBufSize/VGLModeInfo.vi_planes > VGLAdpInfo.va_window_size) { switch (VGLDisplay->Type) { case VIDBUF4: VGLDisplay->Type = VIDBUF4S; break; case VIDBUF8: VGLDisplay->Type = VIDBUF8S; break; case VIDBUF16: VGLDisplay->Type = VIDBUF16S; break; case VIDBUF24: VGLDisplay->Type = VIDBUF24S; break; case VIDBUF32: VGLDisplay->Type = VIDBUF32S; break; default: VGLEnd(); return -8; } } VGLMode = mode; VGLCurWindow = 0; VGLDisplay->Xsize = VGLModeInfo.vi_width; VGLDisplay->Ysize = VGLModeInfo.vi_height; + depth = VGLModeInfo.vi_depth; + if (depth == 15) + depth = 16; VGLDisplay->VXsize = VGLAdpInfo.va_line_width - *8/(VGLModeInfo.vi_depth/VGLModeInfo.vi_planes); + *8/(depth/VGLModeInfo.vi_planes); VGLDisplay->VYsize = VGLBufSize/VGLModeInfo.vi_planes/VGLAdpInfo.va_line_width; VGLDisplay->Xorigin = 0; VGLDisplay->Yorigin = 0; VGLMem = (byte*)mmap(0, VGLAdpInfo.va_window_size, PROT_READ|PROT_WRITE, MAP_FILE | MAP_SHARED, 0, 0); if (VGLMem == MAP_FAILED) { VGLEnd(); return -7; } VGLDisplay->Bitmap = VGLMem; VGLSavePalette(); #ifdef LIBVGL_DEBUG fprintf(stderr, "va_line_width:%d\n", VGLAdpInfo.va_line_width); fprintf(stderr, "VGLXsize:%d, Ysize:%d, VXsize:%d, VYsize:%d\n", VGLDisplay->Xsize, VGLDisplay->Ysize, VGLDisplay->VXsize, VGLDisplay->VYsize); #endif smode.mode = VT_PROCESS; smode.waitv = 0; smode.relsig = SIGUSR1; smode.acqsig = SIGUSR1; smode.frsig = SIGINT; if (ioctl(0, VT_SETMODE, &smode)) { VGLEnd(); return -9; } VGLTextSetFontFile((byte*)0); VGLClear(VGLDisplay, 0); return 0; } void VGLCheckSwitch() { if (VGLAbortPending) { VGLEnd(); exit(0); } while (VGLSwitchPending) { unsigned int offset; unsigned int len; int i; VGLSwitchPending = 0; if (VGLOnDisplay) { ioctl(0, KDENABIO, 0); ioctl(0, KDSETMODE, KD_GRAPHICS); ioctl(0, VGLMode, 0); VGLCurWindow = 0; VGLMem = (byte*)mmap(0, VGLAdpInfo.va_window_size, PROT_READ|PROT_WRITE, MAP_FILE | MAP_SHARED, 0, 0); /* XXX: what if mmap() has failed! */ VGLDisplay->Type = VIDBUF8; /* XXX */ switch (VGLModeInfo.vi_mem_model) { case V_INFO_MM_PLANAR: if (VGLModeInfo.vi_depth == 4 && VGLModeInfo.vi_planes == 4) { if (VGLBufSize/VGLModeInfo.vi_planes > VGLAdpInfo.va_window_size) VGLDisplay->Type = VIDBUF4S; else VGLDisplay->Type = VIDBUF4; } else { /* shouldn't be happening */ } break; case V_INFO_MM_PACKED: if (VGLModeInfo.vi_depth == 8) { if (VGLBufSize/VGLModeInfo.vi_planes > VGLAdpInfo.va_window_size) VGLDisplay->Type = VIDBUF8S; else VGLDisplay->Type = VIDBUF8; } break; case V_INFO_MM_VGAX: VGLDisplay->Type = VIDBUF8X; break; case V_INFO_MM_DIRECT: switch (VGLModeInfo.vi_pixel_size) { case 2: if (VGLBufSize/VGLModeInfo.vi_planes > VGLAdpInfo.va_window_size) VGLDisplay->Type = VIDBUF16S; else VGLDisplay->Type = VIDBUF16; break; case 3: if (VGLBufSize/VGLModeInfo.vi_planes > VGLAdpInfo.va_window_size) VGLDisplay->Type = VIDBUF24S; else VGLDisplay->Type = VIDBUF24; break; case 4: if (VGLBufSize/VGLModeInfo.vi_planes > VGLAdpInfo.va_window_size) VGLDisplay->Type = VIDBUF32S; else VGLDisplay->Type = VIDBUF32; break; default: /* shouldn't be happening */ break; } default: /* shouldn't be happening */ break; } VGLDisplay->Bitmap = VGLMem; VGLDisplay->Xsize = VGLModeInfo.vi_width; VGLDisplay->Ysize = VGLModeInfo.vi_height; VGLSetVScreenSize(VGLDisplay, VGLDisplay->VXsize, VGLDisplay->VYsize); VGLPanScreen(VGLDisplay, VGLDisplay->Xorigin, VGLDisplay->Yorigin); switch (VGLDisplay->Type) { case VIDBUF4S: outb(0x3c6, 0xff); outb(0x3ce, 0x01); outb(0x3cf, 0x00); /* set/reset enable */ outb(0x3ce, 0x08); outb(0x3cf, 0xff); /* bit mask */ for (offset = 0; offset < VGLBufSize/VGLModeInfo.vi_planes; offset += len) { VGLSetSegment(offset); len = min(VGLBufSize/VGLModeInfo.vi_planes - offset, VGLAdpInfo.va_window_size); for (i = 0; i < VGLModeInfo.vi_planes; i++) { outb(0x3c4, 0x02); outb(0x3c5, 0x01<Type) { case VIDBUF4S: for (offset = 0; offset < VGLBufSize/VGLModeInfo.vi_planes; offset += len) { VGLSetSegment(offset); len = min(VGLBufSize/VGLModeInfo.vi_planes - offset, VGLAdpInfo.va_window_size); for (i = 0; i < VGLModeInfo.vi_planes; i++) { outb(0x3ce, 0x04); outb(0x3cf, i); bcopy(VGLMem, &VGLBuf[i*VGLBufSize/VGLModeInfo.vi_planes + offset], len); } } break; case VIDBUF4: case VIDBUF8X: /* * NOTE: the saved buffer is NOT in the MEMBUF format which * the ordinary memory bitmap object is stored in. XXX */ for (i = 0; i < VGLModeInfo.vi_planes; i++) { outb(0x3ce, 0x04); outb(0x3cf, i); bcopy(VGLMem, &VGLBuf[i*VGLAdpInfo.va_window_size], VGLAdpInfo.va_window_size); } break; case VIDBUF8: case VIDBUF8S: case VIDBUF16: case VIDBUF16S: case VIDBUF24: case VIDBUF24S: case VIDBUF32: case VIDBUF32S: for (offset = 0; offset < VGLBufSize; offset += len) { VGLSetSegment(offset); len = min(VGLBufSize - offset, VGLAdpInfo.va_window_size); bcopy(VGLMem, &VGLBuf[offset], len); } break; } VGLMem = MAP_FAILED; munmap(VGLDisplay->Bitmap, VGLAdpInfo.va_window_size); ioctl(0, VGLOldMode, 0); ioctl(0, KDSETMODE, KD_TEXT); ioctl(0, KDDISABIO, 0); ioctl(0, VT_RELDISP, VT_TRUE); VGLDisplay->Bitmap = VGLBuf; VGLDisplay->Type = MEMBUF; VGLDisplay->Xsize = VGLDisplay->VXsize; VGLDisplay->Ysize = VGLDisplay->VYsize; while (!VGLOnDisplay) pause(); } } } int VGLSetSegment(unsigned int offset) { if (offset/VGLAdpInfo.va_window_size != VGLCurWindow) { ioctl(0, CONS_SETWINORG, offset); /* FBIO_SETWINORG */ VGLCurWindow = offset/VGLAdpInfo.va_window_size; } return (offset%VGLAdpInfo.va_window_size); } int VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize) { + int depth; + if (VXsize < object->Xsize || VYsize < object->Ysize) return -1; if (object->Type == MEMBUF) return -1; if (ioctl(0, FBIO_SETLINEWIDTH, &VXsize)) return -1; ioctl(0, CONS_ADPINFO, &VGLAdpInfo); /* FBIO_ADPINFO */ + depth = VGLModeInfo.vi_depth; + if (depth == 15) + depth = 16; object->VXsize = VGLAdpInfo.va_line_width - *8/(VGLModeInfo.vi_depth/VGLModeInfo.vi_planes); + *8/(depth/VGLModeInfo.vi_planes); object->VYsize = VGLBufSize/VGLModeInfo.vi_planes/VGLAdpInfo.va_line_width; if (VYsize < object->VYsize) object->VYsize = VYsize; #ifdef LIBVGL_DEBUG fprintf(stderr, "new size: VGLXsize:%d, Ysize:%d, VXsize:%d, VYsize:%d\n", object->Xsize, object->Ysize, object->VXsize, object->VYsize); #endif return 0; } int VGLPanScreen(VGLBitmap *object, int x, int y) { video_display_start_t origin; if (x < 0 || x + object->Xsize > object->VXsize || y < 0 || y + object->Ysize > object->VYsize) return -1; if (object->Type == MEMBUF) return 0; origin.x = x; origin.y = y; if (ioctl(0, FBIO_SETDISPSTART, &origin)) return -1; object->Xorigin = x; object->Yorigin = y; #ifdef LIBVGL_DEBUG fprintf(stderr, "new origin: (%d, %d)\n", x, y); #endif return 0; } Index: head/lib/libvgl/mouse.c =================================================================== --- head/lib/libvgl/mouse.c (revision 345477) +++ head/lib/libvgl/mouse.c (revision 345478) @@ -1,287 +1,287 @@ /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include "vgl.h" #define X 0xff static byte StdAndMask[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE] = { X,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0, X,X,X,0,0,0,0,0,0,0,0,0,0,0,0,0, X,X,X,X,0,0,0,0,0,0,0,0,0,0,0,0, X,X,X,X,X,0,0,0,0,0,0,0,0,0,0,0, X,X,X,X,X,X,0,0,0,0,0,0,0,0,0,0, X,X,X,X,X,X,X,0,0,0,0,0,0,0,0,0, X,X,X,X,X,X,X,X,0,0,0,0,0,0,0,0, X,X,X,X,X,X,X,X,X,0,0,0,0,0,0,0, X,X,X,X,X,X,X,0,0,0,0,0,0,0,0,0, 0,0,0,X,X,X,X,0,0,0,0,0,0,0,0,0, 0,0,0,X,X,X,X,X,0,0,0,0,0,0,0,0, 0,0,0,0,X,X,X,X,0,0,0,0,0,0,0,0, 0,0,0,0,X,X,X,X,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; static byte StdOrMask[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,X,X,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,X,X,X,0,0,0,0,0,0,0,0,0,0,0,0, 0,X,X,X,X,0,0,0,0,0,0,0,0,0,0,0, 0,X,X,X,X,X,0,0,0,0,0,0,0,0,0,0, 0,X,X,X,X,X,X,0,0,0,0,0,0,0,0,0, 0,X,X,0,X,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,X,X,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,X,X,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,X,X,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,X,X,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; #undef X static VGLBitmap VGLMouseStdAndMask = VGLBITMAP_INITIALIZER(MEMBUF, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE, StdAndMask); static VGLBitmap VGLMouseStdOrMask = VGLBITMAP_INITIALIZER(MEMBUF, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE, StdOrMask); static VGLBitmap *VGLMouseAndMask, *VGLMouseOrMask; -static byte map[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE]; +static byte map[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE*4]; static VGLBitmap VGLMouseSave = VGLBITMAP_INITIALIZER(MEMBUF, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE, map); static int VGLMouseVisible = 0; static int VGLMouseFrozen = 0; static int VGLMouseShown = 0; static int VGLMouseXpos = 0; static int VGLMouseYpos = 0; static int VGLMouseButtons = 0; void VGLMousePointerShow() { - byte buf[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE]; + byte buf[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE*4]; VGLBitmap buffer = VGLBITMAP_INITIALIZER(MEMBUF, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE, buf); byte crtcidx, crtcval, gdcidx, gdcval; int pos; if (!VGLMouseVisible) { VGLMouseVisible = 1; crtcidx = inb(0x3c4); crtcval = inb(0x3c5); gdcidx = inb(0x3ce); gdcval = inb(0x3cf); __VGLBitmapCopy(VGLDisplay, VGLMouseXpos, VGLMouseYpos, &VGLMouseSave, 0, 0, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE); bcopy(VGLMouseSave.Bitmap, buffer.Bitmap, MOUSE_IMG_SIZE*MOUSE_IMG_SIZE); for (pos = 0; pos < MOUSE_IMG_SIZE*MOUSE_IMG_SIZE; pos++) buffer.Bitmap[pos]=(buffer.Bitmap[pos]&~(VGLMouseAndMask->Bitmap[pos])) | VGLMouseOrMask->Bitmap[pos]; __VGLBitmapCopy(&buffer, 0, 0, VGLDisplay, VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE); outb(0x3c4, crtcidx); outb(0x3c5, crtcval); outb(0x3ce, gdcidx); outb(0x3cf, gdcval); } } void VGLMousePointerHide() { byte crtcidx, crtcval, gdcidx, gdcval; if (VGLMouseVisible) { VGLMouseVisible = 0; crtcidx = inb(0x3c4); crtcval = inb(0x3c5); gdcidx = inb(0x3ce); gdcval = inb(0x3cf); __VGLBitmapCopy(&VGLMouseSave, 0, 0, VGLDisplay, VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE); outb(0x3c4, crtcidx); outb(0x3c5, crtcval); outb(0x3ce, gdcidx); outb(0x3cf, gdcval); } } void VGLMouseMode(int mode) { if (mode == VGL_MOUSESHOW) { if (VGLMouseShown == VGL_MOUSEHIDE) { VGLMousePointerShow(); VGLMouseShown = VGL_MOUSESHOW; } } else { if (VGLMouseShown == VGL_MOUSESHOW) { VGLMousePointerHide(); VGLMouseShown = VGL_MOUSEHIDE; } } } void VGLMouseAction(int dummy) { struct mouse_info mouseinfo; if (VGLMouseFrozen) { VGLMouseFrozen++; return; } mouseinfo.operation = MOUSE_GETINFO; ioctl(0, CONS_MOUSECTL, &mouseinfo); if (VGLMouseShown == VGL_MOUSESHOW) VGLMousePointerHide(); VGLMouseXpos = mouseinfo.u.data.x; VGLMouseYpos = mouseinfo.u.data.y; VGLMouseButtons = mouseinfo.u.data.buttons; if (VGLMouseShown == VGL_MOUSESHOW) VGLMousePointerShow(); } void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask) { if (VGLMouseShown == VGL_MOUSESHOW) VGLMousePointerHide(); VGLMouseAndMask = AndMask; VGLMouseOrMask = OrMask; if (VGLMouseShown == VGL_MOUSESHOW) VGLMousePointerShow(); } void VGLMouseSetStdImage() { if (VGLMouseShown == VGL_MOUSESHOW) VGLMousePointerHide(); VGLMouseAndMask = &VGLMouseStdAndMask; VGLMouseOrMask = &VGLMouseStdOrMask; if (VGLMouseShown == VGL_MOUSESHOW) VGLMousePointerShow(); } int VGLMouseInit(int mode) { struct mouse_info mouseinfo; int error; VGLMouseSetStdImage(); mouseinfo.operation = MOUSE_MODE; mouseinfo.u.mode.signal = SIGUSR2; if ((error = ioctl(0, CONS_MOUSECTL, &mouseinfo))) return error; signal(SIGUSR2, VGLMouseAction); mouseinfo.operation = MOUSE_GETINFO; ioctl(0, CONS_MOUSECTL, &mouseinfo); VGLMouseXpos = mouseinfo.u.data.x; VGLMouseYpos = mouseinfo.u.data.y; VGLMouseButtons = mouseinfo.u.data.buttons; VGLMouseMode(mode); return 0; } int VGLMouseStatus(int *x, int *y, char *buttons) { signal(SIGUSR2, SIG_IGN); *x = VGLMouseXpos; *y = VGLMouseYpos; *buttons = VGLMouseButtons; signal(SIGUSR2, VGLMouseAction); return VGLMouseShown; } int VGLMouseFreeze(int x, int y, int width, int hight, byte color) { if (!VGLMouseFrozen) { VGLMouseFrozen = 1; if (width > 1 || hight > 1) { /* bitmap */ if (VGLMouseShown == 1) { int overlap; if (x > VGLMouseXpos) overlap = (VGLMouseXpos + MOUSE_IMG_SIZE) - x; else overlap = (x + width) - VGLMouseXpos; if (overlap > 0) { if (y > VGLMouseYpos) overlap = (VGLMouseYpos + MOUSE_IMG_SIZE) - y; else overlap = (y + hight) - VGLMouseYpos; if (overlap > 0) VGLMousePointerHide(); } } } else { /* bit */ if (VGLMouseShown && x >= VGLMouseXpos && x < VGLMouseXpos + MOUSE_IMG_SIZE && y >= VGLMouseYpos && y < VGLMouseYpos + MOUSE_IMG_SIZE) { VGLMouseSave.Bitmap[(y-VGLMouseYpos)*MOUSE_IMG_SIZE+(x-VGLMouseXpos)] = (color); if (VGLMouseAndMask->Bitmap [(y-VGLMouseYpos)*MOUSE_IMG_SIZE+(x-VGLMouseXpos)]) { return 1; } } } } return 0; } void VGLMouseUnFreeze() { if (VGLMouseFrozen > 1) { VGLMouseFrozen = 0; VGLMouseAction(0); } else { VGLMouseFrozen = 0; if (VGLMouseShown == VGL_MOUSESHOW && !VGLMouseVisible) VGLMousePointerShow(); } } Index: head/lib/libvgl/vgl.h =================================================================== --- head/lib/libvgl/vgl.h (revision 345477) +++ head/lib/libvgl/vgl.h (revision 345478) @@ -1,156 +1,156 @@ /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _VGL_H_ #define _VGL_H_ #include #include #include #include typedef unsigned char byte; typedef struct { byte Type; int Xsize, Ysize; int VXsize, VYsize; int Xorigin, Yorigin; byte *Bitmap; int PixelBytes; } VGLBitmap; #define VGLBITMAP_INITIALIZER(t, x, y, bits) \ - { (t), (x), (y), (x), (y), 0, 0, (bits) } + { (t), (x), (y), (x), (y), 0, 0, (bits), -1 } /* * Defined Type's */ #define MEMBUF 0 #define VIDBUF4 1 #define VIDBUF8 2 #define VIDBUF8X 3 #define VIDBUF8S 4 #define VIDBUF4S 5 #define VIDBUF16 6 /* Direct Color linear buffer */ #define VIDBUF24 7 /* Direct Color linear buffer */ #define VIDBUF32 8 /* Direct Color linear buffer */ #define VIDBUF16S 9 /* Direct Color segmented buffer */ #define VIDBUF24S 10 /* Direct Color segmented buffer */ #define VIDBUF32S 11 /* Direct Color segmented buffer */ #define NOBUF 255 typedef struct VGLText { byte Width, Height; byte *BitmapArray; } VGLText; typedef struct VGLObject { int Id; int Type; int Status; int Xpos, Ypos; int Xhot, Yhot; VGLBitmap *Image; VGLBitmap *Mask; int (*CallBackFunction)(); } VGLObject; #define MOUSE_IMG_SIZE 16 #define VGL_MOUSEHIDE 0 #define VGL_MOUSESHOW 1 #define VGL_MOUSEFREEZE 0 #define VGL_MOUSEUNFREEZE 1 #define VGL_DIR_RIGHT 0 #define VGL_DIR_UP 1 #define VGL_DIR_LEFT 2 #define VGL_DIR_DOWN 3 #define VGL_RAWKEYS 1 #define VGL_CODEKEYS 2 #define VGL_XLATEKEYS 3 extern video_adapter_info_t VGLAdpInfo; extern video_info_t VGLModeInfo; extern VGLBitmap *VGLDisplay; extern byte *VGLBuf; /* * Prototypes */ /* bitmap.c */ int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight); VGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits); void VGLBitmapDestroy(VGLBitmap *object); int VGLBitmapAllocateBits(VGLBitmap *object); /* keyboard.c */ int VGLKeyboardInit(int mode); void VGLKeyboardEnd(void); int VGLKeyboardGetCh(void); /* main.c */ void VGLEnd(void); int VGLInit(int mode); void VGLCheckSwitch(void); int VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize); int VGLPanScreen(VGLBitmap *object, int x, int y); int VGLSetSegment(unsigned int offset); /* mouse.c */ void VGLMousePointerShow(void); void VGLMousePointerHide(void); void VGLMouseMode(int mode); void VGLMouseAction(int dummy); void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask); void VGLMouseSetStdImage(void); int VGLMouseInit(int mode); int VGLMouseStatus(int *x, int *y, char *buttons); int VGLMouseFreeze(int x, int y, int width, int hight, byte color); void VGLMouseUnFreeze(void); /* simple.c */ void VGLSetXY(VGLBitmap *object, int x, int y, u_long color); u_long VGLGetXY(VGLBitmap *object, int x, int y); void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color); void VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color); void VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color); void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color); void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color); void VGLClear(VGLBitmap *object, u_long color); void VGLRestorePalette(void); void VGLSavePalette(void); void VGLSetPalette(byte *red, byte *green, byte *blue); void VGLSetPaletteIndex(byte color, byte red, byte green, byte blue); void VGLSetBorder(byte color); void VGLBlankDisplay(int blank); /* text.c */ int VGLTextSetFontFile(char *filename); void VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, byte bgcol, int fill, int dir); void VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, byte bgcol, int fill, int dir); #endif /* !_VGL_H_ */