From 275e732d08441e5180ae8ef17da0f684106e60d6 Mon Sep 17 00:00:00 2001 From: Jens Schweikhardt Date: Sun, 31 Aug 2025 16:04:57 +0200 Subject: More history. HASH is not a good idea, changes too often. --- History/rcons/gallant19.h | 1159 +++++++++++++++++++++++++++++++++++++ History/rcons/raster.h | 259 +++++++++ History/rcons/raster_op.c | 1325 +++++++++++++++++++++++++++++++++++++++++++ History/rcons/raster_text.c | 249 ++++++++ History/rcons/rcons_font.c | 72 +++ History/rcons/rcons_kern.c | 282 +++++++++ History/rcons/rcons_subr.c | 610 ++++++++++++++++++++ 7 files changed, 3956 insertions(+) create mode 100644 History/rcons/gallant19.h create mode 100644 History/rcons/raster.h create mode 100644 History/rcons/raster_op.c create mode 100644 History/rcons/raster_text.c create mode 100644 History/rcons/rcons_font.c create mode 100644 History/rcons/rcons_kern.c create mode 100644 History/rcons/rcons_subr.c (limited to 'History/rcons') diff --git a/History/rcons/gallant19.h b/History/rcons/gallant19.h new file mode 100644 index 0000000..85e1348 --- /dev/null +++ b/History/rcons/gallant19.h @@ -0,0 +1,1159 @@ +/* + * Copyright (c) 1992 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory and to the University + * of California at Berkeley by Jef Poskanzer. + * + * 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. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * @(#)gallant19.h 7.1 (Berkeley) 7/13/92 + * + * from: $Header: raster_text.c,v 1.15 92/06/17 08:14:45 torek Exp $ + */ + +u_long gallant19_32_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x000018c0, 0x000003c0, 0x000030c0, + 0x000030c0, 0x00001ee0, 0x00000000, 0x00000000, 0x00002000, 0x0000e000, + 0x00006000, 0x00006fc0, 0x00006060, 0x00006060, 0x00007060, 0x00004f80, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_32 = { 12, 22, 1, 1, gallant19_32_pixels, 0 }; + +u_long gallant19_33_pixels[] = { + 0x00000000, + 0x06000000, 0x06000000, 0x06000060, 0x06000060, 0x06000060, 0x060031e0, + 0x06006060, 0x06006060, 0x060070e0, 0x06001e70, 0x06000000, 0x00000000, + 0x00000000, 0x06000000, 0x06000000, 0x000030c0, 0x00006060, 0x00006000, + 0x00003000, 0x00000f80, 0x00000000 + }; +struct raster gallant19_33 = { 12, 22, 1, 1, gallant19_33_pixels, 0 }; + +u_long gallant19_34_pixels[] = { + 0x00000000, + 0x19800c00, 0x19801e00, 0x19800000, 0x19800000, 0x19800000, 0x19800000, + 0x00000000, 0x000031e0, 0x000060c0, 0x00003180, 0x00006000, 0x00003fe0, + 0x00004020, 0x00007fc0, 0x00001000, 0x00007000, 0x00003000, 0x000039c0, + 0x000030c0, 0x000030c0, 0x00000000 + }; +struct raster gallant19_34 = { 12, 22, 1, 1, gallant19_34_pixels, 0 }; + +u_long gallant19_35_pixels[] = { + 0x00000000, + 0x03300600, 0x03300600, 0x03300600, 0x06601f80, 0x1ff00000, 0x1ff00000, + 0x0cc00000, 0x0cc000c0, 0x19800000, 0x198000c0, 0x7fc000c0, 0x7fc000c0, + 0x330000c0, 0x660000c0, 0x660030c0, 0x00001f00, 0x00006000, 0x00006000, + 0x00006000, 0x00006300, 0x00000000 + }; +struct raster gallant19_35 = { 12, 22, 1, 1, gallant19_35_pixels, 0 }; + +u_long gallant19_36_pixels[] = { + 0x00000000, + 0x06000600, 0x1f800600, 0x3fc00600, 0x66e00600, 0x66600600, 0x66001f80, + 0x3e000000, 0x1f800000, 0x07c00000, 0x06600000, 0x06600000, 0x66606ee0, + 0x7fc06660, 0x3f806660, 0x06006660, 0x0000ef70, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_36 = { 12, 22, 1, 1, gallant19_36_pixels, 0 }; + +u_long gallant19_37_pixels[] = { + 0x00000000, + 0x38600000, 0x44c00000, 0x44c00000, 0x458011c0, 0x39806060, 0x03006060, + 0x03007040, 0x06001f00, 0x0c000000, 0x0c000000, 0x19c00000, 0x1a200000, + 0x32200000, 0x322071c0, 0x61c06060, 0x00006060, 0x00006040, 0x00007f00, + 0x00006000, 0x00006000, 0x00000000 + }; +struct raster gallant19_37 = { 12, 22, 1, 1, gallant19_37_pixels, 0 }; + +u_long gallant19_38_pixels[] = { + 0x00000000, + 0x07000060, 0x0f800060, 0x18c00000, 0x18c00000, 0x18c00000, 0x0f8034c0, + 0x1e003000, 0x3e003000, 0x77003000, 0x63607800, 0x61e00000, 0x61c00000, + 0x61800000, 0x3fe00000, 0x1e600000, 0x000030c0, 0x00003800, 0x00000780, + 0x000020c0, 0x00003f80, 0x00000000 + }; +struct raster gallant19_38 = { 12, 22, 1, 1, gallant19_38_pixels, 0 }; + +u_long gallant19_39_pixels[] = { + 0x00000000, + 0x0c000c20, 0x1e000780, 0x1e000000, 0x06000000, 0x06000000, 0x0c000000, + 0x18000000, 0x100030c0, 0x000030c0, 0x000030c0, 0x000030c0, 0x00001e60, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00006020, + 0x00003040, 0x00001880, 0x00000000 + }; +struct raster gallant19_39 = { 12, 22, 1, 1, gallant19_39_pixels, 0 }; + +u_long gallant19_40_pixels[] = { + 0x00000000, + 0x00c06620, 0x01803b40, 0x03801980, 0x03001980, 0x07000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06007040, 0x07001d00, 0x03000700, + 0x038011c0, 0x0180f1f0, 0x00c00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00006020, 0x00000000 + }; +struct raster gallant19_40 = { 12, 22, 1, 1, gallant19_40_pixels, 0 }; + +u_long gallant19_41_pixels[] = { + 0x00000000, + 0x30000000, 0x180060e0, 0x1c000380, 0x0c000e00, 0x0e003820, 0x06007fe0, + 0x06000000, 0x06000000, 0x060001c0, 0x06000300, 0x0e000180, 0x0c000300, + 0x1c000300, 0x18000180, 0x30000300, 0x000001c0, 0x00000000, 0x00000000, + 0x00000600, 0x00000600, 0x00000000 + }; +struct raster gallant19_41 = { 12, 22, 1, 1, gallant19_41_pixels, 0 }; + +u_long gallant19_42_pixels[] = { + 0x00000000, + 0x00003800, 0x00000c00, 0x00001800, 0x00000c00, 0x0f000c00, 0x06001800, + 0x66600c00, 0x76e03800, 0x19800000, 0x00000000, 0x19800000, 0x76e00000, + 0x66600000, 0x06000000, 0x0f001c20, 0x000036c0, 0x00004380, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_42 = { 12, 22, 1, 1, gallant19_42_pixels, 0 }; + +u_long gallant19_43_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x7fe00000, 0x7fe00000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_43 = { 12, 22, 1, 1, gallant19_43_pixels, 0 }; + +u_long gallant19_44_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0c000000, 0x1e000000, 0x1e000000, 0x06000000, 0x06000000, 0x0c000000, + 0x18000000, 0x10000000, 0x00000000 + }; +struct raster gallant19_44 = { 12, 22, 1, 1, gallant19_44_pixels, 0 }; + +u_long gallant19_45_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x7fe00000, 0x7fe00000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_45 = { 12, 22, 1, 1, gallant19_45_pixels, 0 }; + +u_long gallant19_46_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c000000, + 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_46 = { 12, 22, 1, 1, gallant19_46_pixels, 0 }; + +u_long gallant19_47_pixels[] = { + 0x00000000, + 0x00600000, 0x00c00000, 0x00c00000, 0x01800000, 0x01800000, 0x03000000, + 0x03000000, 0x06000000, 0x0c000000, 0x0c000000, 0x18000000, 0x18000000, + 0x30000000, 0x30000000, 0x60000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_47 = { 12, 22, 1, 1, gallant19_47_pixels, 0 }; + +u_long gallant19_48_pixels[] = { + 0x00000000, + 0x07000000, 0x0f800000, 0x11800000, 0x10c00000, 0x30c00000, 0x30c00000, + 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30800000, + 0x18800000, 0x1f000000, 0x0e000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_48 = { 12, 22, 1, 1, gallant19_48_pixels, 0 }; + +u_long gallant19_49_pixels[] = { + 0x00000000, + 0x02000000, 0x06000000, 0x0e000000, 0x1e000000, 0x36000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x3fc00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_49 = { 12, 22, 1, 1, gallant19_49_pixels, 0 }; + +u_long gallant19_50_pixels[] = { + 0x00000000, + 0x1f000000, 0x3f800000, 0x61c00000, 0x40c00000, 0x00c00000, 0x00c00000, + 0x00c00000, 0x01800000, 0x03000000, 0x06000000, 0x0c000000, 0x18000000, + 0x30200000, 0x7fe00000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_50 = { 12, 22, 1, 1, gallant19_50_pixels, 0 }; + +u_long gallant19_51_pixels[] = { + 0x00000000, + 0x0f800000, 0x1fc00000, 0x20e00000, 0x40600000, 0x00600000, 0x00e00000, + 0x07c00000, 0x0fc00000, 0x00e00000, 0x00600000, 0x00600000, 0x40600000, + 0x60400000, 0x3f800000, 0x1f000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_51 = { 12, 22, 1, 1, gallant19_51_pixels, 0 }; + +u_long gallant19_52_pixels[] = { + 0x00000000, + 0x01800000, 0x03800000, 0x03800000, 0x05800000, 0x05800000, 0x09800000, + 0x09800000, 0x11800000, 0x11800000, 0x21800000, 0x3fe00000, 0x7fe00000, + 0x01800000, 0x01800000, 0x01800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_52 = { 12, 22, 1, 1, gallant19_52_pixels, 0 }; + +u_long gallant19_53_pixels[] = { + 0x00000000, + 0x0fc00000, 0x0fc00000, 0x10000000, 0x10000000, 0x20000000, 0x3f800000, + 0x31c00000, 0x00e00000, 0x00600000, 0x00600000, 0x00600000, 0x40600000, + 0x60600000, 0x30c00000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_53 = { 12, 22, 1, 1, gallant19_53_pixels, 0 }; + +u_long gallant19_54_pixels[] = { + 0x00000000, + 0x07000000, 0x0c000000, 0x18000000, 0x30000000, 0x30000000, 0x60000000, + 0x67800000, 0x6fc00000, 0x70e00000, 0x60600000, 0x60600000, 0x60600000, + 0x70400000, 0x3f800000, 0x1f000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_54 = { 12, 22, 1, 1, gallant19_54_pixels, 0 }; + +u_long gallant19_55_pixels[] = { + 0x00000000, + 0x1fe00000, 0x3fe00000, 0x60400000, 0x00400000, 0x00c00000, 0x00800000, + 0x00800000, 0x01800000, 0x01000000, 0x01000000, 0x03000000, 0x02000000, + 0x02000000, 0x06000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_55 = { 12, 22, 1, 1, gallant19_55_pixels, 0 }; + +u_long gallant19_56_pixels[] = { + 0x00000000, + 0x0f000000, 0x11800000, 0x30c00000, 0x30c00000, 0x30c00000, 0x18800000, + 0x0d000000, 0x06000000, 0x0b000000, 0x11800000, 0x30c00000, 0x30c00000, + 0x30c00000, 0x18800000, 0x0f000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_56 = { 12, 22, 1, 1, gallant19_56_pixels, 0 }; + +u_long gallant19_57_pixels[] = { + 0x00000000, + 0x0f800000, 0x11c00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, + 0x70e00000, 0x3f600000, 0x1e600000, 0x00600000, 0x00c00000, 0x00c00000, + 0x01800000, 0x07000000, 0x3c000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_57 = { 12, 22, 1, 1, gallant19_57_pixels, 0 }; + +u_long gallant19_58_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c000000, + 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, 0x0c000000, + 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_58 = { 12, 22, 1, 1, gallant19_58_pixels, 0 }; + +u_long gallant19_59_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0c000000, 0x1e000000, 0x1e000000, 0x0c000000, 0x00000000, 0x00000000, + 0x0c000000, 0x1e000000, 0x1e000000, 0x06000000, 0x06000000, 0x0c000000, + 0x18000000, 0x10000000, 0x00000000 + }; +struct raster gallant19_59 = { 12, 22, 1, 1, gallant19_59_pixels, 0 }; + +u_long gallant19_60_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00600000, + 0x01c00000, 0x07000000, 0x1e000000, 0x78000000, 0x78000000, 0x1e000000, + 0x07000000, 0x01c00000, 0x00600000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_60 = { 12, 22, 1, 1, gallant19_60_pixels, 0 }; + +u_long gallant19_61_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x7fc00000, 0x7fc00000, 0x00000000, 0x00000000, 0x7fc00000, + 0x7fc00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_61 = { 12, 22, 1, 1, gallant19_61_pixels, 0 }; + +u_long gallant19_62_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x60000000, + 0x38000000, 0x1e000000, 0x07800000, 0x01e00000, 0x01e00000, 0x07800000, + 0x1e000000, 0x38000000, 0x60000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_62 = { 12, 22, 1, 1, gallant19_62_pixels, 0 }; + +u_long gallant19_63_pixels[] = { + 0x00000000, + 0x0f000000, 0x1f800000, 0x39c00000, 0x20c00000, 0x00c00000, 0x00c00000, + 0x01800000, 0x03000000, 0x06000000, 0x0c000000, 0x0c000000, 0x00000000, + 0x00000000, 0x0c000000, 0x0c000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_63 = { 12, 22, 1, 1, gallant19_63_pixels, 0 }; + +u_long gallant19_64_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x0f800000, 0x3fc00000, 0x30600000, + 0x60600000, 0x67200000, 0x6fa00000, 0x6ca00000, 0x6ca00000, 0x67e00000, + 0x60000000, 0x30000000, 0x3fe00000, 0x0fe00000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_64 = { 12, 22, 1, 1, gallant19_64_pixels, 0 }; + +u_long gallant19_65_pixels[] = { + 0x00000000, + 0x00000000, 0x06000000, 0x06000000, 0x0b000000, 0x0b000000, 0x09000000, + 0x11800000, 0x11800000, 0x10800000, 0x3fc00000, 0x20c00000, 0x20400000, + 0x40600000, 0x40600000, 0xe0f00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_65 = { 12, 22, 1, 1, gallant19_65_pixels, 0 }; + +u_long gallant19_66_pixels[] = { + 0x00000000, + 0x00000000, 0xff000000, 0x60800000, 0x60c00000, 0x60c00000, 0x60c00000, + 0x61800000, 0x7f800000, 0x60c00000, 0x60600000, 0x60600000, 0x60600000, + 0x60600000, 0x60c00000, 0xff800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_66 = { 12, 22, 1, 1, gallant19_66_pixels, 0 }; + +u_long gallant19_67_pixels[] = { + 0x00000000, + 0x00000000, 0x0fc00000, 0x10600000, 0x20200000, 0x20000000, 0x60000000, + 0x60000000, 0x60000000, 0x60000000, 0x60000000, 0x60000000, 0x20000000, + 0x30200000, 0x18400000, 0x0f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_67 = { 12, 22, 1, 1, gallant19_67_pixels, 0 }; + +u_long gallant19_68_pixels[] = { + 0x00000000, + 0x00000000, 0xff000000, 0x61c00000, 0x60c00000, 0x60600000, 0x60600000, + 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, + 0x60400000, 0x61800000, 0xfe000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_68 = { 12, 22, 1, 1, gallant19_68_pixels, 0 }; + +u_long gallant19_69_pixels[] = { + 0x00000000, + 0x00000000, 0x7fc00000, 0x30400000, 0x30400000, 0x30000000, 0x30000000, + 0x30800000, 0x3f800000, 0x30800000, 0x30000000, 0x30000000, 0x30000000, + 0x30200000, 0x30200000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_69 = { 12, 22, 1, 1, gallant19_69_pixels, 0 }; + +u_long gallant19_70_pixels[] = { + 0x00000000, + 0x00000000, 0x7fc00000, 0x30400000, 0x30400000, 0x30000000, 0x30000000, + 0x30800000, 0x3f800000, 0x30800000, 0x30000000, 0x30000000, 0x30000000, + 0x30000000, 0x30000000, 0x78000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_70 = { 12, 22, 1, 1, gallant19_70_pixels, 0 }; + +u_long gallant19_71_pixels[] = { + 0x00000000, + 0x00000000, 0x0fc00000, 0x10600000, 0x20200000, 0x20000000, 0x60000000, + 0x60000000, 0x60000000, 0x60000000, 0x61f00000, 0x60600000, 0x20600000, + 0x30600000, 0x18600000, 0x0f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_71 = { 12, 22, 1, 1, gallant19_71_pixels, 0 }; + +u_long gallant19_72_pixels[] = { + 0x00000000, + 0x00000000, 0xf0f00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, + 0x60600000, 0x7fe00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, + 0x60600000, 0x60600000, 0xf0f00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_72 = { 12, 22, 1, 1, gallant19_72_pixels, 0 }; + +u_long gallant19_73_pixels[] = { + 0x00000000, + 0x00000000, 0x1f800000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_73 = { 12, 22, 1, 1, gallant19_73_pixels, 0 }; + +u_long gallant19_74_pixels[] = { + 0x00000000, + 0x00000000, 0x1f800000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x04000000, + 0x38000000, 0x30000000, 0x00000000 + }; +struct raster gallant19_74 = { 12, 22, 1, 1, gallant19_74_pixels, 0 }; + +u_long gallant19_75_pixels[] = { + 0x00000000, + 0x00000000, 0xf0e00000, 0x61800000, 0x63000000, 0x66000000, 0x6c000000, + 0x78000000, 0x78000000, 0x7c000000, 0x6e000000, 0x67000000, 0x63800000, + 0x61c00000, 0x60e00000, 0xf0700000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_75 = { 12, 22, 1, 1, gallant19_75_pixels, 0 }; + +u_long gallant19_76_pixels[] = { + 0x00000000, + 0x00000000, 0x78000000, 0x30000000, 0x30000000, 0x30000000, 0x30000000, + 0x30000000, 0x30000000, 0x30000000, 0x30000000, 0x30000000, 0x30000000, + 0x30200000, 0x30200000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_76 = { 12, 22, 1, 1, gallant19_76_pixels, 0 }; + +u_long gallant19_77_pixels[] = { + 0x00000000, + 0x00000000, 0xe0700000, 0x60e00000, 0x70e00000, 0x70e00000, 0x70e00000, + 0x59600000, 0x59600000, 0x59600000, 0x4d600000, 0x4e600000, 0x4e600000, + 0x44600000, 0x44600000, 0xe4f00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_77 = { 12, 22, 1, 1, gallant19_77_pixels, 0 }; + +u_long gallant19_78_pixels[] = { + 0x00000000, + 0x00000000, 0xc0700000, 0x60200000, 0x70200000, 0x78200000, 0x58200000, + 0x4c200000, 0x46200000, 0x47200000, 0x43200000, 0x41a00000, 0x40e00000, + 0x40e00000, 0x40600000, 0xe0300000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_78 = { 12, 22, 1, 1, gallant19_78_pixels, 0 }; + +u_long gallant19_79_pixels[] = { + 0x00000000, + 0x00000000, 0x0f000000, 0x11c00000, 0x20c00000, 0x20600000, 0x60600000, + 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x20400000, + 0x30400000, 0x18800000, 0x0f000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_79 = { 12, 22, 1, 1, gallant19_79_pixels, 0 }; + +u_long gallant19_80_pixels[] = { + 0x00000000, + 0x00000000, 0x7f800000, 0x30c00000, 0x30600000, 0x30600000, 0x30600000, + 0x30c00000, 0x37800000, 0x30000000, 0x30000000, 0x30000000, 0x30000000, + 0x30000000, 0x30000000, 0x78000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_80 = { 12, 22, 1, 1, gallant19_80_pixels, 0 }; + +u_long gallant19_81_pixels[] = { + 0x00000000, + 0x00000000, 0x0f000000, 0x11c00000, 0x20c00000, 0x20600000, 0x60600000, + 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, 0x30400000, + 0x38400000, 0x1f800000, 0x0e000000, 0x1f000000, 0x23900000, 0x01e00000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_81 = { 12, 22, 1, 1, gallant19_81_pixels, 0 }; + +u_long gallant19_82_pixels[] = { + 0x00000000, + 0x00000000, 0xff000000, 0x61800000, 0x60c00000, 0x60c00000, 0x60c00000, + 0x60800000, 0x7f000000, 0x7c000000, 0x6e000000, 0x67000000, 0x63800000, + 0x61c00000, 0x60e00000, 0xf0700000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_82 = { 12, 22, 1, 1, gallant19_82_pixels, 0 }; + +u_long gallant19_83_pixels[] = { + 0x00000000, + 0x00000000, 0x1fe00000, 0x30600000, 0x60200000, 0x60200000, 0x70000000, + 0x3c000000, 0x1e000000, 0x07800000, 0x01c00000, 0x00e00000, 0x40600000, + 0x40600000, 0x60c00000, 0x7f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_83 = { 12, 22, 1, 1, gallant19_83_pixels, 0 }; + +u_long gallant19_84_pixels[] = { + 0x00000000, + 0x00000000, 0x7fe00000, 0x46200000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_84 = { 12, 22, 1, 1, gallant19_84_pixels, 0 }; + +u_long gallant19_85_pixels[] = { + 0x00000000, + 0x00000000, 0xf0700000, 0x60200000, 0x60200000, 0x60200000, 0x60200000, + 0x60200000, 0x60200000, 0x60200000, 0x60200000, 0x60200000, 0x60200000, + 0x70400000, 0x3fc00000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_85 = { 12, 22, 1, 1, gallant19_85_pixels, 0 }; + +u_long gallant19_86_pixels[] = { + 0x00000000, + 0x00000000, 0xe0e00000, 0x60400000, 0x30800000, 0x30800000, 0x30800000, + 0x19000000, 0x19000000, 0x19000000, 0x0c000000, 0x0e000000, 0x0e000000, + 0x04000000, 0x04000000, 0x04000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_86 = { 12, 22, 1, 1, gallant19_86_pixels, 0 }; + +u_long gallant19_87_pixels[] = { + 0x00000000, + 0x00000000, 0xfef00000, 0x66200000, 0x66200000, 0x66200000, 0x76200000, + 0x77400000, 0x33400000, 0x37400000, 0x3bc00000, 0x3b800000, 0x19800000, + 0x19800000, 0x19800000, 0x19800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_87 = { 12, 22, 1, 1, gallant19_87_pixels, 0 }; + +u_long gallant19_88_pixels[] = { + 0x00000000, + 0x00000000, 0xf0700000, 0x60200000, 0x30400000, 0x38800000, 0x18800000, + 0x0d000000, 0x06000000, 0x06000000, 0x0b000000, 0x11800000, 0x11c00000, + 0x20c00000, 0x40600000, 0xe0f00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_88 = { 12, 22, 1, 1, gallant19_88_pixels, 0 }; + +u_long gallant19_89_pixels[] = { + 0x00000000, + 0x00000000, 0xf0700000, 0x60200000, 0x30400000, 0x18800000, 0x18800000, + 0x0d000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x0f000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_89 = { 12, 22, 1, 1, gallant19_89_pixels, 0 }; + +u_long gallant19_90_pixels[] = { + 0x00000000, + 0x00000000, 0x3fe00000, 0x20c00000, 0x00c00000, 0x01800000, 0x01800000, + 0x03000000, 0x03000000, 0x06000000, 0x06000000, 0x0c000000, 0x0c000000, + 0x18000000, 0x18200000, 0x3fe00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_90 = { 12, 22, 1, 1, gallant19_90_pixels, 0 }; + +u_long gallant19_91_pixels[] = { + 0x00000000, + 0x07c00000, 0x07c00000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x07c00000, 0x07c00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_91 = { 12, 22, 1, 1, gallant19_91_pixels, 0 }; + +u_long gallant19_92_pixels[] = { + 0x00000000, + 0x60000000, 0x60000000, 0x30000000, 0x30000000, 0x18000000, 0x18000000, + 0x0c000000, 0x0c000000, 0x06000000, 0x03000000, 0x03000000, 0x01800000, + 0x01800000, 0x00c00000, 0x00c00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_92 = { 12, 22, 1, 1, gallant19_92_pixels, 0 }; + +u_long gallant19_93_pixels[] = { + 0x00000000, + 0x7c000000, 0x7c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, + 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, + 0x0c000000, 0x7c000000, 0x7c000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_93 = { 12, 22, 1, 1, gallant19_93_pixels, 0 }; + +u_long gallant19_94_pixels[] = { + 0x00000000, + 0x04000000, 0x0e000000, 0x1b000000, 0x31800000, 0x60c00000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_94 = { 12, 22, 1, 1, gallant19_94_pixels, 0 }; + +u_long gallant19_95_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xfff00000, 0xfff00000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_95 = { 12, 22, 1, 1, gallant19_95_pixels, 0 }; + +u_long gallant19_96_pixels[] = { + 0x00000000, + 0x01000000, 0x03000000, 0x06000000, 0x06000000, 0x07800000, 0x07800000, + 0x03000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_96 = { 12, 22, 1, 1, gallant19_96_pixels, 0 }; + +u_long gallant19_97_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f800000, + 0x18c00000, 0x10c00000, 0x03c00000, 0x1cc00000, 0x30c00000, 0x30c00000, + 0x30c00000, 0x39c00000, 0x1ee00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_97 = { 12, 22, 1, 1, gallant19_97_pixels, 0 }; + +u_long gallant19_98_pixels[] = { + 0x00000000, + 0x20000000, 0x60000000, 0xe0000000, 0x60000000, 0x60000000, 0x67800000, + 0x6fc00000, 0x70e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, + 0x70600000, 0x78c00000, 0x4f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_98 = { 12, 22, 1, 1, gallant19_98_pixels, 0 }; + +u_long gallant19_99_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1f800000, + 0x31c00000, 0x20c00000, 0x60000000, 0x60000000, 0x60000000, 0x60000000, + 0x70400000, 0x30c00000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_99 = { 12, 22, 1, 1, gallant19_99_pixels, 0 }; + +u_long gallant19_100_pixels[] = { + 0x00000000, + 0x00600000, 0x00e00000, 0x00600000, 0x00600000, 0x00600000, 0x0f600000, + 0x31e00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, + 0x70e00000, 0x39600000, 0x1e700000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_100 = { 12, 22, 1, 1, gallant19_100_pixels, 0 }; + +u_long gallant19_101_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f000000, + 0x30c00000, 0x60600000, 0x60600000, 0x7fe00000, 0x60000000, 0x60000000, + 0x30000000, 0x18600000, 0x0f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_101 = { 12, 22, 1, 1, gallant19_101_pixels, 0 }; + +u_long gallant19_102_pixels[] = { + 0x00000000, + 0x03800000, 0x04c00000, 0x04c00000, 0x0c000000, 0x0c000000, 0x0c000000, + 0x0c000000, 0x1f800000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, + 0x0c000000, 0x0c000000, 0x1e000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_102 = { 12, 22, 1, 1, gallant19_102_pixels, 0 }; + +u_long gallant19_103_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1f200000, + 0x31e00000, 0x60c00000, 0x60c00000, 0x60c00000, 0x31800000, 0x3f000000, + 0x60000000, 0x7fc00000, 0x3fe00000, 0x20600000, 0x40200000, 0x40200000, + 0x7fc00000, 0x3f800000, 0x00000000 + }; +struct raster gallant19_103 = { 12, 22, 1, 1, gallant19_103_pixels, 0 }; + +u_long gallant19_104_pixels[] = { + 0x00000000, + 0x10000000, 0x30000000, 0x70000000, 0x30000000, 0x30000000, 0x37800000, + 0x39c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, + 0x30c00000, 0x30c00000, 0x79e00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_104 = { 12, 22, 1, 1, gallant19_104_pixels, 0 }; + +u_long gallant19_105_pixels[] = { + 0x00000000, + 0x00000000, 0x06000000, 0x06000000, 0x00000000, 0x00000000, 0x1e000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_105 = { 12, 22, 1, 1, gallant19_105_pixels, 0 }; + +u_long gallant19_106_pixels[] = { + 0x00000000, + 0x00000000, 0x00c00000, 0x00c00000, 0x00000000, 0x00000000, 0x03c00000, + 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, + 0x00c00000, 0x00c00000, 0x00c00000, 0x20c00000, 0x30c00000, 0x38800000, + 0x1f000000, 0x0e000000, 0x00000000 + }; +struct raster gallant19_106 = { 12, 22, 1, 1, gallant19_106_pixels, 0 }; + +u_long gallant19_107_pixels[] = { + 0x00000000, + 0x60000000, 0xe0000000, 0x60000000, 0x60000000, 0x60000000, 0x61c00000, + 0x63000000, 0x66000000, 0x7c000000, 0x78000000, 0x7c000000, 0x6e000000, + 0x67000000, 0x63800000, 0xf1e00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_107 = { 12, 22, 1, 1, gallant19_107_pixels, 0 }; + +u_long gallant19_108_pixels[] = { + 0x00000000, + 0x1e000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x1f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_108 = { 12, 22, 1, 1, gallant19_108_pixels, 0 }; + +u_long gallant19_109_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xddc00000, + 0x6ee00000, 0x66600000, 0x66600000, 0x66600000, 0x66600000, 0x66600000, + 0x66600000, 0x66600000, 0xef700000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_109 = { 12, 22, 1, 1, gallant19_109_pixels, 0 }; + +u_long gallant19_110_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x27800000, + 0x79c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, + 0x30c00000, 0x30c00000, 0x79e00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_110 = { 12, 22, 1, 1, gallant19_110_pixels, 0 }; + +u_long gallant19_111_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f800000, + 0x11c00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, + 0x70400000, 0x38800000, 0x1f000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_111 = { 12, 22, 1, 1, gallant19_111_pixels, 0 }; + +u_long gallant19_112_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xef800000, + 0x71c00000, 0x60e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, + 0x60400000, 0x70800000, 0x7f000000, 0x60000000, 0x60000000, 0x60000000, + 0x60000000, 0xf0000000, 0x00000000 + }; +struct raster gallant19_112 = { 12, 22, 1, 1, gallant19_112_pixels, 0 }; + +u_long gallant19_113_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f200000, + 0x11e00000, 0x20e00000, 0x60600000, 0x60600000, 0x60600000, 0x60600000, + 0x70600000, 0x38e00000, 0x1fe00000, 0x00600000, 0x00600000, 0x00600000, + 0x00600000, 0x00f00000, 0x00000000 + }; +struct raster gallant19_113 = { 12, 22, 1, 1, gallant19_113_pixels, 0 }; + +u_long gallant19_114_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x73800000, + 0x34c00000, 0x38c00000, 0x30000000, 0x30000000, 0x30000000, 0x30000000, + 0x30000000, 0x30000000, 0x78000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_114 = { 12, 22, 1, 1, gallant19_114_pixels, 0 }; + +u_long gallant19_115_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1fc00000, + 0x30c00000, 0x30400000, 0x38000000, 0x1e000000, 0x07800000, 0x01c00000, + 0x20c00000, 0x30c00000, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_115 = { 12, 22, 1, 1, gallant19_115_pixels, 0 }; + +u_long gallant19_116_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x04000000, 0x04000000, 0x0c000000, 0x7fc00000, + 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, 0x0c000000, + 0x0c200000, 0x0e400000, 0x07800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_116 = { 12, 22, 1, 1, gallant19_116_pixels, 0 }; + +u_long gallant19_117_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x79e00000, + 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, 0x30c00000, + 0x30c00000, 0x39c00000, 0x1e600000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_117 = { 12, 22, 1, 1, gallant19_117_pixels, 0 }; + +u_long gallant19_118_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xf0700000, + 0x60200000, 0x30400000, 0x30400000, 0x18800000, 0x18800000, 0x0d000000, + 0x0d000000, 0x06000000, 0x06000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_118 = { 12, 22, 1, 1, gallant19_118_pixels, 0 }; + +u_long gallant19_119_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xff700000, + 0x66200000, 0x66200000, 0x66200000, 0x37400000, 0x3b400000, 0x3b400000, + 0x19800000, 0x19800000, 0x19800000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_119 = { 12, 22, 1, 1, gallant19_119_pixels, 0 }; + +u_long gallant19_120_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xf8f00000, + 0x70400000, 0x38800000, 0x1d000000, 0x0e000000, 0x07000000, 0x0b800000, + 0x11c00000, 0x20e00000, 0xf1f00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_120 = { 12, 22, 1, 1, gallant19_120_pixels, 0 }; + +u_long gallant19_121_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xf0f00000, + 0x60200000, 0x30400000, 0x30400000, 0x18800000, 0x18800000, 0x0d000000, + 0x0d000000, 0x06000000, 0x06000000, 0x04000000, 0x0c000000, 0x08000000, + 0x78000000, 0x70000000, 0x00000000 + }; +struct raster gallant19_121 = { 12, 22, 1, 1, gallant19_121_pixels, 0 }; + +u_long gallant19_122_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7fe00000, + 0x60e00000, 0x41c00000, 0x03800000, 0x07000000, 0x0e000000, 0x1c000000, + 0x38200000, 0x70600000, 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_122 = { 12, 22, 1, 1, gallant19_122_pixels, 0 }; + +u_long gallant19_123_pixels[] = { + 0x00000000, + 0x01c00000, 0x03000000, 0x03000000, 0x01800000, 0x01800000, 0x01800000, + 0x03000000, 0x07000000, 0x03000000, 0x01800000, 0x01800000, 0x01800000, + 0x03000000, 0x03000000, 0x01c00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_123 = { 12, 22, 1, 1, gallant19_123_pixels, 0 }; + +u_long gallant19_124_pixels[] = { + 0x00000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x06000000, 0x00000000 + }; +struct raster gallant19_124 = { 12, 22, 1, 1, gallant19_124_pixels, 0 }; + +u_long gallant19_125_pixels[] = { + 0x00000000, + 0x38000000, 0x0c000000, 0x0c000000, 0x18000000, 0x18000000, 0x18000000, + 0x0c000000, 0x0e000000, 0x0c000000, 0x18000000, 0x18000000, 0x18000000, + 0x0c000000, 0x0c000000, 0x38000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_125 = { 12, 22, 1, 1, gallant19_125_pixels, 0 }; + +u_long gallant19_126_pixels[] = { + 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x1c200000, 0x3e600000, 0x36c00000, 0x67c00000, + 0x43800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000 + }; +struct raster gallant19_126 = { 12, 22, 1, 1, gallant19_126_pixels, 0 }; + +struct raster_font gallant19 = { + 12, 22, RASFONT_FIXEDWIDTH|RASFONT_NOVERTICALMOVEMENT, + 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, 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, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + &gallant19_32, 0, -15, 12, 0, + &gallant19_33, 0, -15, 12, 0, + &gallant19_34, 0, -15, 12, 0, + &gallant19_35, 0, -15, 12, 0, + &gallant19_36, 0, -15, 12, 0, + &gallant19_37, 0, -15, 12, 0, + &gallant19_38, 0, -15, 12, 0, + &gallant19_39, 0, -15, 12, 0, + &gallant19_40, 0, -15, 12, 0, + &gallant19_41, 0, -15, 12, 0, + &gallant19_42, 0, -15, 12, 0, + &gallant19_43, 0, -15, 12, 0, + &gallant19_44, 0, -15, 12, 0, + &gallant19_45, 0, -15, 12, 0, + &gallant19_46, 0, -15, 12, 0, + &gallant19_47, 0, -15, 12, 0, + &gallant19_48, 0, -15, 12, 0, + &gallant19_49, 0, -15, 12, 0, + &gallant19_50, 0, -15, 12, 0, + &gallant19_51, 0, -15, 12, 0, + &gallant19_52, 0, -15, 12, 0, + &gallant19_53, 0, -15, 12, 0, + &gallant19_54, 0, -15, 12, 0, + &gallant19_55, 0, -15, 12, 0, + &gallant19_56, 0, -15, 12, 0, + &gallant19_57, 0, -15, 12, 0, + &gallant19_58, 0, -15, 12, 0, + &gallant19_59, 0, -15, 12, 0, + &gallant19_60, 0, -15, 12, 0, + &gallant19_61, 0, -15, 12, 0, + &gallant19_62, 0, -15, 12, 0, + &gallant19_63, 0, -15, 12, 0, + &gallant19_64, 0, -15, 12, 0, + &gallant19_65, 0, -15, 12, 0, + &gallant19_66, 0, -15, 12, 0, + &gallant19_67, 0, -15, 12, 0, + &gallant19_68, 0, -15, 12, 0, + &gallant19_69, 0, -15, 12, 0, + &gallant19_70, 0, -15, 12, 0, + &gallant19_71, 0, -15, 12, 0, + &gallant19_72, 0, -15, 12, 0, + &gallant19_73, 0, -15, 12, 0, + &gallant19_74, 0, -15, 12, 0, + &gallant19_75, 0, -15, 12, 0, + &gallant19_76, 0, -15, 12, 0, + &gallant19_77, 0, -15, 12, 0, + &gallant19_78, 0, -15, 12, 0, + &gallant19_79, 0, -15, 12, 0, + &gallant19_80, 0, -15, 12, 0, + &gallant19_81, 0, -15, 12, 0, + &gallant19_82, 0, -15, 12, 0, + &gallant19_83, 0, -15, 12, 0, + &gallant19_84, 0, -15, 12, 0, + &gallant19_85, 0, -15, 12, 0, + &gallant19_86, 0, -15, 12, 0, + &gallant19_87, 0, -15, 12, 0, + &gallant19_88, 0, -15, 12, 0, + &gallant19_89, 0, -15, 12, 0, + &gallant19_90, 0, -15, 12, 0, + &gallant19_91, 0, -15, 12, 0, + &gallant19_92, 0, -15, 12, 0, + &gallant19_93, 0, -15, 12, 0, + &gallant19_94, 0, -15, 12, 0, + &gallant19_95, 0, -15, 12, 0, + &gallant19_96, 0, -15, 12, 0, + &gallant19_97, 0, -15, 12, 0, + &gallant19_98, 0, -15, 12, 0, + &gallant19_99, 0, -15, 12, 0, + &gallant19_100, 0, -15, 12, 0, + &gallant19_101, 0, -15, 12, 0, + &gallant19_102, 0, -15, 12, 0, + &gallant19_103, 0, -15, 12, 0, + &gallant19_104, 0, -15, 12, 0, + &gallant19_105, 0, -15, 12, 0, + &gallant19_106, 0, -15, 12, 0, + &gallant19_107, 0, -15, 12, 0, + &gallant19_108, 0, -15, 12, 0, + &gallant19_109, 0, -15, 12, 0, + &gallant19_110, 0, -15, 12, 0, + &gallant19_111, 0, -15, 12, 0, + &gallant19_112, 0, -15, 12, 0, + &gallant19_113, 0, -15, 12, 0, + &gallant19_114, 0, -15, 12, 0, + &gallant19_115, 0, -15, 12, 0, + &gallant19_116, 0, -15, 12, 0, + &gallant19_117, 0, -15, 12, 0, + &gallant19_118, 0, -15, 12, 0, + &gallant19_119, 0, -15, 12, 0, + &gallant19_120, 0, -15, 12, 0, + &gallant19_121, 0, -15, 12, 0, + &gallant19_122, 0, -15, 12, 0, + &gallant19_123, 0, -15, 12, 0, + &gallant19_124, 0, -15, 12, 0, + &gallant19_125, 0, -15, 12, 0, + &gallant19_126, 0, -15, 12, 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, 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, + 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, 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, 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, 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, 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, + 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, 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, +#ifdef COLORFONT_CACHE + (struct raster_fontcache*) -1 +#endif /*COLORFONT_CACHE*/ + }; + diff --git a/History/rcons/raster.h b/History/rcons/raster.h new file mode 100644 index 0000000..a513c45 --- /dev/null +++ b/History/rcons/raster.h @@ -0,0 +1,259 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory and to the University + * of California at Berkeley by Jef Poskanzer. + * + * 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. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * @(#)raster.h 7.1 (Berkeley) 7/13/92 + * + * from: $Header: raster.h,v 1.14 92/06/17 08:14:43 torek Exp $ + */ + +/* + * Simple raster and frame buffer routines. + * + * Currently this set of routines is fairly minimal. It's enough to + * implement a console terminal emulator on monochrome and pseudocolor + * screens, and that's about it. + * + * Future additions might be other kinds of frame buffers (direct color?), + * lines, dashed lines, three-operand blits (stipples/stencils), etc. + */ + +#ifndef _RASTER_H_ +#define _RASTER_H_ + +/* Configurable definitions. */ + +/* CONFIGURE: define or undef for your machine's byte order */ +#define MSBYTE_FIRST + +/* CONFIGURE: define or under for your frame buffer's bit order */ +#define MSBIT_FIRST + +/* CONFIGURE: The text routines can optionally keep a cache of 8-bit +** characters. This uses about 30K, but makes text on a color screen +** go 3.2 times faster. +*/ +#undef COLORFONT_CACHE + + +/* Definitions. */ + +/* ANSI prototype conditionalizer. */ +#ifndef ARGS +#if __STDC__ +#define ARGS(alist) alist +#else /*__STDC__*/ +#define ARGS(alist) () +#endif /*__STDC__*/ +#endif /*ARGS*/ + +/* Raster struct. */ +struct raster { + int width, height; /* size in pixels */ + int depth; /* bits per pixel - 1 or 8 */ + int linelongs; /* longs from one line to the next - for padding */ + u_long* pixels; /* pointer to the actual bits */ + caddr_t data; /* special pointer for frame buffers and subregions */ + }; + +/* Colormap struct. */ +struct raster_colormap { + int length; + u_char* red; + u_char* grn; + u_char* blu; + }; + +/* Font character struct. */ +struct raster_char { + struct raster* r; + int homex, homey; + int nextx, nexty; + }; + +#ifdef COLORFONT_CACHE +struct raster_fontcache { + struct raster* cr[256]; + u_char color[256]; + }; +#endif /*COLORFONT_CACHE*/ + +/* Font struct. */ +struct raster_font { + int width, height; /* nominal character size */ + int flags; +#define RASFONT_FIXEDWIDTH 0x1 +#define RASFONT_NOVERTICALMOVEMENT 0x2 + struct raster_char chars[256]; +#ifdef COLORFONT_CACHE + struct raster_fontcache* cache; +#endif /*COLORFONT_CACHE*/ + }; + +/* Defines for the raster_op() and raster_text() rop parameter - the bitblit +** operation. A rop can be some Boolean combination of RAS_SRC and +** RAS_DST. For instance, just RAS_SRC means copy the source to the +** destination without modification. RAS_SRC|RAS_DST means "or" the source +** and destination together, while "xor" would be RAS_SRC^RAS_DST. The +** RAS_NOT macro should be used to express negation - RAS_NOT(RAS_SRC)&RAS_DST +** would "and" the complement of the source with the destination. +** +** Or, you can just use one of the pre-defined ops. There are only 16 +** possible combinations, so all 16 are defined here. +** +** For color rasters, you specify the color of the operation by simply +** oring RAS_COLOR(color) into the rop. +*/ + +#define RAS_NOT(op) ( 0xf & ( ~ (op) ) ) + +#define RAS_CLEAR 0x0 /* 0 */ +#define RAS_NOTOR 0x1 /* !( src | dst ) */ +#define RAS_NOTSRC_AND_DST 0x2 /* !src & dst */ +#define RAS_INVERTSRC 0x3 /* !src */ +#define RAS_SRC_AND_NOTDST 0x4 /* src & !dst */ +#define RAS_INVERT 0x5 /* !dst */ +#define RAS_XOR 0x6 /* src ^ dst */ +#define RAS_NOTAND 0x7 /* !( src & dst ) */ +#define RAS_AND 0x8 /* src & dst */ +#define RAS_NOTXOR 0x9 /* !( src ^ dst ) */ +#define RAS_DST 0xa /* dst */ +#define RAS_NOTSRC_OR_DST 0xb /* !src | dst */ +#define RAS_SRC 0xc /* src */ +#define RAS_SRC_OR_NOTDST 0xd /* src | !dst */ +#define RAS_OR 0xe /* src | dst */ +#define RAS_SET 0xf /* 1 */ + +#define RAS_COLOR(color) ( ( (color) & 0xff ) << 4 ) + +/* Get the op from a rop. */ +#define RAS_GETOP(op) ( (op) & 0xf ) +/* Get the color from a rop. */ +#define RAS_GETCOLOR(op) ( ( (op) >> 4 ) & 0xff ) +/* Get the longword address of a pixel. */ +#define RAS_ADDR( r, x, y ) \ + ( (r)->pixels + (y) * (r)->linelongs + (x) * (r)->depth / 32 ) + + +/* Raster routines. */ + +extern struct raster* raster_alloc ARGS(( int width, int height, int depth )); +/* Allocates a raster. Returns (struct raster*) 0 on failure. */ + +extern void raster_free ARGS(( struct raster* r )); +/* Frees/closes a raster. */ + +extern int raster_get ARGS(( struct raster* r, int x, int y )); +/* Gets a single pixel from a raster. */ + +extern void raster_put ARGS(( struct raster* r, int x, int y, int v )); +/* Puts a single pixel into a raster. */ + +extern struct raster* raster_subregion ARGS(( struct raster* r, int x, int y, int width, int height )); +/* Makes a raster that points to a region of another. Returns +** (struct raster*) 0 on failure. +*/ + + +/* Raster operations. */ + +extern int raster_op ARGS(( struct raster* dst, int dx, int dy, int w, int h, int rop, struct raster* src, int sx, int sy )); +/* Performs a bitblit. Returns 0 on success, -1 on failure. */ + +extern int raster_op_noclip ARGS(( struct raster* dst, int dx, int dy, int w, int h, int rop, struct raster* src, int sx, int sy )); +/* Bitblit without clipping. Returns 0 on success, -1 on failure. */ + +extern int raster_op_nosrc_noclip ARGS(( struct raster* dst, int dx, int dy, int w, int h, int rop )); +/* No-src bitblit without clipping. Returns 0 on success, -1 on failure. */ + +extern int raster_replsrc ARGS(( struct raster* dst, int dx, int dy, int w, int h, int rop, struct raster* src, int sx, int sy )); +/* Tiles the src to fit the dst. Returns 0 on success, -1 on failure. Only +** implements RAS_SRC. +*/ + + +/* Raster text routines */ + +extern struct raster_font* raster_fontopen ARGS(( char* fontname )); +/* Opens a font. Returns (struct raster_font*) 0 on failure. */ + +extern int raster_text ARGS(( struct raster* r, int x, int y, int rop, struct raster_font* rf, char* text )); +/* Draws text. Returns 0 on success, -1 on failure. */ + +extern int raster_textn ARGS(( struct raster* r, int x, int y, int rop, struct raster_font* rf, char* text, int len )); +/* Draws n characters of text. Returns 0 on success, -1 on failure. */ + +extern void raster_fontclose ARGS(( struct raster_font* rf )); +/* Closes a font. */ + + +/* Frame buffer routines. */ + +extern struct raster* raster_open ARGS(( char* fbname )); +/* Opens a frame buffer as a raster. Returns (struct raster*) 0 on failure. */ + +extern struct raster* raster_coloropen ARGS(( void )); +/* Opens a color frame buffer if there is one. Returns (struct raster*) 0 on +** failure. +*/ + +extern int raster_video_off ARGS(( struct raster* r )); +/* Blanks the screen. Returns 0 on success, -1 on failure. This might +** be implemented as actual video blanking, or it might just load black +** into all colormap entries (and disable further colormap changes). +*/ + +extern int raster_video_on ARGS(( struct raster* r )); +/* Re-enables video. Returns 0 on success, -1 on failure. */ + +extern struct raster_colormap* raster_colormap_alloc ARGS(( int length )); +/* Allocates a colormap structure, returns 0 on failure. */ + +extern struct raster_colormap* raster_colormap_get ARGS(( struct raster* r )); +/* Allocates a colormap structure and returns the frame buffer's +** current colormap, or (struct raster_colormap*) 0 on failure. The raster +** must be one returned by raster_open(), not raster_alloc(). +*/ + +extern int raster_colormap_set ARGS(( struct raster* r, struct raster_colormap* cm )); +/* Sets a frame buffer's colormap. The raster must be one returned +** by raster_open(), not raster_alloc(). Returns 0 on success, -1 on +** failure. +*/ + +extern void raster_colormap_free ARGS(( struct raster_colormap* cm )); +/* Frees a colormap. */ + +#endif /*_RASTER_H_*/ diff --git a/History/rcons/raster_op.c b/History/rcons/raster_op.c new file mode 100644 index 0000000..10bc835 --- /dev/null +++ b/History/rcons/raster_op.c @@ -0,0 +1,1325 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory and to the University + * of California at Berkeley by Jef Poskanzer. + * + * 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. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * @(#)raster_op.c 7.1 (Berkeley) 7/13/92 + * + * from: $Header: raster_op.c,v 1.22 92/06/17 08:14:44 torek Exp $ + */ + +/* + * Bitblit routine for raster library. + * + * This raster-op is machined to exacting tolerances by skilled native + * craftsmen with pride in their work. + * + * The various cases are broken down like this: + * + * src required + * 1-bit to 1-bit + * 1-bit to 8-bits + * 8-bits to 8-bits + * no src required + * 1-bit no-src + * 8-bits no-src + */ + +#ifdef KERNEL +#include "sys/types.h" +#else +#include +#endif +#include "raster.h" + +/* CONFIGURE: To save on executable size, you can configure out the seldom-used +** logical operations. With this variable set, the only operations implemented +** are: RAS_SRC, RAS_CLEAR, RAS_SET, RAS_INVERT, RAS_XOR, RAS_INVERTSRC. +*/ +#ifdef KERNEL +#define PARTIAL_LOGICAL_OPS +#endif + +/* CONFIGURE: bcopy() is supposed to be the ultimately fastest way to move +** bytes, overlapping or not, ignoring the startup cost. Unfortunately +** this is not true on some systems. For example, on a Sun 3 running +** SunOS 3.5, bcopy() is about five times slower than a simple for loop +** on overlapping copies. And on a 4.1.1 SPARC, bcopy() is about 2/3rds +** as fast on backwards overlaps. So, only define this if your bcopy is ok. +*/ +#undef BCOPY_FASTER + +/* End of configurable definitions. */ + + +/* Definitions. */ + +/* Raster-op macros. These encapsulate the switch statements and so make +** the source code 16 times smaller. The pre and pst args are code +** fragments to put before and after the assignment in each case. They +** can be the beginning and end of a loop. If the pst fragment includes a +** masked assignment, for example to handle the left or right edge cases, +** a good optimizing compiler will simplify the boolean expressions very +** nicely - both cc and gcc on the SPARC will do this. +*/ + +#ifndef PARTIAL_LOGICAL_OPS + +#define ROP_DST(op,pre,d,pst) \ + switch ( op ) \ + { \ + case RAS_CLEAR: \ + pre \ + (d) = 0; \ + pst \ + break; \ + case RAS_INVERT: \ + pre \ + (d) = ~(d); \ + pst \ + break; \ + case RAS_DST: \ + /* noop */ \ + break; \ + case RAS_SET: \ + pre \ + (d) = ~0; \ + pst \ + break; \ + default: \ + return -1; \ + } + +#define ROP_DSTCOLOR(op,pre,d,c,pst) \ + switch ( op ) \ + { \ + case RAS_CLEAR: \ + pre \ + (d) = 0; \ + pst \ + break; \ + case RAS_INVERT: \ + pre \ + (d) = ~(d); \ + pst \ + break; \ + case RAS_DST: \ + /* noop */ \ + break; \ + case RAS_SET: \ + pre \ + (d) = (c); \ + pst \ + break; \ + default: \ + return -1; \ + } + +#define ROP_SRCDST(op,pre,s,d,pst) \ + switch ( op ) \ + { \ + case RAS_NOTOR: \ + pre \ + (d) = ~( (s) | (d) ); \ + pst \ + break; \ + case RAS_NOTSRC_AND_DST: \ + pre \ + (d) = ~(s) & (d); \ + pst \ + break; \ + case RAS_INVERTSRC: \ + pre \ + (d) = ~(s); \ + pst \ + break; \ + case RAS_SRC_AND_NOTDST: \ + pre \ + (d) = (s) & ~(d); \ + pst \ + break; \ + case RAS_XOR: \ + pre \ + (d) = (s) ^ (d); \ + pst \ + break; \ + case RAS_NOTAND: \ + pre \ + (d) = ~( (s) & (d) ); \ + pst \ + break; \ + case RAS_AND: \ + pre \ + (d) = (s) & (d); \ + pst \ + break; \ + case RAS_NOTXOR: \ + pre \ + (d) = ~( (s) ^ (d) ); \ + pst \ + break; \ + case RAS_NOTSRC_OR_DST: \ + pre \ + (d) = ~(s) | (d); \ + pst \ + break; \ + case RAS_SRC: \ + pre \ + (d) = (s); \ + pst \ + break; \ + case RAS_SRC_OR_NOTDST: \ + pre \ + (d) = (s) | ~(d); \ + pst \ + break; \ + case RAS_OR: \ + pre \ + (d) = (s) | (d); \ + pst \ + break; \ + default: \ + return -1; \ + } + +#define ROP_SRCDSTCOLOR(op,pre,s,d,c,pst) \ + switch ( op ) \ + { \ + case RAS_NOTOR: \ + pre \ + if ( s ) \ + (d) = ~( (c) | (d) ); \ + else \ + (d) = ~(d); \ + pst \ + break; \ + case RAS_NOTSRC_AND_DST: \ + pre \ + if ( s ) \ + (d) = ~(c) & (d); \ + pst \ + break; \ + case RAS_INVERTSRC: \ + pre \ + if ( s ) \ + (d) = ~(c); \ + else \ + (d) = ~0; \ + pst \ + break; \ + case RAS_SRC_AND_NOTDST: \ + pre \ + if ( s ) \ + (d) = (c) & ~(d); \ + else \ + (d) = 0; \ + pst \ + break; \ + case RAS_XOR: \ + pre \ + if ( s ) \ + (d) = (c) ^ (d); \ + pst \ + break; \ + case RAS_NOTAND: \ + pre \ + if ( s ) \ + (d) = ~( (c) & (d) ); \ + else \ + (d) = ~0; \ + pst \ + break; \ + case RAS_AND: \ + pre \ + if ( s ) \ + (d) = (c) & (d); \ + else \ + (d) = 0; \ + pst \ + break; \ + case RAS_NOTXOR: \ + pre \ + if ( s ) \ + (d) = ~( (c) ^ (d) ); \ + else \ + (d) = ~(d); \ + pst \ + break; \ + case RAS_NOTSRC_OR_DST: \ + pre \ + if ( s ) \ + (d) = ~(c) | (d); \ + else \ + (d) = ~0; \ + pst \ + break; \ + case RAS_SRC: \ + pre \ + if ( s ) \ + (d) = (c); \ + else \ + (d) = 0; \ + pst \ + break; \ + case RAS_SRC_OR_NOTDST: \ + pre \ + if ( s ) \ + (d) = (c) | ~(d); \ + else \ + (d) = ~(d); \ + pst \ + break; \ + case RAS_OR: \ + pre \ + if ( s ) \ + (d) = (c) | (d); \ + pst \ + break; \ + default: \ + return -1; \ + } + +#else /*PARTIAL_LOGICAL_OPS*/ + +#define ROP_DST(op,pre,d,pst) \ + switch ( op ) \ + { \ + case RAS_CLEAR: \ + pre \ + (d) = 0; \ + pst \ + break; \ + case RAS_INVERT: \ + pre \ + (d) = ~(d); \ + pst \ + break; \ + case RAS_SET: \ + pre \ + (d) = ~0; \ + pst \ + break; \ + default: \ + return -1; \ + } + +#define ROP_DSTCOLOR(op,pre,d,c,pst) \ + switch ( op ) \ + { \ + case RAS_CLEAR: \ + pre \ + (d) = 0; \ + pst \ + break; \ + case RAS_INVERT: \ + pre \ + (d) = ~(d); \ + pst \ + break; \ + case RAS_SET: \ + pre \ + (d) = (c); \ + pst \ + break; \ + default: \ + return -1; \ + } + +#define ROP_SRCDST(op,pre,s,d,pst) \ + switch ( op ) \ + { \ + case RAS_INVERTSRC: \ + pre \ + (d) = ~(s); \ + pst \ + break; \ + case RAS_XOR: \ + pre \ + (d) = (s) ^ (d); \ + pst \ + break; \ + case RAS_SRC: \ + pre \ + (d) = (s); \ + pst \ + break; \ + default: \ + return -1; \ + } + +#define ROP_SRCDSTCOLOR(op,pre,s,d,c,pst) \ + switch ( op ) \ + { \ + case RAS_INVERTSRC: \ + pre \ + if ( s ) \ + (d) = ~(c); \ + else \ + (d) = ~0; \ + pst \ + break; \ + case RAS_XOR: \ + pre \ + if ( s ) \ + (d) = (c) ^ (d); \ + pst \ + break; \ + case RAS_SRC: \ + pre \ + if ( s ) \ + (d) = (c); \ + else \ + (d) = 0; \ + pst \ + break; \ + default: \ + return -1; \ + } + +#endif /*PARTIAL_LOGICAL_OPS*/ + + +/* Variables. */ + +static int needsrc[16] = { 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0 }; +/* CLEAR INVERT DST SET */ + +#ifdef MSBIT_FIRST + +u_long raster_bitmask[32] = { + 0x80000000, 0x40000000, 0x20000000, 0x10000000, + 0x08000000, 0x04000000, 0x02000000, 0x01000000, + 0x00800000, 0x00400000, 0x00200000, 0x00100000, + 0x00080000, 0x00040000, 0x00020000, 0x00010000, + 0x00008000, 0x00004000, 0x00002000, 0x00001000, + 0x00000800, 0x00000400, 0x00000200, 0x00000100, + 0x00000080, 0x00000040, 0x00000020, 0x00000010, + 0x00000008, 0x00000004, 0x00000002, 0x00000001 }; + +#ifdef MSBYTE_FIRST +static u_long leftmask[32] = { + 0x00000000, 0x80000000, 0xc0000000, 0xe0000000, + 0xf0000000, 0xf8000000, 0xfc000000, 0xfe000000, + 0xff000000, 0xff800000, 0xffc00000, 0xffe00000, + 0xfff00000, 0xfff80000, 0xfffc0000, 0xfffe0000, + 0xffff0000, 0xffff8000, 0xffffc000, 0xffffe000, + 0xfffff000, 0xfffff800, 0xfffffc00, 0xfffffe00, + 0xffffff00, 0xffffff80, 0xffffffc0, 0xffffffe0, + 0xfffffff0, 0xfffffff8, 0xfffffffc, 0xfffffffe }; +static u_long rightmask[32] = { + 0x00000000, 0x00000001, 0x00000003, 0x00000007, + 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, + 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, + 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, + 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, + 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, + 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, + 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff }; +#endif /*MSBYTE_FIRST*/ + +#else /*MSBIT_FIRST*/ + +u_long raster_bitmask[32] = { + 0x00000001, 0x00000002, 0x00000004, 0x00000008, + 0x00000010, 0x00000020, 0x00000040, 0x00000080, + 0x00000100, 0x00000200, 0x00000400, 0x00000800, + 0x00001000, 0x00002000, 0x00004000, 0x00008000, + 0x00010000, 0x00020000, 0x00040000, 0x00080000, + 0x00100000, 0x00200000, 0x00400000, 0x00800000, + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000 }; + +#ifndef MSBYTE_FIRST +static u_long leftmask[32] = { + 0x00000000, 0x00000001, 0x00000003, 0x00000007, + 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, + 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, + 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, + 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, + 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, + 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, + 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff }; +static u_long rightmask[32] = { + 0x00000000, 0x80000000, 0xc0000000, 0xe0000000, + 0xf0000000, 0xf8000000, 0xfc000000, 0xfe000000, + 0xff000000, 0xff800000, 0xffc00000, 0xffe00000, + 0xfff00000, 0xfff80000, 0xfffc0000, 0xfffe0000, + 0xffff0000, 0xffff8000, 0xffffc000, 0xffffe000, + 0xfffff000, 0xfffff800, 0xfffffc00, 0xfffffe00, + 0xffffff00, 0xffffff80, 0xffffffc0, 0xffffffe0, + 0xfffffff0, 0xfffffff8, 0xfffffffc, 0xfffffffe }; +#endif /*not MSBYTE_FIRST*/ + +#endif /*MSBIT_FIRST*/ + +/* (The odd combinations MSBIT+~MSBYTE and ~MSBIT+MSBYTE could be added.) */ + +#ifdef MSBYTE_FIRST +static u_long bytemask[4] = { 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff }; +#else /*MSBYTE_FIRST*/ +static u_long bytemask[4] = { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }; +#endif /*MSBYTE_FIRST*/ + + +/* Forward routines. */ + +static int raster_blit(); + + +/* Raster operations. */ + +/* Performs a bitblit. Returns 0 on success, -1 on failure. */ +int +raster_op( dst, dx, dy, w, h, rop, src, sx, sy ) + struct raster* dst; + int dx, dy, w, h, rop; + struct raster* src; + int sx, sy; + { + if ( dst == (struct raster*) 0 ) + return -1; /* no destination */ + + if ( needsrc[RAS_GETOP( rop )] ) + { + /* Two-operand blit. */ + if ( src == (struct raster*) 0 ) + return -1; /* no source */ + + /* Clip against source. */ + if ( sx < 0 ) + { + w += sx; + sx = 0; + } + if ( sy < 0 ) + { + h += sy; + sy = 0; + } + if ( sx + w > src->width ) + w = src->width - sx; + if ( sy + h > src->height ) + h = src->height - sy; + + /* Clip against dest. */ + if ( dx < 0 ) + { + w += dx; + sx -= dx; + dx = 0; + } + if ( dy < 0 ) + { + h += dy; + sy -= dy; + dy = 0; + } + if ( dx + w > dst->width ) + w = dst->width - dx; + if ( dy + h > dst->height ) + h = dst->height - dy; + + if ( w <= 0 || h <= 0 ) + return 0; /* nothing to do */ + + return raster_op_noclip( dst, dx, dy, w, h, rop, src, sx, sy ); + } + + /* No source necessary - one-operand blit. */ + if ( src != (struct raster*) 0 ) + return -1; /* unwanted source */ + + /* Clip against dest. */ + if ( dx < 0 ) + { + w += dx; + dx = 0; + } + if ( dy < 0 ) + { + h += dy; + dy = 0; + } + if ( dx + w > dst->width ) + w = dst->width - dx; + if ( dy + h > dst->height ) + h = dst->height - dy; + + if ( w <= 0 || h <= 0 ) + return 0; /* nothing to do */ + + return raster_op_nosrc_noclip( dst, dx, dy, w, h, rop ); + } + +/* Semi-public routine to do a bitblit without clipping. Returns 0 on +** success, -1 on failure. +*/ +int +raster_op_noclip( dst, dx, dy, w, h, rop, src, sx, sy ) + struct raster* dst; + int dx, dy, w, h, rop; + struct raster* src; + int sx, sy; + { + int op; + + op = RAS_GETOP( rop ); + + if ( src->depth == 1 ) + { + /* One-bit to ? blit. */ + if ( dst->depth == 1 ) + { + /* One to one blit. */ + u_long* srclin1; + u_long* dstlin1; + int srcleftignore, srcrightignore, srclongs; + int dstleftignore, dstrightignore, dstlongs; + + srclin1 = RAS_ADDR( src, sx, sy ); + dstlin1 = RAS_ADDR( dst, dx, dy ); + +#ifdef BCOPY_FASTER + /* Special-case full-width to full-width copies. */ + if ( op == RAS_SRC && src->width == w && dst->width == w && + src->linelongs == dst->linelongs && src->linelongs == w >> 5 ) + { + bcopy( + (char*) srclin1, (char*) dstlin1, + h * src->linelongs * sizeof(u_long) ); + return 0; + } +#endif /*BCOPY_FASTER*/ + + srcleftignore = ( sx & 31 ); + srclongs = ( srcleftignore + w + 31 ) >> 5; + srcrightignore = ( srclongs * 32 - w - srcleftignore ) & 31; + dstleftignore = ( dx & 31 ); + dstlongs = ( dstleftignore + w + 31 ) >> 5; + dstrightignore = ( dstlongs * 32 - w - dstleftignore ) & 31; + + return raster_blit( + src, srclin1, srcleftignore, srcrightignore, srclongs, + dst, dstlin1, dstleftignore, dstrightignore, dstlongs, h, op ); + } + + else + { + /* One to eight, using the color in the rop. This could + ** probably be sped up by handling each four-bit source nybble + ** as a group, indexing into a 16-element runtime-constructed + ** table of longwords. + */ + u_long* srclin1; + u_long* dstlin1; + u_long* srclin2; + u_long* srclin; + u_long* dstlin; + register u_long* srclong; + register u_long* dstlong; + register u_long color, dl; + register int srcbit, dstbyte, i; + + color = RAS_GETCOLOR( rop ); + if ( color == 0 ) + color = 255; + + /* Make 32 bits of color so we can do the ROP without shifting. */ + color |= ( color << 24 ) | ( color << 16 ) | ( color << 8 ); + + /* Don't have to worry about overlapping blits here. */ + srclin1 = RAS_ADDR( src, sx, sy ); + srclin2 = srclin1 + h * src->linelongs; + dstlin1 = RAS_ADDR( dst, dx, dy ); + srclin = srclin1; + dstlin = dstlin1; + while ( srclin != srclin2 ) + { + srclong = srclin; + srcbit = sx & 31; + dstlong = dstlin; + dstbyte = dx & 3; + i = w; + + /* WARNING: this code is KNOWN TO FAIL on Sun 3's / CG2's. */ + ROP_SRCDSTCOLOR( + /*op*/ op, + /*pre*/ while ( i > 0 ) + { + dl = *dstlong;, + /*s*/ *srclong & raster_bitmask[srcbit], + /*d*/ dl, + /*c*/ color, + /*pst*/ *dstlong = ( *dstlong & ~bytemask[dstbyte] ) | + ( dl & bytemask[dstbyte] ); + if ( srcbit == 31 ) + { + srcbit = 0; + ++srclong; + } + else + ++srcbit; + if ( dstbyte == 3 ) + { + dstbyte = 0; + ++dstlong; + } + else + ++dstbyte; + --i; + } ) + + srclin += src->linelongs; + dstlin += dst->linelongs; + } + } + } + + else + { + /* Eight to eight blit. */ + u_long* srclin1; + u_long* dstlin1; + int srcleftignore, srcrightignore, srclongs; + int dstleftignore, dstrightignore, dstlongs; + + if ( dst->depth != 8 ) + return -1; /* depth mismatch */ + + srclin1 = RAS_ADDR( src, sx, sy ); + dstlin1 = RAS_ADDR( dst, dx, dy ); + +#ifdef BCOPY_FASTER + /* Special-case full-width to full-width copies. */ + if ( op == RAS_SRC && src->width == w && dst->width == w && + src->linelongs == dst->linelongs && src->linelongs == w >> 2 ) + { + bcopy( (char*) srclin1, (char*) dstlin1, + h * src->linelongs * sizeof(u_long) ); + return 0; + } +#endif /*BCOPY_FASTER*/ + + srcleftignore = ( sx & 3 ) * 8; + srclongs = ( srcleftignore + w * 8 + 31 ) >> 5; + srcrightignore = ( srclongs * 32 - w * 8 - srcleftignore ) & 31; + dstleftignore = ( dx & 3 ) * 8; + dstlongs = ( dstleftignore + w * 8 + 31 ) >> 5; + dstrightignore = ( dstlongs * 32 - w * 8 - dstleftignore ) & 31; + + return raster_blit( + src, srclin1, srcleftignore, srcrightignore, srclongs, + dst, dstlin1, dstleftignore, dstrightignore, dstlongs, h, op ); + } + + return 0; + } + +/* Semi-public routine to do a no-src bitblit without clipping. Returns 0 +** on success, -1 on failure. +*/ +int +raster_op_nosrc_noclip( dst, dx, dy, w, h, rop ) + struct raster* dst; + int dx, dy, w, h, rop; + { + int op; + + op = RAS_GETOP( rop ); + + if ( dst->depth == 1 ) + { + /* One-bit no-src blit. */ + u_long* dstlin1; + u_long* dstlin2; + u_long* dstlin; + int dstleftignore, dstrightignore, dstlongs; + u_long dl, lm, nlm, rm, nrm; + register u_long* dstlong2; + register u_long* dstlong; + + dstlin1 = RAS_ADDR( dst, dx, dy ); + +#ifdef BCOPY_FASTER + /* Special-case full-width clears. */ + if ( op == RAS_CLEAR && dst->width == w && dst->linelongs == w >> 5 ) + { + bzero( (char*) dstlin1, h * dst->linelongs * sizeof(u_long) ); + return 0; + } +#endif /*BCOPY_FASTER*/ + + dstleftignore = ( dx & 31 ); + dstlongs = ( dstleftignore + w + 31 ) >> 5; + dstrightignore = ( dstlongs * 32 - w - dstleftignore ) & 31; + + dstlin2 = dstlin1 + h * dst->linelongs; + dstlin = dstlin1; + + if ( dstlongs == 1 ) + { + /* It fits into a single longword. */ + lm = leftmask[dstleftignore] | rightmask[dstrightignore]; + nlm = ~lm; + while ( dstlin != dstlin2 ) + { + ROP_DST( + /*op*/ op, + /*pre*/ dl = *dstlin;, + /*d*/ dl, + /*pst*/ *dstlin = ( *dstlin & lm ) | ( dl & nlm ); ) + + dstlin += dst->linelongs; + } + } + else + { + lm = leftmask[dstleftignore]; + rm = rightmask[dstrightignore]; + nrm = ~rm; + nlm = ~lm; + + while ( dstlin != dstlin2 ) + { + dstlong = dstlin; + dstlong2 = dstlong + dstlongs; + if ( dstrightignore != 0 ) + --dstlong2; + + /* Leading edge. */ + if ( dstleftignore != 0 ) + { + ROP_DST( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*d*/ dl, + /*pst*/ *dstlong = ( *dstlong & lm ) | ( dl & nlm ); ) + ++dstlong; + } + + /* Main rop. */ + ROP_DST( + /*op*/ op, + /*pre*/ while ( dstlong != dstlong2 ) + {, + /*d*/ *dstlong, + /*pst*/ ++dstlong; + } ) + + /* Trailing edge. */ + if ( dstrightignore != 0 ) + { + ROP_DST( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*d*/ dl, + /*pst*/ *dstlong = ( dl & nrm ) | ( *dstlong & rm ); ) + } + + dstlin += dst->linelongs; + } + } + } + + else + { + /* Eight-bit no-src blit. */ + register u_long color; + u_long* dstlin1; + u_long* dstlin2; + u_long* dstlin; + int dstleftignore, dstrightignore, dstlongs; + u_long dl, lm, nlm, rm, nrm; + register u_long* dstlong2; + register u_long* dstlong; + + dstlin1 = RAS_ADDR( dst, dx, dy ); + +#ifdef BCOPY_FASTER + /* Special-case full-width clears. */ + if ( op == RAS_CLEAR && dst->width == w && dst->linelongs == w >> 2 ) + { + bzero( (char*) dstlin1, h * dst->linelongs * sizeof(u_long) ); + return 0; + } +#endif /*BCOPY_FASTER*/ + + color = RAS_GETCOLOR( rop ); + if ( color == 0 ) + color = 255; + + /* Make 32 bits of color so we can do the ROP without shifting. */ + color |= ( color << 24 ) | ( color << 16 ) | ( color << 8 ); + + dstleftignore = ( dx & 3 ) * 8; + dstlongs = ( dstleftignore + w * 8 + 31 ) >> 5; + dstrightignore = ( dstlongs * 32 - w * 8 - dstleftignore ) & 31; + + dstlin2 = dstlin1 + h * dst->linelongs; + dstlin = dstlin1; + + if ( dstlongs == 1 ) + { + /* It fits into a single longword. */ + lm = leftmask[dstleftignore] | rightmask[dstrightignore]; + nlm = ~lm; + while ( dstlin != dstlin2 ) + { + ROP_DSTCOLOR( + /*op*/ op, + /*pre*/ dl = *dstlin;, + /*d*/ dl, + /*c*/ color, + /*pst*/ *dstlin = ( *dstlin & lm ) | ( dl & nlm ); ) + + dstlin += dst->linelongs; + } + } + else + { + lm = leftmask[dstleftignore]; + rm = rightmask[dstrightignore]; + nrm = ~rm; + nlm = ~lm; + while ( dstlin != dstlin2 ) + { + dstlong = dstlin; + dstlong2 = dstlong + dstlongs; + if ( dstrightignore != 0 ) + --dstlong2; + + /* Leading edge. */ + if ( dstleftignore != 0 ) + { + ROP_DSTCOLOR( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*d*/ dl, + /*c*/ color, + /*pst*/ *dstlong = ( *dstlong & lm ) | ( dl & nlm ); ) + ++dstlong; + } + + /* Main rop. */ + ROP_DSTCOLOR( + /*op*/ op, + /*pre*/ while ( dstlong != dstlong2 ) + {, + /*d*/ *dstlong, + /*c*/ color, + /*pst*/ ++dstlong; + } ) + + /* Trailing edge. */ + if ( dstrightignore != 0 ) + { + ROP_DSTCOLOR( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*d*/ dl, + /*c*/ color, + /*pst*/ *dstlong = ( dl & nrm ) | ( *dstlong & rm ); ) + } + + dstlin += dst->linelongs; + } + } + } + + return 0; + } + +/* This is a general bitblit routine, handling overlapping source and +** destination. It's used for both the 1-to-1 and 8-to-8 cases. +*/ +static int +raster_blit( src, srclin1, srcleftignore, srcrightignore, srclongs, dst, dstlin1, dstleftignore, dstrightignore, dstlongs, h, op ) + struct raster* src; + u_long* srclin1; + int srcleftignore, srcrightignore, srclongs; + struct raster* dst; + u_long* dstlin1; + int dstleftignore, dstrightignore, dstlongs; + int h, op; + { + u_long* srclin2; + u_long* dstlin2; + int srclininc, dstlininc; + u_long* srclin; + u_long* dstlin; + register int prevleftshift, currrightshift; + int longinc; + register u_long* srclong; + register u_long* dstlong; + register u_long* dstlong2; + register u_long dl, lm, nlm, rm, nrm; + + prevleftshift = ( srcleftignore - dstleftignore ) & 31; + + srclin2 = srclin1 + h * src->linelongs; + dstlin2 = dstlin1 + h * dst->linelongs; + srclininc = src->linelongs; + dstlininc = dst->linelongs; + longinc = 1; + + /* Check for overlaps. */ + if ( ( dstlin1 >= srclin1 && dstlin1 < srclin1 + srclongs ) || + ( srclin1 >= dstlin1 && srclin1 < dstlin1 + dstlongs ) ) + { + /* Horizontal overlap. Should we reverse? */ + if ( srclin1 < dstlin1 ) + { + longinc = -1; + srclin1 += srclongs - 1; + srclin2 += srclongs - 1; + dstlin1 += dstlongs - 1; + } + } + else if ( ( dstlin1 >= srclin1 && dstlin1 < srclin2 ) || + ( srclin1 >= dstlin1 && srclin1 < dstlin2 ) ) + { + /* Vertical overlap. Should we reverse? */ + if ( srclin1 < dstlin1 ) + { + srclin2 = srclin1 - srclininc; + srclin1 += ( h - 1 ) * srclininc; + dstlin1 += ( h - 1 ) * dstlininc; + srclininc = -srclininc; + dstlininc = -dstlininc; + } + } + srclin = srclin1; + dstlin = dstlin1; + + if ( prevleftshift == 0 ) + { + /* The bits line up, no shifting necessary. */ + if ( dstlongs == 1 ) + { + /* It all fits into a single longword. */ + lm = leftmask[dstleftignore] | rightmask[dstrightignore]; + nlm = ~lm; + while ( srclin != srclin2 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ dl = *dstlin;, + /*s*/ *srclin, + /*d*/ dl, + /*pst*/ *dstlin = ( *dstlin & lm ) | ( dl & nlm ); ) + + srclin += srclininc; + dstlin += dstlininc; + } + } + else + { + /* Multiple longwords. */ + lm = leftmask[dstleftignore]; + rm = rightmask[dstrightignore]; + nrm = ~rm; + nlm = ~lm; + if ( longinc == 1 ) + { + /* Left to right. */ + while ( srclin != srclin2 ) + { + srclong = srclin; + dstlong = dstlin; + dstlong2 = dstlong + dstlongs; + if ( dstrightignore != 0 ) + --dstlong2; + + /* Leading edge. */ + if ( dstleftignore != 0 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*s*/ *srclong, + /*d*/ dl, + /*pst*/ *dstlong = ( *dstlong & lm ) | ( dl & nlm ); ) + ++srclong; + ++dstlong; + } + + /* Main rop. */ + ROP_SRCDST( + /*op*/ op, + /*pre*/ while ( dstlong != dstlong2 ) + {, + /*s*/ *srclong, + /*d*/ *dstlong, + /*pst*/ ++srclong; + ++dstlong; + } ) + + /* Trailing edge. */ + if ( dstrightignore != 0 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*s*/ *srclong, + /*d*/ dl, + /*pst*/ *dstlong = ( dl & nrm ) | ( *dstlong & rm ); ) + } + + srclin += srclininc; + dstlin += dstlininc; + } + } + else + { + /* Right to left. */ + while ( srclin != srclin2 ) + { + srclong = srclin; + dstlong = dstlin; + dstlong2 = dstlong - dstlongs; + if ( dstleftignore != 0 ) + ++dstlong2; + + /* Leading edge. */ + if ( dstrightignore != 0 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*s*/ *srclong, + /*d*/ dl, + /*pst*/ *dstlong = ( dl & nrm ) | ( *dstlong & rm ); ) + --srclong; + --dstlong; + } + + /* Main rop. */ + ROP_SRCDST( + /*op*/ op, + /*pre*/ while ( dstlong != dstlong2 ) + {, + /*s*/ *srclong, + /*d*/ *dstlong, + /*pst*/ --srclong; + --dstlong; + } ) + + /* Trailing edge. */ + if ( dstleftignore != 0 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*s*/ *srclong, + /*d*/ dl, + /*pst*/ *dstlong = ( *dstlong & lm ) | ( dl & nlm ); ) + } + + srclin += srclininc; + dstlin += dstlininc; + } + } + } + } + + else + { + /* General case, with shifting and everything. */ + register u_long sl, prevsl; + + currrightshift = 32 - prevleftshift; + if ( srclongs == 1 && dstlongs == 1 ) + { + /* It fits into a single longword, with a shift. */ + lm = leftmask[dstleftignore] | rightmask[dstrightignore]; + nlm = ~lm; + if ( srcleftignore > dstleftignore ) + { + while ( srclin != srclin2 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ dl = *dstlin;, + /*s*/ *srclin << prevleftshift, + /*d*/ dl, + /*pst*/ *dstlin = ( *dstlin & lm ) | ( dl & nlm ); ) + + srclin += srclininc; + dstlin += dstlininc; + } + } + else + { + while ( srclin != srclin2 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ dl = *dstlin;, + /*s*/ *srclin >> currrightshift, + /*d*/ dl, + /*pst*/ *dstlin = ( *dstlin & lm ) | ( dl & nlm ); ) + + srclin += srclininc; + dstlin += dstlininc; + } + } + } + else + { + /* Multiple longwords. */ + lm = leftmask[dstleftignore]; + rm = rightmask[dstrightignore]; + nrm = ~rm; + nlm = ~lm; + if ( longinc == 1 ) + { + /* Left to right. */ + while ( srclin != srclin2 ) + { + srclong = srclin; + dstlong = dstlin; + dstlong2 = dstlong + dstlongs; + if ( srcleftignore > dstleftignore ) + prevsl = *srclong++ << prevleftshift; + else + prevsl = 0; + if ( dstrightignore != 0 ) + --dstlong2; + + /* Leading edge. */ + if ( dstleftignore != 0 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ sl = *srclong; + dl = *dstlong;, + /*s*/ prevsl | ( sl >> currrightshift ), + /*d*/ dl, + /*pst*/ *dstlong = ( *dstlong & lm ) | ( dl & nlm ); ) + prevsl = sl << prevleftshift; + ++srclong; + ++dstlong; + } + + /* Main rop. */ + ROP_SRCDST( + /*op*/ op, + /*pre*/ while ( dstlong != dstlong2 ) + { + sl = *srclong;, + /*s*/ prevsl | ( sl >> currrightshift ), + /*d*/ *dstlong, + /*pst*/ prevsl = sl << prevleftshift; + ++srclong; + ++dstlong; + } ) + + /* Trailing edge. */ + if ( dstrightignore != 0 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*s*/ prevsl | ( *srclong >> currrightshift ), + /*d*/ dl, + /*pst*/ *dstlong = ( dl & nrm ) | ( *dstlong & rm ); ) + } + + srclin += srclininc; + dstlin += dstlininc; + } + } + else + { + /* Right to left. */ + while ( srclin != srclin2 ) + { + srclong = srclin; + dstlong = dstlin; + dstlong2 = dstlong - dstlongs; + if ( srcrightignore > dstrightignore ) + prevsl = *srclong-- >> currrightshift; + else + prevsl = 0; + if ( dstleftignore != 0 ) + ++dstlong2; + + /* Leading edge. */ + if ( dstrightignore != 0 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ sl = *srclong; + dl = *dstlong;, + /*s*/ prevsl | ( sl << prevleftshift ), + /*d*/ dl, + /*pst*/ *dstlong = ( dl & nrm ) | ( *dstlong & rm ); ) + prevsl = sl >> currrightshift; + --srclong; + --dstlong; + } + + /* Main rop. */ + ROP_SRCDST( + /*op*/ op, + /*pre*/ while ( dstlong != dstlong2 ) + { + sl = *srclong;, + /*s*/ prevsl | ( sl << prevleftshift ), + /*d*/ *dstlong, + /*pst*/ prevsl = sl >> currrightshift; + --srclong; + --dstlong; + } ) + + /* Trailing edge. */ + if ( dstleftignore != 0 ) + { + ROP_SRCDST( + /*op*/ op, + /*pre*/ dl = *dstlong;, + /*s*/ prevsl | ( *srclong << prevleftshift ), + /*d*/ dl, + /*pst*/ *dstlong = ( *dstlong & lm ) | ( dl & nlm ); ) + } + + srclin += srclininc; + dstlin += dstlininc; + } + } + } + } + + return 0; + } diff --git a/History/rcons/raster_text.c b/History/rcons/raster_text.c new file mode 100644 index 0000000..0c0e73f --- /dev/null +++ b/History/rcons/raster_text.c @@ -0,0 +1,249 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory and to the University + * of California at Berkeley by Jef Poskanzer. + * + * 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. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * @(#)raster_text.c 7.1 (Berkeley) 7/13/92 + * + * from: $Header: raster_text.c,v 1.15 92/06/17 08:14:45 torek Exp $ + */ + +/* + * Text routines for raster library. + */ + +#ifdef KERNEL +#include "sys/param.h" +#include "raster.h" +#ifdef COLORFONT_CACHE +#include "sys/malloc.h" +#define NEW(size) malloc(size, M_DEVBUF, M_NOWAIT) +#endif +#else +#include +#include "raster.h" +#ifdef COLORFONT_CACHE +#include +#define NEW(size) malloc(size) +#endif +#endif + + +/* Draws text. Returns 0 on success, -1 on failure. */ +int +raster_text( r, x, y, rop, rf, text ) + register struct raster* r; + int x, y; + int rop; + struct raster_font* rf; + char* text; + { + return raster_textn( r, x, y, rop, rf, text, strlen( text ) ); + } + +/* Draws n characters of text. Returns 0 on success, -1 on failure. */ +int +raster_textn( r, x, y, rop, rf, text, n ) + register struct raster* r; + int x, y; + int rop; + struct raster_font* rf; + char* text; + int n; + { + int clip; + int x1, y1; + struct raster_char* c; + struct raster* charrast; + int i; + register char ch; + int thisx, thisy; + int phase; + + /* Check whether we can avoid clipping. */ + clip = 0; + if ( rf->flags & RASFONT_FIXEDWIDTH && + rf->flags & RASFONT_NOVERTICALMOVEMENT ) + { + /* This font is well-behaved, we can compute the extent cheaply. */ + c = &(rf->chars['@']); + charrast = c->r; + if ( x + c->homex < 0 || y + c->homey < 0 || + x + c->homex + n * c->nextx > r->width || + y + c->homey + charrast->height > r->height ) + clip = 1; + } + else + { + /* Got to step through the string to compute the extent. */ + for ( i = 0, x1 = x, y1 = y; + i < n; + ++i, x1 += c->nextx, y1 += c->nexty ) + { + c = &(rf->chars[text[i]]); + charrast = c->r; + if ( charrast != (struct raster*) 0 ) + { + if ( x1 + c->homex < 0 || y1 + c->homey < 0 || + x1 + c->homex + charrast->width > r->width || + y1 + c->homey + charrast->height > r->height ) + { + clip = 1; + break; + } + } + } + } + + /* Now display the text. */ + for ( i = 0, x1 = x, y1 = y; + i < n; + ++i, x1 += c->nextx, y1 += c->nexty ) + { + ch = text[i]; + c = &(rf->chars[ch]); + charrast = c->r; + if ( charrast != (struct raster*) 0 ) + { + thisx = x1 + c->homex; + thisy = y1 + c->homey; + + phase = 0; +#ifdef COLORFONT_CACHE + if ( r->depth == 8 ) + { + /* Initialize color font cache if necessary. */ + if ( rf->cache == (struct raster_fontcache*) -1 ) + { + int c; + + rf->cache = (struct raster_fontcache*) + NEW( sizeof(struct raster_fontcache) ); + if ( rf->cache != (struct raster_fontcache*) 0 ) + for ( c = 0; c < 256; ++c ) + rf->cache->cr[c] = (struct raster*) 0; + } + + if ( rf->cache != (struct raster_fontcache*) 0 ) + { + int color; + struct raster* cr; + + color = RAS_GETCOLOR( rop ); + cr = rf->cache->cr[ch]; + /* Is this character cached yet? */ + if ( cr != (struct raster*) 0 ) + { + /* Yes, but is it the right color? */ + if ( rf->cache->color[ch] == color ) + { + /* Yes - switch rasters. */ + charrast = cr; + } + else + { + /* No, re-draw it. */ + if ( raster_op_noclip( + cr, 0, 0, charrast->width, + charrast->height, rop, charrast, 0, 0 ) == 0 ) + { + rf->cache->color[ch] = color; + charrast = cr; + } + } + } + else + { + /* It's not cached, so cache it. */ + cr = raster_alloc( + charrast->width, charrast->height, 8 ); + if ( cr != (struct raster*) 0 ) + if ( raster_op_noclip( + cr, 0, 0, charrast->width, charrast->height, + rop, charrast, 0, 0 ) == 0 ) + { + rf->cache->color[ch] = color; + charrast = rf->cache->cr[ch] = cr; + } + } + } + } +#endif /*COLORFONT_CACHE*/ + + if ( clip ) + { + if ( raster_op( + r, thisx, thisy, charrast->width, charrast->height, + rop, charrast, phase, 0 ) < 0 ) + return -1; + } + else + { + if ( raster_op_noclip( + r, thisx, thisy, charrast->width, charrast->height, + rop, charrast, phase, 0 ) < 0 ) + return -1; + } + } + } + + return 0; + } + +#ifdef COLORFONT_CACHE +/* Allocates a raster. Returns (struct raster*) 0 on failure. */ +struct raster* +raster_alloc( width, height, depth ) + int width, height, depth; + { + struct raster* r; + int linelongs; + + if ( width <= 0 || height <= 0 || ( depth != 1 && depth != 8 ) ) + return (struct raster*) 0; + linelongs = ( ( width * depth + 31 ) >> 5 ); + r = (struct raster*) + NEW( sizeof(struct raster) + height * linelongs * sizeof(u_long)); + if ( r == (struct raster*) 0 ) + return (struct raster*) 0; + + r->width = width; + r->height = height; + r->depth = depth; + r->linelongs = linelongs; + r->pixels = (u_long*) (r + 1); + r->data = (caddr_t) 0; + return r; + } +#endif diff --git a/History/rcons/rcons_font.c b/History/rcons/rcons_font.c new file mode 100644 index 0000000..0a0f05b --- /dev/null +++ b/History/rcons/rcons_font.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratories. + * + * 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. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * @(#)rcons_font.c 7.2 (Berkeley) 7/21/92 + * + * from: $Header: rcons_font.c,v 1.8 92/06/17 06:23:37 torek Exp $ + */ + +#ifdef KERNEL +#include "sys/param.h" +#include "sys/kernel.h" +#include "sys/fbio.h" +#include "sys/device.h" +#include "machine/fbvar.h" +#else +#include +#include "myfbdevice.h" +#endif + +#include "raster.h" + +#include "gallant19.h" + +void +rcons_font(fb) + register struct fbdevice *fb; +{ + + /* XXX really rather get this from the prom */ + fb->fb_font = &gallant19; + + /* Get distance to top and bottom of font from font origin */ + fb->fb_font_ascent = -(fb->fb_font->chars)['a'].homey; +} diff --git a/History/rcons/rcons_kern.c b/History/rcons/rcons_kern.c new file mode 100644 index 0000000..73a33d8 --- /dev/null +++ b/History/rcons/rcons_kern.c @@ -0,0 +1,282 @@ +/* + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratories. + * + * 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. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * @(#)rcons_kern.c 7.2 (Berkeley) 7/21/92 + * + * from: $Header: rcons_kern.c,v 1.26 92/07/09 08:01:28 torek Exp $ + */ + +#include "sys/param.h" +#include "sys/device.h" +#include "sys/fbio.h" +#include "sys/kernel.h" +#include "sys/systm.h" +#include "sys/ioctl.h" +#include "sys/tty.h" + +#include "machine/fbvar.h" +#include "machine/autoconf.h" + +#include "../dev/kbd.h" + +#include "raster.h" + +extern struct tty *fbconstty; + +static void rcons_belltmr(void *); + +extern void rcons_puts(struct fbdevice *, char *, int); +extern void rcons_font(struct fbdevice *); + +extern int (*v_putc)(); +extern void ttrstrt(void *); + +static struct fbdevice *myfbdevicep; + +static void +rcons_cnputc(c) + int c; +{ + char buf[1]; + + if (c == '\n') + rcons_puts(myfbdevicep, "\r\n", 2); + else { + buf[0] = c; + rcons_puts(myfbdevicep, buf, 1); + } +} + +static void +rcons_output(tp) + register struct tty *tp; +{ + register int s, n, i; + char buf[OBUFSIZ]; + + s = spltty(); + if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) { + splx(s); + return; + } + tp->t_state |= TS_BUSY; + splx(s); + n = q_to_b(&tp->t_outq, buf, sizeof(buf)); + for (i = 0; i < n; ++i) + buf[i] &= 0177; /* strip parity (argh) */ + rcons_puts(myfbdevicep, buf, n); + + s = spltty(); + tp->t_state &= ~TS_BUSY; + /* Come back if there's more to do */ + if (tp->t_outq.c_cc) { + tp->t_state |= TS_TIMEOUT; + timeout(ttrstrt, tp, 1); + } + if (tp->t_outq.c_cc <= tp->t_lowat) { + if (tp->t_state&TS_ASLEEP) { + tp->t_state &= ~TS_ASLEEP; + wakeup((caddr_t)&tp->t_outq); + } + selwakeup(&tp->t_wsel); + } + splx(s); +} + +/* Ring the console bell */ +void +rcons_bell(fb) + register struct fbdevice *fb; +{ + register int i, s; + + if (fb->fb_bits & FB_VISBELL) { + /* invert the screen twice */ + for (i = 0; i < 2; ++i) + raster_op(fb->fb_sp, 0, 0, + fb->fb_sp->width, fb->fb_sp->height, + RAS_INVERT, (struct raster *) 0, 0, 0); + } + + s = splhigh(); + if (fb->fb_belldepth++) { + if (fb->fb_belldepth > 3) + fb->fb_belldepth = 3; + splx(s); + } else { + fb->fb_ringing = 1; + splx(s); + (void) kbd_docmd(KBD_CMD_BELL, 0); + /* XXX Chris doesn't like the following divide */ + timeout(rcons_belltmr, fb, hz/10); + } +} + +/* Bell timer service routine */ +static void +rcons_belltmr(p) + void *p; +{ + register struct fbdevice *fb = p; + register int s = splhigh(), i; + + if (fb->fb_ringing) { + fb->fb_ringing = 0; + i = --fb->fb_belldepth; + splx(s); + (void) kbd_docmd(KBD_CMD_NOBELL, 0); + if (i != 0) + /* XXX Chris doesn't like the following divide */ + timeout(rcons_belltmr, fb, hz/30); + } else { + fb->fb_ringing = 1; + splx(s); + (void) kbd_docmd(KBD_CMD_BELL, 0); + timeout(rcons_belltmr, fb, hz/10); + } +} + +static int +rcons_a2int(cp, deflt) + register char *cp; + register int deflt; +{ + register int i = 0; + + if (*cp == '\0') + return (deflt); + while (*cp != '\0') + i = i * 10 + *cp++ - '0'; + return (i); +} + +void +rcons_init(fb) + register struct fbdevice *fb; +{ + /* XXX this should go away */ + static struct raster xxxraster; + register struct raster *rp = fb->fb_sp = &xxxraster; + register struct fbtype *ft = &fb->fb_type; + register struct winsize *ws; + register int i; + static int row, col; + char buf[100]; + + myfbdevicep = fb; + + fb->fb_maxcol = + rcons_a2int(getpropstring(optionsnode, "screen-#columns"), 80); + fb->fb_maxrow = + rcons_a2int(getpropstring(optionsnode, "screen-#rows"), 34); + + /* XXX mostly duplicates of data in other places */ + rp->width = ft->fb_width; + rp->height = ft->fb_height; + rp->depth = ft->fb_depth; + if (fb->fb_linebytes & 0x3) { + printf("rcons_init: linebytes assumption botched (0x%x)\n", + fb->fb_linebytes); + return; + } + rp->linelongs = fb->fb_linebytes >> 2; + rp->pixels = (u_long *)fb->fb_pixels; + + fb->fb_ras_blank = RAS_CLEAR; + + /* Setup the static font */ + rcons_font(fb); + + /* Impose upper bounds on fb_max{row,col} */ + i = ft->fb_height / fb->fb_font->height; + if (fb->fb_maxrow > i) + fb->fb_maxrow = i; + i = ft->fb_width / fb->fb_font->width; + if (fb->fb_maxcol > i) + fb->fb_maxcol = i; + + /* Let the system know how big the console is */ + ws = &fbconstty->t_winsize; + ws->ws_row = fb->fb_maxrow; + ws->ws_col = fb->fb_maxcol; + ws->ws_xpixel = ft->fb_width; + ws->ws_ypixel = ft->fb_height; + + /* Center emulator screen (but align x origin to 32 bits) */ + fb->fb_xorigin = + ((ft->fb_width - fb->fb_maxcol * fb->fb_font->width) / 2) & ~0x1f; + fb->fb_yorigin = + (ft->fb_height - fb->fb_maxrow * fb->fb_font->height) / 2; + + /* Emulator width and height used for scrolling */ + fb->fb_emuwidth = fb->fb_maxcol * fb->fb_font->width; + if (fb->fb_emuwidth & 0x1f) { + /* Pad to 32 bits */ + i = (fb->fb_emuwidth + 0x1f) & ~0x1f; + /* Make sure emulator width isn't too wide */ + if (fb->fb_xorigin + i <= ft->fb_width) + fb->fb_emuwidth = i; + } + fb->fb_emuheight = fb->fb_maxrow * fb->fb_font->height; + + /* Determine addresses of prom emulator row and column */ + fb->fb_row = fb->fb_col = NULL; + sprintf(buf, "' line# >body >user %x !", &fb->fb_row); + rominterpret(buf); + sprintf(buf, "' column# >body >user %x !", &fb->fb_col); + rominterpret(buf); + if (fb->fb_row == NULL || fb->fb_col == NULL) { + /* Can't find addresses; use private copies */ + fb->fb_row = &row; + fb->fb_col = &col; + row = col = 0; + rcons_clear2eop(fb); /* clear the display */ + rcons_cursor(fb); /* and draw the initial cursor */ + } else { + /* Prom emulator cursor is currently visible */ + fb->fb_bits |= FB_CURSOR; + } + + /* Initialization done; hook us up */ + v_putc = (int (*)())rcons_cnputc; + fbconstty->t_oproc = rcons_output; + fbconstty->t_stop = (void (*)()) nullop; +} diff --git a/History/rcons/rcons_subr.c b/History/rcons/rcons_subr.c new file mode 100644 index 0000000..45a7f94 --- /dev/null +++ b/History/rcons/rcons_subr.c @@ -0,0 +1,610 @@ +/* + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratories. + * + * 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. + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * @(#)rcons_subr.c 7.2 (Berkeley) 7/21/92 + * + * from: $Header: rcons_subr.c,v 1.36 92/06/17 06:23:39 torek Exp $ + */ + +#ifdef KERNEL +#include "sys/param.h" +#include "sys/fbio.h" +#include "sys/device.h" +#include "machine/fbvar.h" +#else +#include +#include "myfbdevice.h" +#endif + +#include "raster.h" + +void rcons_text(struct fbdevice *, char *, int); +void rcons_pctrl(struct fbdevice *, int); +void rcons_esc(struct fbdevice *, int); +void rcons_doesc(struct fbdevice *, int); +void rcons_cursor(struct fbdevice *); +void rcons_invert(struct fbdevice *, int); +void rcons_clear2eop(struct fbdevice *); +void rcons_clear2eol(struct fbdevice *); +void rcons_scroll(struct fbdevice *, int); +void rcons_delchar(struct fbdevice *, int); +void rcons_delline(struct fbdevice *, int); +void rcons_insertchar(struct fbdevice *, int); +void rcons_insertline(struct fbdevice *, int); + +extern void rcons_bell(struct fbdevice *); + +#define RCONS_ISPRINT(c) ((c) >= ' ' && (c) <= '~') +#define RCONS_ISDIGIT(c) ((c) >= '0' && (c) <= '9') + +/* Output (or at least handle) a string sent to the console */ +void +rcons_puts(fb, str, n) + register struct fbdevice *fb; + register char *str; + register int n; +{ + register int c, i, j; + register char *cp; + + /* Jump scroll */ + /* XXX maybe this should be an option? */ + if ((fb->fb_bits & FB_INESC) == 0) { + /* Count newlines up to an escape sequence */ + i = 0; + j = 0; + for (cp = str; j++ < n && *cp != '\033'; ++cp) { + if (*cp == '\n') + ++i; + else if (*cp == '\013') + --i; + } + + /* Only jump scroll two or more rows */ + if (*fb->fb_row + i >= fb->fb_maxrow + 1) { + /* Erase the cursor (if necessary) */ + if (fb->fb_bits & FB_CURSOR) + rcons_cursor(fb); + + rcons_scroll(fb, i); + } + } + + /* Process characters */ + while (--n >= 0) { + c = *str; + if (c == '\033') { + /* Start an escape (perhaps aborting one in progress) */ + fb->fb_bits |= FB_INESC | FB_P0_DEFAULT | FB_P1_DEFAULT; + fb->fb_bits &= ~(FB_P0 | FB_P1); + + /* Most parameters default to 1 */ + fb->fb_p0 = fb->fb_p1 = 1; + } else if (fb->fb_bits & FB_INESC) { + rcons_esc(fb, c); + } else { + /* Erase the cursor (if necessary) */ + if (fb->fb_bits & FB_CURSOR) + rcons_cursor(fb); + + /* Display the character */ + if (RCONS_ISPRINT(c)) { + /* Try to output as much as possible */ + j = fb->fb_maxcol - (*fb->fb_col + 1); + if (j > n) + j = n; + for (i = 1; i < j && RCONS_ISPRINT(str[i]); ++i) + continue; + rcons_text(fb, str, i); + --i; + str += i; + n -= i; + } else + rcons_pctrl(fb, c); + } + ++str; + } + /* Redraw the cursor (if necessary) */ + if ((fb->fb_bits & FB_CURSOR) == 0) + rcons_cursor(fb); +} + +/* Actually write a string to the frame buffer */ +void +rcons_text(fb, str, n) + register struct fbdevice *fb; + register char *str; + register int n; +{ + register int x, y, op; + + x = *fb->fb_col * fb->fb_font->width + fb->fb_xorigin; + y = *fb->fb_row * fb->fb_font->height + + fb->fb_font_ascent + fb->fb_yorigin; + op = RAS_SRC; + if (((fb->fb_bits & FB_STANDOUT) != 0) ^ + ((fb->fb_bits & FB_INVERT) != 0)) + op = RAS_NOT(op); + raster_textn(fb->fb_sp, x, y, op, fb->fb_font, str, n); + *fb->fb_col += n; + if (*fb->fb_col >= fb->fb_maxcol) { + *fb->fb_col = 0; + (*fb->fb_row)++; + } + if (*fb->fb_row >= fb->fb_maxrow) + rcons_scroll(fb, 1); +} + +/* Handle a control character sent to the console */ +void +rcons_pctrl(fb, c) + register struct fbdevice *fb; + register int c; +{ + + switch (c) { + + case '\r': /* Carriage return */ + *fb->fb_col = 0; + break; + + case '\b': /* Backspace */ + if (*fb->fb_col > 0) + (*fb->fb_col)--; + break; + + case '\013': /* Vertical tab */ + if (*fb->fb_row > 0) + (*fb->fb_row)--; + break; + + case '\f': /* Formfeed */ + *fb->fb_row = *fb->fb_col = 0; + rcons_clear2eop(fb); + break; + + case '\n': /* Linefeed */ + (*fb->fb_row)++; + if (*fb->fb_row >= fb->fb_maxrow) + rcons_scroll(fb, 1); + break; + + case '\007': /* Bell */ + rcons_bell(fb); + break; + + case '\t': /* Horizontal tab */ + *fb->fb_col = (*fb->fb_col + 8) & ~7; + if (*fb->fb_col >= fb->fb_maxcol) + *fb->fb_col = fb->fb_maxcol - 1; + break; + } +} + +/* Handle the next character in an escape sequence */ +void +rcons_esc(fb, c) + register struct fbdevice *fb; + register int c; +{ + + if (c == '[') { + /* Parameter 0 */ + fb->fb_bits &= ~FB_P1; + fb->fb_bits |= FB_P0; + } else if (c == ';') { + /* Parameter 1 */ + fb->fb_bits &= ~FB_P0; + fb->fb_bits |= FB_P1; + } else if (RCONS_ISDIGIT(c)) { + /* Add a digit to a parameter */ + if (fb->fb_bits & FB_P0) { + /* Parameter 0 */ + if (fb->fb_bits & FB_P0_DEFAULT) { + fb->fb_bits &= ~FB_P0_DEFAULT; + fb->fb_p0 = 0; + } + fb->fb_p0 *= 10; + fb->fb_p0 += c - '0'; + } else if (fb->fb_bits & FB_P1) { + /* Parameter 1 */ + if (fb->fb_bits & FB_P1_DEFAULT) { + fb->fb_bits &= ~FB_P1_DEFAULT; + fb->fb_p1 = 0; + } + fb->fb_p1 *= 10; + fb->fb_p1 += c - '0'; + } + } else { + /* Erase the cursor (if necessary) */ + if (fb->fb_bits & FB_CURSOR) + rcons_cursor(fb); + + /* Process the completed escape sequence */ + rcons_doesc(fb, c); + fb->fb_bits &= ~FB_INESC; + } +} + +/* Process a complete escape sequence */ +void +rcons_doesc(fb, c) + register struct fbdevice *fb; + register int c; +{ + +#ifdef notdef + /* XXX add escape sequence to enable visual (and audible) bell */ + fb->fb_bits = FB_VISBELL; +#endif + + switch (c) { + + case '@': + /* Insert Character (ICH) */ + rcons_insertchar(fb, fb->fb_p0); + break; + + case 'A': + /* Cursor Up (CUU) */ + *fb->fb_row -= fb->fb_p0; + if (*fb->fb_row < 0) + *fb->fb_row = 0; + break; + + case 'B': + /* Cursor Down (CUD) */ + *fb->fb_row += fb->fb_p0; + if (*fb->fb_row >= fb->fb_maxrow) + *fb->fb_row = fb->fb_maxrow - 1; + break; + + case 'C': + /* Cursor Forward (CUF) */ + *fb->fb_col += fb->fb_p0; + if (*fb->fb_col >= fb->fb_maxcol) + *fb->fb_col = fb->fb_maxcol - 1; + break; + + case 'D': + /* Cursor Backward (CUB) */ + *fb->fb_col -= fb->fb_p0; + if (*fb->fb_col < 0) + *fb->fb_col = 0; + break; + + case 'E': + /* Cursor Next Line (CNL) */ + *fb->fb_col = 0; + *fb->fb_row += fb->fb_p0; + if (*fb->fb_row >= fb->fb_maxrow) + *fb->fb_row = fb->fb_maxrow - 1; + break; + + case 'f': + /* Horizontal And Vertical Position (HVP) */ + case 'H': + /* Cursor Position (CUP) */ + *fb->fb_col = fb->fb_p1 - 1; + if (*fb->fb_col < 0) + *fb->fb_col = 0; + else if (*fb->fb_col >= fb->fb_maxcol) + *fb->fb_col = fb->fb_maxcol - 1; + + *fb->fb_row = fb->fb_p0 - 1; + if (*fb->fb_row < 0) + *fb->fb_row = 0; + else if (*fb->fb_row >= fb->fb_maxrow) + *fb->fb_row = fb->fb_maxrow - 1; + break; + + case 'J': + /* Erase in Display (ED) */ + rcons_clear2eop(fb); + break; + + case 'K': + /* Erase in Line (EL) */ + rcons_clear2eol(fb); + break; + + case 'L': + /* Insert Line (IL) */ + rcons_insertline(fb, fb->fb_p0); + break; + + case 'M': + /* Delete Line (DL) */ + rcons_delline(fb, fb->fb_p0); + break; + + case 'P': + /* Delete Character (DCH) */ + rcons_delchar(fb, fb->fb_p0); + break; + + case 'm': + /* Select Graphic Rendition (SGR); */ + /* (defaults to zero) */ + if (fb->fb_bits & FB_P0_DEFAULT) + fb->fb_p0 = 0; + if (fb->fb_p0) + fb->fb_bits |= FB_STANDOUT; + else + fb->fb_bits &= ~FB_STANDOUT; + break; + + case 'p': + /* Black On White (SUNBOW) */ + rcons_invert(fb, 0); + break; + + case 'q': + /* White On Black (SUNWOB) */ + rcons_invert(fb, 1); + break; + + case 'r': + /* Set scrolling (SUNSCRL) */ + /* (defaults to zero) */ + if (fb->fb_bits & FB_P0_DEFAULT) + fb->fb_p0 = 0; + /* XXX not implemented yet */ + fb->fb_scroll = fb->fb_p0; + break; + + case 's': + /* Reset terminal emulator (SUNRESET) */ + fb->fb_bits &= ~FB_STANDOUT; + fb->fb_scroll = 0; + if (fb->fb_bits & FB_INVERT) + rcons_invert(fb, 0); + break; + } +} + +/* Paint (or unpaint) the cursor */ +void +rcons_cursor(fb) + register struct fbdevice *fb; +{ + register int x, y; + + x = *fb->fb_col * fb->fb_font->width + fb->fb_xorigin; + y = *fb->fb_row * fb->fb_font->height + fb->fb_yorigin; + raster_op(fb->fb_sp, x, y, +#ifdef notdef + /* XXX This is the right way but too slow */ + fb->fb_font->chars[(int)' '].r->width, + fb->fb_font->chars[(int)' '].r->height, +#else + fb->fb_font->width, fb->fb_font->height, +#endif + RAS_INVERT, (struct raster *) 0, 0, 0); + fb->fb_bits ^= FB_CURSOR; +} + +/* Possibly change to SUNWOB or SUNBOW mode */ +void +rcons_invert(fb, wob) + struct fbdevice *fb; + int wob; +{ + if (((fb->fb_bits & FB_INVERT) != 0) ^ wob) { + /* Invert the display */ + raster_op(fb->fb_sp, 0, 0, fb->fb_sp->width, fb->fb_sp->height, + RAS_INVERT, (struct raster *) 0, 0, 0); + + /* Swap things around */ + fb->fb_ras_blank = RAS_NOT(fb->fb_ras_blank); + fb->fb_bits ^= FB_INVERT; + } +} + +/* Clear to the end of the page */ +void +rcons_clear2eop(fb) + register struct fbdevice *fb; +{ + register int y; + + if (*fb->fb_col == 0 && *fb->fb_row == 0) { + /* Clear the entire frame buffer */ + raster_op(fb->fb_sp, 0, 0, + fb->fb_sp->width, fb->fb_sp->height, + fb->fb_ras_blank, (struct raster *) 0, 0, 0); + } else { + /* Only clear what needs to be cleared */ + rcons_clear2eol(fb); + y = (*fb->fb_row + 1) * fb->fb_font->height; + + raster_op(fb->fb_sp, fb->fb_xorigin, fb->fb_yorigin + y, + fb->fb_emuwidth, fb->fb_emuheight - y, + fb->fb_ras_blank, (struct raster *) 0, 0, 0); + } +} + +/* Clear to the end of the line */ +void +rcons_clear2eol(fb) + register struct fbdevice *fb; +{ + register int x; + + x = *fb->fb_col * fb->fb_font->width; + + raster_op(fb->fb_sp, + fb->fb_xorigin + x, + *fb->fb_row * fb->fb_font->height + fb->fb_yorigin, + fb->fb_emuwidth - x, fb->fb_font->height, + fb->fb_ras_blank, (struct raster *) 0, 0, 0); +} + +/* Scroll up one line */ +void +rcons_scroll(fb, n) + register struct fbdevice *fb; + register int n; +{ + register int ydiv; + + /* Can't scroll more than the whole screen */ + if (n > fb->fb_maxrow) + n = fb->fb_maxrow; + + /* Calculate new row */ + *fb->fb_row -= n; + if (*fb->fb_row < 0) + *fb->fb_row = 0; + + /* Calculate number of pixels to scroll */ + ydiv = fb->fb_font->height * n; + + raster_op(fb->fb_sp, fb->fb_xorigin, fb->fb_yorigin, + fb->fb_emuwidth, fb->fb_emuheight - ydiv, + RAS_SRC, fb->fb_sp, fb->fb_xorigin, ydiv + fb->fb_yorigin); + + raster_op(fb->fb_sp, + fb->fb_xorigin, fb->fb_yorigin + fb->fb_emuheight - ydiv, + fb->fb_emuwidth, ydiv, fb->fb_ras_blank, (struct raster *) 0, 0, 0); +} + +/* Delete characters */ +void +rcons_delchar(fb, n) + register struct fbdevice *fb; + register int n; +{ + register int tox, fromx, y, width; + + /* Can't delete more chars than there are */ + if (n > fb->fb_maxcol - *fb->fb_col) + n = fb->fb_maxcol - *fb->fb_col; + + fromx = (*fb->fb_col + n) * fb->fb_font->width; + tox = *fb->fb_col * fb->fb_font->width; + y = *fb->fb_row * fb->fb_font->height; + width = n * fb->fb_font->width; + + raster_op(fb->fb_sp, tox + fb->fb_xorigin, y + fb->fb_yorigin, + fb->fb_emuwidth - fromx, fb->fb_font->height, + RAS_SRC, fb->fb_sp, fromx + fb->fb_xorigin, y + fb->fb_yorigin); + + raster_op(fb->fb_sp, + fb->fb_emuwidth - width + fb->fb_xorigin, y + fb->fb_yorigin, + width, fb->fb_font->height, + fb->fb_ras_blank, (struct raster *) 0, 0, 0); +} + +/* Delete a number of lines */ +void +rcons_delline(fb, n) + register struct fbdevice *fb; + register int n; +{ + register int fromy, toy, height; + + /* Can't delete more lines than there are */ + if (n > fb->fb_maxrow - *fb->fb_row) + n = fb->fb_maxrow - *fb->fb_row; + + fromy = (*fb->fb_row + n) * fb->fb_font->height; + toy = *fb->fb_row * fb->fb_font->height; + height = fb->fb_font->height * n; + + raster_op(fb->fb_sp, fb->fb_xorigin, toy + fb->fb_yorigin, + fb->fb_emuwidth, fb->fb_emuheight - fromy, RAS_SRC, + fb->fb_sp, fb->fb_xorigin, fromy + fb->fb_yorigin); + + raster_op(fb->fb_sp, + fb->fb_xorigin, fb->fb_emuheight - height + fb->fb_yorigin, + fb->fb_emuwidth, height, + fb->fb_ras_blank, (struct raster *) 0, 0, 0); +} + +/* Insert some characters */ +void +rcons_insertchar(fb, n) + register struct fbdevice *fb; + register int n; +{ + register int tox, fromx, y; + + /* Can't insert more chars than can fit */ + if (n > fb->fb_maxcol - *fb->fb_col) + n = fb->fb_maxcol - *fb->fb_col; + + tox = (*fb->fb_col + n) * fb->fb_font->width; + fromx = *fb->fb_col * fb->fb_font->width; + y = *fb->fb_row * fb->fb_font->height; + + raster_op(fb->fb_sp, tox + fb->fb_xorigin, y + fb->fb_yorigin, + fb->fb_emuwidth - tox, fb->fb_font->height, + RAS_SRC, fb->fb_sp, fromx + fb->fb_xorigin, y + fb->fb_yorigin); + + raster_op(fb->fb_sp, fromx + fb->fb_xorigin, y + fb->fb_yorigin, + fb->fb_font->width * n, fb->fb_font->height, + fb->fb_ras_blank, (struct raster *) 0, 0, 0); +} + +/* Insert some lines */ +void +rcons_insertline(fb, n) + register struct fbdevice *fb; + register int n; +{ + register int fromy, toy; + + /* Can't insert more lines than can fit */ + if (n > fb->fb_maxrow - *fb->fb_row) + n = fb->fb_maxrow - *fb->fb_row; + + toy = (*fb->fb_row + n) * fb->fb_font->height; + fromy = *fb->fb_row * fb->fb_font->height; + + raster_op(fb->fb_sp, fb->fb_xorigin, toy + fb->fb_yorigin, + fb->fb_emuwidth, fb->fb_emuheight - toy, + RAS_SRC, fb->fb_sp, fb->fb_xorigin, fromy + fb->fb_yorigin); + + raster_op(fb->fb_sp, fb->fb_xorigin, fromy + fb->fb_yorigin, + fb->fb_emuwidth, fb->fb_font->height * n, + fb->fb_ras_blank, (struct raster *) 0, 0, 0); +} -- cgit v1.2.3