summaryrefslogtreecommitdiff
path: root/sys/dev/wscons/wscons_rops.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2000-05-16 23:49:13 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2000-05-16 23:49:13 +0000
commita0654a2deddb43b17d7b134a1ee1b01fb7510fb7 (patch)
tree5e5855c85cbcdef6a8f655e834f9d94f2f82998b /sys/dev/wscons/wscons_rops.c
parent4003f5f7165c81c13d6491fc69628ef45a48b5c2 (diff)
import newer wscons source from netbsd.
art@ said it will make his life easier in alpha rhands@ said it is not used in powerpc for now bjc@ said that it would make vax port easier mickey@ said other platforms can use it, and it's faster
Diffstat (limited to 'sys/dev/wscons/wscons_rops.c')
-rw-r--r--sys/dev/wscons/wscons_rops.c79
1 files changed, 56 insertions, 23 deletions
diff --git a/sys/dev/wscons/wscons_rops.c b/sys/dev/wscons/wscons_rops.c
index f9c7bbad0d1..487d0dcd43c 100644
--- a/sys/dev/wscons/wscons_rops.c
+++ b/sys/dev/wscons/wscons_rops.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: wscons_rops.c,v 1.5 1997/11/06 12:27:00 niklas Exp $ */
-/* $NetBSD: wscons_rops.c,v 1.1 1996/04/12 02:00:55 cgd Exp $ */
+/* $OpenBSD: wscons_rops.c,v 1.6 2000/05/16 23:49:11 mickey Exp $ */
+/* $NetBSD: wscons_rops.c,v 1.5 1999/02/12 11:25:23 drochner Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -50,6 +50,7 @@
#include <dev/rcons/raster.h>
#include <dev/wscons/wscons_raster.h>
+#include <dev/wscons/wsdisplayvar.h>
/*
* Paint (or unpaint) the cursor.
@@ -60,8 +61,8 @@ rcons_cursor(id, on, row, col)
void *id;
int on, row, col;
{
- register struct rcons *rc = id;
- register int x, y;
+ struct rcons *rc = id;
+ int x, y;
/* turn the cursor off */
if (!on) {
@@ -94,30 +95,47 @@ rcons_cursor(id, on, row, col)
rc->rc_bits ^= RC_CURSOR;
}
+int
+rcons_mapchar(id, uni, index)
+ void *id;
+ int uni;
+ unsigned int *index;
+{
+
+ if (uni < 128) {
+ *index = uni;
+ return (5);
+ }
+ *index = ' ';
+ return (0);
+}
+
/*
* Actually write a string to the frame buffer.
*/
void
-rcons_putstr(id, row, col, str, n)
+rcons_putchar(id, row, col, uc, attr)
void *id;
- int row, col, n;
- char *str;
+ int row, col;
+ u_int uc;
+ long attr;
{
struct rcons *rc = id;
- register int x, y, op;
+ int x, y, op;
+ u_char help;
x = col * rc->rc_font->width + rc->rc_xorigin;
y = row * rc->rc_font->height + rc->rc_font_ascent + rc->rc_yorigin;
op = RAS_SRC;
- if (((rc->rc_bits & RC_STANDOUT) != 0) ^
- ((rc->rc_bits & RC_INVERT) != 0))
+ if ((attr != 0) ^ ((rc->rc_bits & RC_INVERT) != 0))
op = RAS_NOT(op);
- raster_textn(rc->rc_sp, x, y, op, rc->rc_font, str, n);
+ help = uc & 0xff;
+ raster_textn(rc->rc_sp, x, y, op, rc->rc_font, &help, 1);
}
/*
- * Possibly change entire display to white-on-black or black-on-white modes.
+ * Possibly change to white-on-black or black-on-white modes.
*/
void
rcons_invert(id, inverted)
@@ -132,7 +150,6 @@ rcons_invert(id, inverted)
RAS_INVERT, (struct raster *) 0, 0, 0);
/* Swap things around */
- rc->rc_ras_blank = RAS_NOT(rc->rc_ras_blank);
rc->rc_bits ^= RC_INVERT;
}
}
@@ -162,19 +179,23 @@ rcons_copycols(id, row, srccol, dstcol, ncols)
* Clear columns (characters) in a row (line).
*/
void
-rcons_erasecols(id, row, startcol, ncols)
+rcons_erasecols(id, row, startcol, ncols, fillattr)
void *id;
int row, startcol, ncols;
+ long fillattr;
{
struct rcons *rc = id;
- int y, startx, nx;
+ int y, startx, nx, op;
y = rc->rc_yorigin + rc->rc_font->height * row;
startx = rc->rc_xorigin + rc->rc_font->width * startcol;
nx = rc->rc_font->width * ncols;
+ op = RAS_CLEAR;
+ if ((fillattr != 0) ^ ((rc->rc_bits & RC_INVERT) != 0))
+ op = RAS_NOT(op);
raster_op(rc->rc_sp, startx, y,
- nx, rc->rc_font->height, rc->rc_ras_blank,
+ nx, rc->rc_font->height, op,
(struct raster *) 0, 0, 0);
}
@@ -202,25 +223,37 @@ rcons_copyrows(id, srcrow, dstrow, nrows)
* Erase rows (lines).
*/
void
-rcons_eraserows(id, startrow, nrows)
+rcons_eraserows(id, startrow, nrows, fillattr)
void *id;
int startrow, nrows;
+ long fillattr;
{
struct rcons *rc = id;
- int starty, ny;
+ int starty, ny, op;
starty = rc->rc_yorigin + rc->rc_font->height * startrow;
ny = rc->rc_font->height * nrows;
+ op = RAS_CLEAR;
+ if ((fillattr != 0) ^ ((rc->rc_bits & RC_INVERT) != 0))
+ op = RAS_NOT(op);
raster_op(rc->rc_sp, rc->rc_xorigin, starty,
- rc->rc_raswidth, ny, rc->rc_ras_blank,
+ rc->rc_raswidth, ny, op,
(struct raster *) 0, 0, 0);
}
-void
-rcons_setattr(id, val)
+int
+rcons_alloc_attr(id, fg, bg, flags, attrp)
void *id;
- int val;
+ int fg, bg, flags;
+ long *attrp;
{
- /* XXX */
+ if (flags & (WSATTR_HILIT | WSATTR_BLINK |
+ WSATTR_UNDERLINE | WSATTR_WSCOLORS))
+ return (EINVAL);
+ if (flags & WSATTR_REVERSE)
+ *attrp = 1;
+ else
+ *attrp = 0;
+ return (0);
}