From 32c728c53cb2807c2356d7b54e76e6b39ca823e0 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 18 Jan 2023 11:08:49 +0000 Subject: [PATCH] Instead of mapping WSEMUL_UNDERLINE to a different bit in rasops, use the same bit and the define. rom Crystal Kolipe kolipe.c at exoticsilicon dot com. ok miod --- sys/dev/rasops/rasops.c | 15 +++++++-------- sys/dev/rasops/rasops1.c | 10 +++++----- sys/dev/rasops/rasops15.c | 10 +++++----- sys/dev/rasops/rasops24.c | 10 +++++----- sys/dev/rasops/rasops32.c | 4 ++-- sys/dev/rasops/rasops4.c | 12 ++++++------ sys/dev/rasops/rasops8.c | 10 +++++----- 7 files changed, 35 insertions(+), 36 deletions(-) diff --git a/sys/dev/rasops/rasops.c b/sys/dev/rasops/rasops.c index 996891daadb..483f4a02c77 100644 --- a/sys/dev/rasops/rasops.c +++ b/sys/dev/rasops/rasops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rasops.c,v 1.68 2023/01/12 12:28:08 nicm Exp $ */ +/* $OpenBSD: rasops.c,v 1.69 2023/01/18 11:08:49 nicm Exp $ */ /* $NetBSD: rasops.c,v 1.35 2001/02/02 06:01:01 marcus Exp $ */ /*- @@ -561,9 +561,7 @@ rasops_pack_cattr(void *cookie, int fg, int bg, int flg, uint32_t *attr) if ((flg & WSATTR_HILIT) != 0 && fg < 8) fg += 8; - flg = ((flg & WSATTR_UNDERLINE) ? 1 : 0); - - *attr = (bg << 16) | (fg << 24) | flg; + *attr = (bg << 16) | (fg << 24) | (flg & WSATTR_UNDERLINE); return (0); } @@ -587,7 +585,7 @@ rasops_pack_mattr(void *cookie, int fg, int bg, int flg, uint32_t *attr) bg = swap; } - *attr = (bg << 16) | (fg << 24) | ((flg & WSATTR_UNDERLINE) ? 7 : 6); + *attr = (bg << 16) | (fg << 24) | (flg & WSATTR_UNDERLINE); return (0); } @@ -881,7 +879,7 @@ rasops_unpack_attr(void *cookie, uint32_t attr, int *fg, int *bg, int *underline *fg = ((u_int)attr >> 24) & 0xf; *bg = ((u_int)attr >> 16) & 0xf; if (underline != NULL) - *underline = (u_int)attr & 1; + *underline = (u_int)attr & WSATTR_UNDERLINE; } /* @@ -1252,7 +1250,8 @@ rasops_putchar_rotated(void *cookie, int row, int col, u_int uc, uint32_t attr) col = ri->ri_cols - col - 1; /* Do rotated char sans (side)underline */ - rc = ri->ri_real_ops.putchar(cookie, col, row, uc, attr & ~1); + rc = ri->ri_real_ops.putchar(cookie, col, row, uc, + attr & ~WSATTR_UNDERLINE); if (rc != 0) return rc; @@ -1263,7 +1262,7 @@ rasops_putchar_rotated(void *cookie, int row, int col, u_int uc, uint32_t attr) height = ri->ri_font->fontheight; /* XXX this assumes 16-bit color depth */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { int16_t c = (int16_t)ri->ri_devcmap[((u_int)attr >> 24) & 0xf]; while (height--) { diff --git a/sys/dev/rasops/rasops1.c b/sys/dev/rasops/rasops1.c index ef3e767e859..a3cd22df149 100644 --- a/sys/dev/rasops/rasops1.c +++ b/sys/dev/rasops/rasops1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rasops1.c,v 1.12 2021/01/09 18:20:47 fcambus Exp $ */ +/* $OpenBSD: rasops1.c,v 1.13 2023/01/18 11:08:49 nicm Exp $ */ /* $NetBSD: rasops1.c,v 1.11 2000/04/12 14:22:29 pk Exp $ */ /*- @@ -160,7 +160,7 @@ rasops1_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { DELTA(rp, -(ri->ri_stride << 1), int32_t *); *rp = (*rp & lmask) | (fg & rmask); } @@ -213,7 +213,7 @@ rasops1_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { DELTA(rp, -(ri->ri_stride << 1), int32_t *); rp[0] = (rp[0] & lmask) | (fg & ~lmask); rp[1] = (rp[1] & rmask) | (fg & ~rmask); @@ -281,7 +281,7 @@ rasops1_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) + if ((attr & WSATTR_UNDERLINE) != 0) rp[-(ri->ri_stride << 1)] = fg; return 0; @@ -345,7 +345,7 @@ rasops1_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) + if ((attr & WSATTR_UNDERLINE) != 0) *(int16_t *)(rp - (ri->ri_stride << 1)) = fg; return 0; diff --git a/sys/dev/rasops/rasops15.c b/sys/dev/rasops/rasops15.c index 4a8449755cb..eaabd197bbc 100644 --- a/sys/dev/rasops/rasops15.c +++ b/sys/dev/rasops/rasops15.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rasops15.c,v 1.9 2020/05/25 09:55:49 jsg Exp $ */ +/* $OpenBSD: rasops15.c,v 1.10 2023/01/18 11:08:49 nicm Exp $ */ /* $NetBSD: rasops15.c,v 1.7 2000/04/12 14:22:29 pk Exp $ */ /*- @@ -159,7 +159,7 @@ rasops15_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { int16_t c = (int16_t)clr[1]; rp -= ri->ri_stride << 1; @@ -265,7 +265,7 @@ rasops15_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { int32_t c = STAMP_READ(28); DELTA(rp, -(ri->ri_stride << 1), int32_t *); @@ -345,7 +345,7 @@ rasops15_putchar12(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if (attr & 1) { + if (attr & WSATTR_UNDERLINE) { int32_t c = STAMP_READ(28); DELTA(rp, -(ri->ri_stride << 1), int32_t *); @@ -430,7 +430,7 @@ rasops15_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if (attr & 1) { + if (attr & WSATTR_UNDERLINE) { int32_t c = STAMP_READ(28); DELTA(rp, -(ri->ri_stride << 1), int32_t *); diff --git a/sys/dev/rasops/rasops24.c b/sys/dev/rasops/rasops24.c index abbc692ae43..de60323d966 100644 --- a/sys/dev/rasops/rasops24.c +++ b/sys/dev/rasops/rasops24.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rasops24.c,v 1.12 2020/05/25 09:55:49 jsg Exp $ */ +/* $OpenBSD: rasops24.c,v 1.13 2023/01/18 11:08:49 nicm Exp $ */ /* $NetBSD: rasops24.c,v 1.12 2000/04/12 14:22:29 pk Exp $ */ /*- @@ -167,7 +167,7 @@ rasops24_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { rp -= ri->ri_stride << 1; while (width--) { @@ -288,7 +288,7 @@ rasops24_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { int32_t c = STAMP_READ(52); DELTA(rp, -(ri->ri_stride << 1), int32_t *); @@ -372,7 +372,7 @@ rasops24_putchar12(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { int32_t c = STAMP_READ(52); DELTA(rp, -(ri->ri_stride << 1), int32_t *); @@ -463,7 +463,7 @@ rasops24_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { int32_t c = STAMP_READ(52); DELTA(rp, -(ri->ri_stride << 1), int32_t *); diff --git a/sys/dev/rasops/rasops32.c b/sys/dev/rasops/rasops32.c index f3d204b7106..6040a4a23c9 100644 --- a/sys/dev/rasops/rasops32.c +++ b/sys/dev/rasops/rasops32.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rasops32.c,v 1.12 2020/07/20 12:40:45 fcambus Exp $ */ +/* $OpenBSD: rasops32.c,v 1.13 2023/01/18 11:08:49 nicm Exp $ */ /* $NetBSD: rasops32.c,v 1.7 2000/04/12 14:22:29 pk Exp $ */ /*- @@ -203,7 +203,7 @@ rasops32_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline a pixel at a time */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { rp -= step; for (cnt = 0; cnt < width; cnt++) ((int *)rp)[cnt] = f; diff --git a/sys/dev/rasops/rasops4.c b/sys/dev/rasops/rasops4.c index 6e93956b7a8..df8e150317b 100644 --- a/sys/dev/rasops/rasops4.c +++ b/sys/dev/rasops/rasops4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rasops4.c,v 1.12 2020/05/25 09:55:49 jsg Exp $ */ +/* $OpenBSD: rasops4.c,v 1.13 2023/01/18 11:08:49 nicm Exp $ */ /* $NetBSD: rasops4.c,v 1.4 2001/11/15 09:48:15 lukem Exp $ */ /*- @@ -157,7 +157,7 @@ rasops4_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if (attr & 1) { + if (attr & WSATTR_UNDERLINE) { DELTA(rp, -(ri->ri_stride << 1), int32_t *); *rp = (*rp & lmask) | (fg & rmask); } @@ -194,7 +194,7 @@ rasops4_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if (attr & 1) { + if (attr & WSATTR_UNDERLINE) { DELTA(rp, -(ri->ri_stride << 1), int32_t *); rp[0] = (rp[0] & lmask) | (fg & ~lmask); rp[1] = (rp[1] & rmask) | (fg & ~rmask); @@ -305,7 +305,7 @@ rasops4_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { rp -= (rs << 1); rp[0] = stamp[15]; rp[1] = stamp[15]; @@ -379,7 +379,7 @@ rasops4_putchar12(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { rp -= (rs << 1); rp[0] = stamp[15]; rp[1] = stamp[15]; @@ -456,7 +456,7 @@ rasops4_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { rp -= (rs << 1); rp[0] = stamp[15]; rp[1] = stamp[15]; diff --git a/sys/dev/rasops/rasops8.c b/sys/dev/rasops/rasops8.c index 0ec439928c6..04b9cc6785b 100644 --- a/sys/dev/rasops/rasops8.c +++ b/sys/dev/rasops/rasops8.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rasops8.c,v 1.11 2020/05/25 09:55:49 jsg Exp $ */ +/* $OpenBSD: rasops8.c,v 1.12 2023/01/18 11:08:49 nicm Exp $ */ /* $NetBSD: rasops8.c,v 1.8 2000/04/12 14:22:29 pk Exp $ */ /*- @@ -145,7 +145,7 @@ rasops8_putchar(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { u_char c = clr[1]; rp -= (ri->ri_stride << 1); @@ -248,7 +248,7 @@ rasops8_putchar8(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { DELTA(rp, -(ri->ri_stride << 1), int32_t *); rp[0] = rp[1] = stamp[15]; } @@ -319,7 +319,7 @@ rasops8_putchar12(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { DELTA(rp, -(ri->ri_stride << 1), int32_t *); rp[0] = rp[1] = rp[2] = stamp[15]; } @@ -387,7 +387,7 @@ rasops8_putchar16(void *cookie, int row, int col, u_int uc, uint32_t attr) } /* Do underline */ - if ((attr & 1) != 0) { + if ((attr & WSATTR_UNDERLINE) != 0) { DELTA(rp, -(ri->ri_stride << 1), int32_t *); rp[0] = rp[1] = rp[2] = rp[3] = stamp[15]; } -- 2.20.1