aboutsummaryrefslogtreecommitdiff
path: root/graphics/svgalib
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2000-10-02 08:27:25 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2000-10-02 08:27:25 +0000
commit5821e9cebad86e45f27c533795ec7dc0ba11dd22 (patch)
treeb287442a48bd58b9a71031e76f8aef6385ede6cd /graphics/svgalib
parentb17fb10d6237d9e4ea6e104a5b232dfb451c08a6 (diff)
downloadports-5821e9cebad86e45f27c533795ec7dc0ba11dd22.tar.gz
ports-5821e9cebad86e45f27c533795ec7dc0ba11dd22.zip
Notes
Diffstat (limited to 'graphics/svgalib')
-rw-r--r--graphics/svgalib/Makefile101
-rw-r--r--graphics/svgalib/files/man111
-rw-r--r--graphics/svgalib/files/man3194
-rw-r--r--graphics/svgalib/files/man53
-rw-r--r--graphics/svgalib/files/man623
-rw-r--r--graphics/svgalib/files/man77
-rw-r--r--graphics/svgalib/files/man81
-rw-r--r--graphics/svgalib/files/patch-aq13
-rw-r--r--graphics/svgalib/files/patch-ay325
9 files changed, 585 insertions, 93 deletions
diff --git a/graphics/svgalib/Makefile b/graphics/svgalib/Makefile
index 4ba7cc9b619b..0155f2383819 100644
--- a/graphics/svgalib/Makefile
+++ b/graphics/svgalib/Makefile
@@ -1,115 +1,34 @@
# New ports collection makefile for: svgalib
# Date created: 24 August 2000
-# Whom: sobomax@FreeBSD.org
+# Whom: Maxim Sobolev <sobomax@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= svgalib
PORTVERSION= 1.4.2
+PORTREVISION= 1
CATEGORIES= graphics devel
MASTER_SITES= http://www.svgalib.org/
-MAINTAINER= sobomax@freebsd.org
+MAINTAINER= sobomax@FreeBSD.org
USE_GMAKE= yes
INSTALLS_SHLIB= yes
ALL_TARGET= shared static
-MAN1= convfont.1 dumpreg.1 fix132x43.1 restorefont.1 \
- restorepalette.1 restoretextmode.1 runx.1 \
- savetextmode.1 setmclk.1 svgakeymap.1 \
- textmode.1
-MAN3= currentcontext.3 gl_allocatecontext.3 gl_bcircle.3 \
- gl_circle.3 gl_clearscreen.3 gl_colorfont.3 \
- gl_compileboxmask.3 gl_compiledboxmasksize.3 \
- gl_copybox.3 gl_copyboxfromcontext.3 \
- gl_copyboxtocontext.3 gl_copyscreen.3 \
- gl_disableclipping.3 gl_enableclipping.3 \
- gl_enablepageflipping.3 gl_expandfont.3 gl_fillbox.3 \
- gl_fillcircle.3 gl_font8x8.3 gl_freecontext.3 \
- gl_getbox.3 gl_getcontext.3 gl_getpalette.3 \
- gl_getpalettecolor.3 gl_getpalettecolors.3 \
- gl_getpixel.3 gl_getpixelrgb.3 gl_hline.3 gl_line.3 \
- gl_printf.3 gl_putbox.3 gl_putboxmask.3 \
- gl_putboxmaskcompiled.3 gl_putboxpart.3 gl_rgbcolor.3 \
- gl_scalebox.3 gl_setclippingwindow.3 gl_setcontext.3 \
- gl_setcontextheight.3 gl_setcontextvga.3 \
- gl_setcontextvgavirtual.3 gl_setcontextvirtual.3 \
- gl_setcontextwidth.3 gl_setdisplaystart.3 gl_setfont.3 \
- gl_setfontcolors.3 gl_setpalette.3 gl_setpalettecolor.3 \
- gl_setpalettecolors.3 gl_setpixel.3 gl_setpixelrgb.3 \
- gl_setrgbpalette.3 gl_setscreenoffset.3 \
- gl_setwritemode.3 gl_striangle.3 gl_swtriangle.3 \
- gl_triangle.3 gl_trigetcolorlookup.3 \
- gl_trisetcolorlookup.3 gl_trisetdrawpoint.3 gl_write.3 \
- gl_writen.3 gl_wtriangle.3 graph_mem.3 \
- joystick_button1.3 joystick_button2.3 \
- joystick_button3.3 joystick_button4.3 joystick_close.3 \
- joystick_getaxis.3 joystick_getb1.3 joystick_getb2.3 \
- joystick_getb3.3 joystick_getb4.3 joystick_getbutton.3 \
- joystick_getnumaxes.3 joystick_getnumbuttons.3 \
- joystick_getx.3 joystick_gety.3 joystick_getz.3 \
- joystick_init.3 joystick_setdefaulthandler.3 \
- joystick_sethandler.3 joystick_update.3 joystick_x.3 \
- joystick_y.3 joystick_z.3 keyboard_clearstate.3 \
- keyboard_close.3 keyboard_getstate.3 keyboard_init.3 \
- keyboard_init_return_fd.3 keyboard_keypressed.3 \
- keyboard_setdefaulteventhandler.3 \
- keyboard_seteventhandler.3 keyboard_translatekeys.3 \
- keyboard_update.3 keyboard_waitforupdate.3 \
- mouse_close.3 mouse_getbutton.3 mouse_getcaps.3 \
- mouse_getposition_6d.3 mouse_getx.3 mouse_gety.3 \
- mouse_init.3 mouse_init_return_fd.3 \
- mouse_setdefaulteventhandler.3 mouse_seteventhandler.3 \
- mouse_setposition.3 mouse_setposition_6d.3 \
- mouse_setrange_6d.3 mouse_setscale.3 mouse_setwrap.3 \
- mouse_setxrange.3 mouse_setyrange.3 mouse_update.3 \
- mouse_waitforupdate.3 vga_accel.3 vga_addmode.3 \
- vga_addtiming.3 vga_bitblt.3 vga_blitwait.3 \
- vga_changetiming.3 vga_claimvideomemory.3 vga_clear.3 \
- vga_copytoplanar16.3 vga_copytoplanar256.3 \
- vga_copytoplane.3 vga_disabledriverreport.3 \
- vga_drawline.3 vga_drawpixel.3 vga_drawscanline.3 \
- vga_drawscansegment.3 vga_dumpregs.3 vga_ext_set.3 \
- vga_fillblt.3 vga_flip.3 vga_getch.3 vga_getcolors.3 \
- vga_getcurrentchipset.3 vga_getcurrentmode.3 \
- vga_getcurrenttiming.3 vga_getdefaultmode.3 \
- vga_getgraphmem.3 vga_getkey.3 vga_getmodeinfo.3 \
- vga_getmodename.3 vga_getmodenumber.3 \
- vga_getmonitortype.3 vga_getmousetype.3 \
- vga_getpalette.3 vga_getpalvec.3 vga_getpixel.3 \
- vga_getscansegment.3 vga_gettextfont.3 \
- vga_gettextmoderegs.3 vga_getxdim.3 vga_getydim.3 \
- vga_guesstiming.3 vga_hasmode.3 vga_hlinelistblt.3 \
- vga_imageblt.3 vga_init.3 vga_lastmodenumber.3 \
- vga_lockvc.3 vga_oktowrite.3 vga_puttextfont.3 \
- vga_runinbackground.3 vga_runinbackground_version.3 \
- vga_safety_fork.3 vga_screenoff.3 vga_screenon.3 \
- vga_setchipset.3 vga_setchipsetandfeatures.3 \
- vga_setcolor.3 vga_setdisplaystart.3 vga_setegacolor.3 \
- vga_setflipchar.3 vga_setlinearaddressing.3 \
- vga_setlogicalwidth.3 vga_setmode.3 vga_setmodeX.3 \
- vga_setmousesupport.3 vga_setpage.3 vga_setpalette.3 \
- vga_setpalvec.3 vga_setreadpage.3 vga_setrgbcolor.3 \
- vga_settextmoderegs.3 vga_setwritepage.3 vga_unlockvc.3 \
- vga_waitevent.3 vga_waitretrace.3 vga_white.3
-MAN5= libvga.config.5 libvga.et4000.5 svgalibrc.5
-MAN6= accel.6 bg_test.6 eventtest.6 forktest.6 fun.6 \
- joytest.6 keytest.6 lineart.6 mach32info.6 mjoytest.6 \
- mousetest.6 plane.6 printftest.6 scrolltest.6 \
- speedtest.6 spin.6 svidtune.6 testaccel.6 testgl.6 \
- testlinear.6 threed.6 vgatest.6 wrapdemo.6
-MAN7= svgalib.7 svgalib.chips.7 svgalib.et4000.7 \
- svgalib.faq.7 svgalib.mach32.7 threedkit.7 vgagl.7
-MAN8= mode3.8
-
.include <bsd.port.pre.mk>
.if ${OSVERSION} < 400000
-BROKEN= "3.* doesn't supported - please upgrade to use the port"
+BROKEN= "3.* isn't supported - please upgrade to use the port"
+.endif
+
+.for i in 1 2 3 4 5 6 7 8 9
+.if exists(${FILESDIR}/man${i})
+MAN${i}!= /bin/cat ${FILESDIR}/man${i}
.endif
+.endfor
pre-patch:
${PERL} -pi -e 's.\x0D..' ${WRKSRC}/utils/gtf/*
diff --git a/graphics/svgalib/files/man1 b/graphics/svgalib/files/man1
new file mode 100644
index 000000000000..a27d7ad25f2a
--- /dev/null
+++ b/graphics/svgalib/files/man1
@@ -0,0 +1,11 @@
+convfont.1
+dumpreg.1
+fix132x43.1
+restorefont.1
+restorepalette.1
+restoretextmode.1
+runx.1
+savetextmode.1
+setmclk.1
+svgakeymap.1
+textmode.1
diff --git a/graphics/svgalib/files/man3 b/graphics/svgalib/files/man3
new file mode 100644
index 000000000000..6363ee3c89c1
--- /dev/null
+++ b/graphics/svgalib/files/man3
@@ -0,0 +1,194 @@
+currentcontext.3
+gl_allocatecontext.3
+gl_bcircle.3
+gl_circle.3
+gl_clearscreen.3
+gl_colorfont.3
+gl_compileboxmask.3
+gl_compiledboxmasksize.3
+gl_copybox.3
+gl_copyboxfromcontext.3
+gl_copyboxtocontext.3
+gl_copyscreen.3
+gl_disableclipping.3
+gl_enableclipping.3
+gl_enablepageflipping.3
+gl_expandfont.3
+gl_fillbox.3
+gl_fillcircle.3
+gl_font8x8.3
+gl_freecontext.3
+gl_getbox.3
+gl_getcontext.3
+gl_getpalette.3
+gl_getpalettecolor.3
+gl_getpalettecolors.3
+gl_getpixel.3
+gl_getpixelrgb.3
+gl_hline.3
+gl_line.3
+gl_printf.3
+gl_putbox.3
+gl_putboxmask.3
+gl_putboxmaskcompiled.3
+gl_putboxpart.3
+gl_rgbcolor.3
+gl_scalebox.3
+gl_setclippingwindow.3
+gl_setcontext.3
+gl_setcontextheight.3
+gl_setcontextvga.3
+gl_setcontextvgavirtual.3
+gl_setcontextvirtual.3
+gl_setcontextwidth.3
+gl_setdisplaystart.3
+gl_setfont.3
+gl_setfontcolors.3
+gl_setpalette.3
+gl_setpalettecolor.3
+gl_setpalettecolors.3
+gl_setpixel.3
+gl_setpixelrgb.3
+gl_setrgbpalette.3
+gl_setscreenoffset.3
+gl_setwritemode.3
+gl_striangle.3
+gl_swtriangle.3
+gl_triangle.3
+gl_trigetcolorlookup.3
+gl_trisetcolorlookup.3
+gl_trisetdrawpoint.3
+gl_write.3
+gl_writen.3
+gl_wtriangle.3
+graph_mem.3
+joystick_button1.3
+joystick_button2.3
+joystick_button3.3
+joystick_button4.3
+joystick_close.3
+joystick_getaxis.3
+joystick_getb1.3
+joystick_getb2.3
+joystick_getb3.3
+joystick_getb4.3
+joystick_getbutton.3
+joystick_getnumaxes.3
+joystick_getnumbuttons.3
+joystick_getx.3
+joystick_gety.3
+joystick_getz.3
+joystick_init.3
+joystick_setdefaulthandler.3
+joystick_sethandler.3
+joystick_update.3
+joystick_x.3
+joystick_y.3
+joystick_z.3
+keyboard_clearstate.3
+keyboard_close.3
+keyboard_getstate.3
+keyboard_init.3
+keyboard_init_return_fd.3
+keyboard_keypressed.3
+keyboard_setdefaulteventhandler.3
+keyboard_seteventhandler.3
+keyboard_translatekeys.3
+keyboard_update.3
+keyboard_waitforupdate.3
+mouse_close.3
+mouse_getbutton.3
+mouse_getcaps.3
+mouse_getposition_6d.3
+mouse_getx.3
+mouse_gety.3
+mouse_init.3
+mouse_init_return_fd.3
+mouse_setdefaulteventhandler.3
+mouse_seteventhandler.3
+mouse_setposition.3
+mouse_setposition_6d.3
+mouse_setrange_6d.3
+mouse_setscale.3
+mouse_setwrap.3
+mouse_setxrange.3
+mouse_setyrange.3
+mouse_update.3
+mouse_waitforupdate.3
+vga_accel.3
+vga_addmode.3
+vga_addtiming.3
+vga_bitblt.3
+vga_blitwait.3
+vga_changetiming.3
+vga_claimvideomemory.3
+vga_clear.3
+vga_copytoplanar16.3
+vga_copytoplanar256.3
+vga_copytoplane.3
+vga_disabledriverreport.3
+vga_drawline.3
+vga_drawpixel.3
+vga_drawscanline.3
+vga_drawscansegment.3
+vga_dumpregs.3
+vga_ext_set.3
+vga_fillblt.3
+vga_flip.3
+vga_getch.3
+vga_getcolors.3
+vga_getcurrentchipset.3
+vga_getcurrentmode.3
+vga_getcurrenttiming.3
+vga_getdefaultmode.3
+vga_getgraphmem.3
+vga_getkey.3
+vga_getmodeinfo.3
+vga_getmodename.3
+vga_getmodenumber.3
+vga_getmonitortype.3
+vga_getmousetype.3
+vga_getpalette.3
+vga_getpalvec.3
+vga_getpixel.3
+vga_getscansegment.3
+vga_gettextfont.3
+vga_gettextmoderegs.3
+vga_getxdim.3
+vga_getydim.3
+vga_guesstiming.3
+vga_hasmode.3
+vga_hlinelistblt.3
+vga_imageblt.3
+vga_init.3
+vga_lastmodenumber.3
+vga_lockvc.3
+vga_oktowrite.3
+vga_puttextfont.3
+vga_runinbackground.3
+vga_runinbackground_version.3
+vga_safety_fork.3
+vga_screenoff.3
+vga_screenon.3
+vga_setchipset.3
+vga_setchipsetandfeatures.3
+vga_setcolor.3
+vga_setdisplaystart.3
+vga_setegacolor.3
+vga_setflipchar.3
+vga_setlinearaddressing.3
+vga_setlogicalwidth.3
+vga_setmode.3
+vga_setmodeX.3
+vga_setmousesupport.3
+vga_setpage.3
+vga_setpalette.3
+vga_setpalvec.3
+vga_setreadpage.3
+vga_setrgbcolor.3
+vga_settextmoderegs.3
+vga_setwritepage.3
+vga_unlockvc.3
+vga_waitevent.3
+vga_waitretrace.3
+vga_white.3
diff --git a/graphics/svgalib/files/man5 b/graphics/svgalib/files/man5
new file mode 100644
index 000000000000..43c9d4140516
--- /dev/null
+++ b/graphics/svgalib/files/man5
@@ -0,0 +1,3 @@
+libvga.config.5
+libvga.et4000.5
+svgalibrc.5
diff --git a/graphics/svgalib/files/man6 b/graphics/svgalib/files/man6
new file mode 100644
index 000000000000..bc184c6d6c7a
--- /dev/null
+++ b/graphics/svgalib/files/man6
@@ -0,0 +1,23 @@
+accel.6
+bg_test.6
+eventtest.6
+forktest.6
+fun.6
+joytest.6
+keytest.6
+lineart.6
+mach32info.6
+mjoytest.6
+mousetest.6
+plane.6
+printftest.6
+scrolltest.6
+speedtest.6
+spin.6
+svidtune.6
+testaccel.6
+testgl.6
+testlinear.6
+threed.6
+vgatest.6
+wrapdemo.6
diff --git a/graphics/svgalib/files/man7 b/graphics/svgalib/files/man7
new file mode 100644
index 000000000000..a949a20a215a
--- /dev/null
+++ b/graphics/svgalib/files/man7
@@ -0,0 +1,7 @@
+svgalib.7
+svgalib.chips.7
+svgalib.et4000.7
+svgalib.faq.7
+svgalib.mach32.7
+threedkit.7
+vgagl.7
diff --git a/graphics/svgalib/files/man8 b/graphics/svgalib/files/man8
new file mode 100644
index 000000000000..586c07744302
--- /dev/null
+++ b/graphics/svgalib/files/man8
@@ -0,0 +1 @@
+mode3.8
diff --git a/graphics/svgalib/files/patch-aq b/graphics/svgalib/files/patch-aq
index 780ffc0ea36b..72bb2fbb4290 100644
--- a/graphics/svgalib/files/patch-aq
+++ b/graphics/svgalib/files/patch-aq
@@ -1,5 +1,14 @@
---- gl/Makefile.orig Fri Aug 25 06:05:40 2000
-+++ gl/Makefile Fri Aug 25 06:06:28 2000
+--- gl/Makefile.orig Sun Jul 18 16:14:45 1999
++++ gl/Makefile Sat Sep 30 20:27:36 2000
+@@ -23,7 +23,7 @@
+ #----------------------------------------------------------------------
+
+ MODULES = grlib.o driver.o line.o palette.o scale.o text.o font8x8.o \
+- cbitmap.o mem.o
++ cbitmap.o mem.o cctext.o
+
+ all: libvgagl.a
+ .PHONY: all clean dep
@@ -31,6 +31,7 @@
libvgagl.so.$(VERSION): $(MODULES)
$(CC) -s -shared -Wl,-soname,libvgagl.so.$(MAJOR_VER) -o libvgagl.so.$(VERSION) \
diff --git a/graphics/svgalib/files/patch-ay b/graphics/svgalib/files/patch-ay
new file mode 100644
index 000000000000..31c2f7dce469
--- /dev/null
+++ b/graphics/svgalib/files/patch-ay
@@ -0,0 +1,325 @@
+--- gl/cctext.c.orig Sat Sep 30 20:48:05 2000
++++ gl/cctext.c Mon Sep 20 23:00:19 1999
+@@ -0,0 +1,322 @@
++/* Framebuffer Graphics Libary for Linux,
++ * Copyright 1998 Wei Yongming
++ * This code is based on partially Harm Hanemaayer's work.
++ */
++/* cctext.c Chinese (two-byte) Character text writing and fonts */
++
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <stdarg.h>
++#include <vga.h>
++#include "inlstring.h" /* include inline string operations */
++
++#include "vgagl.h"
++#include "def.h"
++
++
++/* CCText/font functions */
++// The default font matrics values.
++static int afont_width = 8;
++static int cfont_width = 16;
++static int font_height = 16;
++static char *afont_address;
++static char *cfont_address;
++static int afont_charsize = 128;
++static int cfont_charsize = 256;
++// The writemode of cc font is always COMPRESSED.
++static int font_writemode = WRITEMODE_OVERWRITE;
++static int compressed_font_bg = 0;
++static int compressed_font_fg = 15;
++
++void gl_setccfont(int afw, int cfw, int fh, void *afont, void* cfont)
++{
++ afont_width = afw;
++ cfont_width = cfw;
++ font_height = fh;
++ afont_charsize = afont_width * font_height * BYTESPERPIXEL;
++ cfont_charsize = cfont_width * font_height * BYTESPERPIXEL;
++ afont_address = afont;
++ cfont_address = cfont;
++}
++
++void gl_setccwritemode(int m)
++{
++ font_writemode = m;
++}
++
++void gl_setccfontcolors(int bg, int fg)
++{
++ compressed_font_bg = bg;
++ compressed_font_fg = fg;
++}
++
++void gl_ccwriten(int x, int y, int n, char *s)
++{
++ char *str = alloca(n + 1);
++ memcpy(str, s, n);
++ str[n] = 0;
++ gl_ccwrite(x, y, str);
++}
++
++#ifndef SVGA_AOUT
++
++static int ccnprintf(int sx, int sy,
++ size_t bufs, const char *fmt, va_list args)
++{
++ char *buf;
++ static int x = 0, y = 0, x_start = 0;
++ int n;
++
++ buf = alloca(bufs);
++ n = vsnprintf(buf, bufs, fmt, args);
++ if (n < 0)
++ return n; /* buffer did not suffice, return and retry */
++
++ if ((sx >= 0) && (sy >= 0)) {
++ x = x_start = sx;
++ y = sy;
++ }
++
++ for (; *buf; buf++)
++ switch (*buf) {
++ case '\a': /* badly implemented */
++ fputc('\a', stdout);
++ fflush(stdout);
++ break;
++ case '\b':
++ x -= afont_width;
++ if (x < x_start) {
++ x = WIDTH + (x_start % afont_width);
++ while(x + afont_width > WIDTH)
++ x -= afont_width;
++ if (y >= font_height)
++ y -= font_height;
++ }
++ break;
++ case '\n':
++ newline:
++ y += font_height;
++ if (y + font_height > HEIGHT)
++ y %= font_height;
++ case '\r':
++ x = x_start;
++ break;
++ case '\t':
++ x += ((TEXT_TABSIZE -
++ ((x - x_start) / afont_width) % TEXT_TABSIZE) * afont_width);
++ goto chk_wrap;
++ break;
++ case '\v':
++ y += font_height;
++ if (y + font_height > HEIGHT)
++ y %= font_height;
++ break;
++ default:
++ if( ((unsigned char)(*buf) > 0xa0)
++ && ((unsigned char)(*(buf + 1)) > 0xa0)) {
++ gl_ccwriten(x, y, 2, buf);
++ buf += 1;
++ x += cfont_width;
++ }
++ else {
++ gl_ccwriten(x, y, 1, buf);
++ x += afont_width;
++ }
++ chk_wrap:
++ if (x + afont_width > WIDTH)
++ goto newline;
++ }
++ return n;
++}
++
++int gl_ccprintf(int x, int y, const char *fmt, ...)
++{
++ size_t bufs = BUFSIZ;
++ int result;
++ va_list args;
++
++ va_start(args, fmt);
++
++ /* Loop until buffer size suffices */
++ do {
++ result = ccnprintf(x, y, bufs, fmt, args);
++ bufs <<= 1;
++ } while(result < 0);
++
++ va_end(args);
++ return result;
++}
++
++#endif
++
++static int getnextchar(char* s, uchar* cc)
++{
++ if( s[0] == '\0') return 0;
++
++ cc[0] = (unsigned char)(*s);
++ cc[1] = (unsigned char)(*(s + 1));
++
++ if( ((unsigned char)cc[0] > 0xa0) && ((unsigned char)cc[1] > 0xa0) )
++ return 1;
++
++ cc[1] = '\0';
++
++ return 1;
++}
++
++static void expandcchar(int bg, int fg, uchar* c, unsigned char *bitmap)
++{
++ int x, y;
++ int c1, c2;
++ unsigned char *font;
++ int b = 0; /* keep gcc happy with b = 0 - MW */
++
++ c1 = c[0];
++ c2 = c[1];
++
++ font = cfont_address + ((c1 - 161)*94 + c2 - 161) *
++ (font_height * ((cfont_width + 7) / 8));
++
++ for (y = 0; y < font_height; y++)
++ for (x = 0; x < cfont_width; x++) {
++ if (x % 8 == 0)
++ b = *font++;
++ if (b & (128 >> (x % 8))) /* pixel */
++ switch (BYTESPERPIXEL) {
++ case 1:
++ *bitmap = fg;
++ bitmap++;
++ break;
++ case 2:
++ *(ushort *) bitmap = fg;
++ bitmap += 2;
++ break;
++ case 3:
++ *(ushort *) bitmap = fg;
++ *(bitmap + 2) = fg >> 16;
++ bitmap += 3;
++ break;
++ case 4:
++ *(uint *) bitmap = fg;
++ bitmap += 4;
++ } else /* background pixel */
++ switch (BYTESPERPIXEL) {
++ case 1:
++ *bitmap = bg;
++ bitmap++;
++ break;
++ case 2:
++ *(ushort *) bitmap = bg;
++ bitmap += 2;
++ break;
++ case 3:
++ *(ushort *) bitmap = bg;
++ *(bitmap + 2) = bg;
++ bitmap += 3;
++ break;
++ case 4:
++ *(uint *) bitmap = bg;
++ bitmap += 4;
++ }
++ }
++}
++
++static void expandchar(int bg, int fg, int c, unsigned char *bitmap)
++{
++ int x, y;
++ unsigned char *font;
++ int b = 0; /* keep gcc happy with b = 0 - MW */
++
++ font = afont_address + c * (font_height * ((afont_width + 7) / 8));
++
++ for (y = 0; y < font_height; y++)
++ for (x = 0; x < afont_width; x++) {
++ if (x % 8 == 0)
++ b = *font++;
++ if (b & (128 >> (x % 8))) /* pixel */
++ switch (BYTESPERPIXEL) {
++ case 1:
++ *bitmap = fg;
++ bitmap++;
++ break;
++ case 2:
++ *(ushort *) bitmap = fg;
++ bitmap += 2;
++ break;
++ case 3:
++ *(ushort *) bitmap = fg;
++ *(bitmap + 2) = fg >> 16;
++ bitmap += 3;
++ break;
++ case 4:
++ *(uint *) bitmap = fg;
++ bitmap += 4;
++ } else /* background pixel */
++ switch (BYTESPERPIXEL) {
++ case 1:
++ *bitmap = bg;
++ bitmap++;
++ break;
++ case 2:
++ *(ushort *) bitmap = bg;
++ bitmap += 2;
++ break;
++ case 3:
++ *(ushort *) bitmap = bg;
++ *(bitmap + 2) = bg;
++ bitmap += 3;
++ break;
++ case 4:
++ *(uint *) bitmap = bg;
++ bitmap += 4;
++ }
++ }
++}
++
++/* Write using compressed font. */
++
++void gl_ccwrite(int x, int y, char* s)
++{
++ unsigned char *bitmap;
++ uchar cc[2];
++
++ bitmap = (unsigned char *)alloca(cfont_width * font_height * BYTESPERPIXEL);
++ if( !(font_writemode & WRITEMODE_MASKED) ) {
++ while( getnextchar(s, cc) ) {
++ if( cc[1] != '\0') {
++ expandcchar(compressed_font_bg, compressed_font_fg,
++ cc, bitmap);
++ gl_putbox(x, y, cfont_width, font_height, bitmap);
++ s += 2;
++ x += cfont_width;
++ }
++ else {
++ expandchar(compressed_font_bg, compressed_font_fg,
++ cc[0], bitmap);
++ gl_putbox(x, y, afont_width, font_height, bitmap);
++ s += 1;
++ x += afont_width;
++ }
++ }
++ }
++ else { // masked write.
++ while( getnextchar(s, cc) ) {
++ if( cc[1] != '\0') {
++ expandcchar(0, compressed_font_fg,
++ cc, bitmap);
++ gl_putboxmask(x, y, cfont_width, font_height, bitmap);
++ s += 2;
++ x += cfont_width;
++ }
++ else {
++ expandchar(0, compressed_font_fg,
++ cc[0], bitmap);
++ gl_putboxmask(x, y, afont_width, font_height, bitmap);
++ s += 1;
++ x += afont_width;
++ }
++ }
++ }
++}
++