summaryrefslogtreecommitdiff
path: root/sys/dev/rasops
diff options
context:
space:
mode:
authorrin <rin@NetBSD.org>2019-07-25 02:26:32 +0000
committerrin <rin@NetBSD.org>2019-07-25 02:26:32 +0000
commit4274cea59ee06df299366be565d53489f281b017 (patch)
tree69be383895a1c1cf70dca67a3cf7e5e74004a0f5 /sys/dev/rasops
parent47e21d79d7368af07e73a6587fbd85da111aeff5 (diff)
Misc cleen up:
- Make 32bit mask unsigned - DPRINTF --> __nothing ifndef DEBUG_RASOPS - "#ifdef DIAGNOSTIC if (x) panic(); #endif" --> KASSERT(!x); - KNF No functional changes intended.
Diffstat (limited to 'sys/dev/rasops')
-rw-r--r--sys/dev/rasops/rasops.c83
-rw-r--r--sys/dev/rasops/rasops1.c20
-rw-r--r--sys/dev/rasops/rasops15.c23
-rw-r--r--sys/dev/rasops/rasops2.c13
-rw-r--r--sys/dev/rasops/rasops24.c26
-rw-r--r--sys/dev/rasops/rasops4.c40
-rw-r--r--sys/dev/rasops/rasops8.c25
-rw-r--r--sys/dev/rasops/rasops_bitops.h5
8 files changed, 111 insertions, 124 deletions
diff --git a/sys/dev/rasops/rasops.c b/sys/dev/rasops/rasops.c
index 24cc18f5873..844fa479c60 100644
--- a/sys/dev/rasops/rasops.c
+++ b/sys/dev/rasops/rasops.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.c,v 1.87 2019/07/25 00:55:13 rin Exp $ */
+/* $NetBSD: rasops.c,v 1.88 2019/07/25 02:26:32 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.87 2019/07/25 00:55:13 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.88 2019/07/25 02:26:32 rin Exp $");
#include "opt_rasops.h"
#include "rasops_glue.h"
@@ -54,9 +54,9 @@ __KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.87 2019/07/25 00:55:13 rin Exp $");
#endif
#ifdef RASOPS_DEBUG
-#define DPRINTF aprint_error
+#define DPRINTF(...) aprint_error(...)
#else
-#define DPRINTF while (0) printf
+#define DPRINTF(...) __nothing
#endif
struct rasops_matchdata {
@@ -223,7 +223,7 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
*/
if (cookie <= 0) {
aprint_error("rasops_init: font table is empty\n");
- return (-1);
+ return -1;
}
#if NRASOPS_ROTATION > 0
@@ -241,7 +241,7 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
if (wsfont_lock(cookie, &ri->ri_font)) {
aprint_error("rasops_init: couldn't lock font\n");
- return (-1);
+ return -1;
}
ri->ri_wsfcookie = cookie;
@@ -251,21 +251,23 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
/* This should never happen in reality... */
#ifdef DEBUG
if ((long)ri->ri_bits & 3) {
- aprint_error("rasops_init: bits not aligned on 32-bit boundary\n");
- return (-1);
+ aprint_error(
+ "rasops_init: bits not aligned on 32-bit boundary\n");
+ return -1;
}
if ((int)ri->ri_stride & 3) {
- aprint_error("rasops_init: stride not aligned on 32-bit boundary\n");
- return (-1);
+ aprint_error(
+ "rasops_init: stride not aligned on 32-bit boundary\n");
+ return -1;
}
#endif
if (rasops_reconfig(ri, wantrows, wantcols))
- return (-1);
+ return -1;
rasops_init_devcmap(ri);
- return (0);
+ return 0;
}
/*
@@ -392,7 +394,8 @@ rasops_reconfig(struct rasops_info *ri, int wantrows, int wantcols)
if (ri->ri_hwbits != NULL) {
ri->ri_hwbits += (((ri->ri_width * bpp >> 3) -
ri->ri_emustride) >> 1) & ~3;
- ri->ri_hwbits += ((ri->ri_height - ri->ri_emuheight) >> 1) *
+ ri->ri_hwbits +=
+ ((ri->ri_height - ri->ri_emuheight) >> 1) *
ri->ri_stride;
}
ri->ri_yorigin = (int)(ri->ri_bits - ri->ri_origbits)
@@ -465,7 +468,7 @@ rasops_reconfig(struct rasops_info *ri, int wantrows, int wantcols)
default:
ri->ri_flg &= ~RI_CFGDONE;
splx(s);
- return (-1);
+ return -1;
}
#if NRASOPS_ROTATION > 0
@@ -490,7 +493,7 @@ rasops_reconfig(struct rasops_info *ri, int wantrows, int wantcols)
ri->ri_flg |= RI_CFGDONE;
splx(s);
- return (0);
+ return 0;
}
/*
@@ -503,29 +506,26 @@ rasops_mapchar(void *cookie, int c, u_int *cp)
ri = (struct rasops_info *)cookie;
-#ifdef DIAGNOSTIC
- if (ri->ri_font == NULL)
- panic("rasops_mapchar: no font selected");
-#endif
+ KASSERT(ri->ri_font != NULL);
if ( (c = wsfont_map_unichar(ri->ri_font, c)) < 0) {
*cp = ' ';
- return (0);
+ return 0;
}
if (c < ri->ri_font->firstchar) {
*cp = ' ';
- return (0);
+ return 0;
}
#if 0
if (c - ri->ri_font->firstchar >= ri->ri_font->numchars) {
*cp = ' ';
- return (0);
+ return 0;
}
#endif
*cp = c;
- return (5);
+ return 5;
}
/*
@@ -539,14 +539,14 @@ rasops_allocattr_color(void *cookie, int fg, int bg, int flg,
if (__predict_false((unsigned int)fg >= sizeof(rasops_isgray) ||
(unsigned int)bg >= sizeof(rasops_isgray)))
- return (EINVAL);
+ return EINVAL;
#ifdef RASOPS_CLIPPING
fg &= 7;
bg &= 7;
#endif
if ((flg & WSATTR_BLINK) != 0)
- return (EINVAL);
+ return EINVAL;
if ((flg & WSATTR_WSCOLORS) == 0) {
#ifdef WS_DEFAULT_FG
@@ -579,7 +579,7 @@ rasops_allocattr_color(void *cookie, int fg, int bg, int flg,
flg |= WSATTR_PRIVATE2;
*attr = (bg << 16) | (fg << 24) | flg;
- return (0);
+ return 0;
}
/*
@@ -592,7 +592,7 @@ rasops_allocattr_mono(void *cookie, int fg, int bg, int flg,
int swap;
if ((flg & (WSATTR_BLINK | WSATTR_HILIT | WSATTR_WSCOLORS)) != 0)
- return (EINVAL);
+ return EINVAL;
fg = 1;
bg = 0;
@@ -604,7 +604,7 @@ rasops_allocattr_mono(void *cookie, int fg, int bg, int flg,
}
*attr = (bg << 16) | (fg << 24) | ((flg & WSATTR_UNDERLINE) ? 7 : 6);
- return (0);
+ return 0;
}
/*
@@ -835,10 +835,10 @@ rasops_init_devcmap(struct rasops_info *ri)
case 2:
for (i = 1; i < 15; i++)
- ri->ri_devcmap[i] = 0xaaaaaaaa;
+ ri->ri_devcmap[i] = 0xaaaaaaaaU;
ri->ri_devcmap[0] = 0;
- ri->ri_devcmap[8] = 0x55555555;
+ ri->ri_devcmap[8] = 0x55555555U;
ri->ri_devcmap[15] = -1;
return;
@@ -1427,10 +1427,12 @@ rasops_copycols_rotated_cw(void *cookie, int row, int src, int dst, int num)
if (src > dst)
for (coff = 0; coff < num; coff++)
- rasops_copychar(cookie, row, row, src + coff, dst + coff);
+ rasops_copychar(cookie, row, row, src + coff,
+ dst + coff);
else
for (coff = num - 1; coff >= 0; coff--)
- rasops_copychar(cookie, row, row, src + coff, dst + coff);
+ rasops_copychar(cookie, row, row, src + coff,
+ dst + coff);
}
static void
@@ -1451,7 +1453,8 @@ rasops_eraserows_rotated_cw(void *cookie, int row, int num, long attr)
* built-in Sharp W-ZERO3 display in 16bpp).
*/
static void
-rasops_copychar_ccw(void *cookie, int srcrow, int dstrow, int srccol, int dstcol)
+rasops_copychar_ccw(void *cookie, int srcrow, int dstrow, int srccol,
+ int dstcol)
{
struct rasops_info *ri;
uint8_t *sp, *dp;
@@ -1562,7 +1565,7 @@ rasops_make_box_chars_16(struct rasops_info *ri)
vert_mask = 0xc000 >> ((ri->ri_font->fontwidth >> 1) - 1);
hmask_left = 0xff00 << (8 - (ri->ri_font->fontwidth >> 1));
- hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1)>> 1);
+ hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1) >> 1);
mid = (ri->ri_font->fontheight + 1) >> 1;
/* 0x00 would be empty anyway so don't bother */
@@ -1601,7 +1604,7 @@ rasops_make_box_chars_8(struct rasops_info *ri)
vert_mask = 0xc0 >> ((ri->ri_font->fontwidth >> 1) - 1);
hmask_left = 0xf0 << (4 - (ri->ri_font->fontwidth >> 1));
- hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1)>> 1);
+ hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1) >> 1);
mid = (ri->ri_font->fontheight + 1) >> 1;
/* 0x00 would be empty anyway so don't bother */
@@ -1638,9 +1641,9 @@ rasops_make_box_chars_32(struct rasops_info *ri)
uint32_t *data = (uint32_t *)ri->ri_optfont.data;
int c, i, mid;
- vert_mask = 0xc0000000 >> ((ri->ri_font->fontwidth >> 1) - 1);
- hmask_left = 0xffff0000 << (16 - (ri->ri_font->fontwidth >> 1));
- hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1)>> 1);
+ vert_mask = 0xc0000000U >> ((ri->ri_font->fontwidth >> 1) - 1);
+ hmask_left = 0xffff0000U << (16 - (ri->ri_font->fontwidth >> 1));
+ hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1) >> 1);
mid = (ri->ri_font->fontheight + 1) >> 1;
/* 0x00 would be empty anyway so don't bother */
@@ -1731,6 +1734,7 @@ rasops_make_box_chars_alpha(struct rasops_info *ri)
int
rasops_get_cmap(struct rasops_info *ri, uint8_t *palette, size_t bytes)
{
+
if ((ri->ri_depth == 8 ) && ((ri->ri_flg & RI_8BIT_IS_RGB) > 0)) {
/* generate an R3G3B2 palette */
int i, idx = 0;
@@ -1759,8 +1763,7 @@ rasops_get_cmap(struct rasops_info *ri, uint8_t *palette, size_t bytes)
palette[idx] = tmp;
idx++;
}
- } else {
+ } else
memcpy(palette, rasops_cmap, MIN(bytes, sizeof(rasops_cmap)));
- }
return 0;
}
diff --git a/sys/dev/rasops/rasops1.c b/sys/dev/rasops/rasops1.c
index f63460ebb77..55d38c2c04d 100644
--- a/sys/dev/rasops/rasops1.c
+++ b/sys/dev/rasops/rasops1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1.c,v 1.26 2019/07/24 18:33:49 rin Exp $ */
+/* $NetBSD: rasops1.c,v 1.27 2019/07/25 02:26:32 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.26 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.27 2019/07/25 02:26:32 rin Exp $");
#include "opt_rasops.h"
@@ -219,11 +219,11 @@ rasops1_putchar(void *cookie, int row, int col, u_int uc, long attr)
fb = ~(fr[3] | (fr[2] << 8) |
(fr[1] << 16) | (fr[0] << 24));
- tmp = (rp[0] & lmask)
- | MBE((u_int)fb >> col);
+ tmp = (rp[0] & lmask) |
+ MBE((u_int)fb >> col);
- tmp2 = (rp[1] & rmask)
- | (MBE((u_int)fb << width) & ~rmask);
+ tmp2 = (rp[1] & rmask) |
+ (MBE((u_int)fb << width) & ~rmask);
rp[0] = tmp;
rp[1] = tmp2;
fr += fs;
@@ -239,11 +239,11 @@ rasops1_putchar(void *cookie, int row, int col, u_int uc, long attr)
fb = (fr[3] | (fr[2] << 8) |
(fr[1] << 16) | (fr[0] << 24));
- tmp = (rp[0] & lmask)
- | MBE(fb >> col);
+ tmp = (rp[0] & lmask) |
+ MBE(fb >> col);
- tmp2 = (rp[1] & rmask)
- | (MBE(fb << width) & ~rmask);
+ tmp2 = (rp[1] & rmask) |
+ (MBE(fb << width) & ~rmask);
rp[0] = tmp;
rp[1] = tmp2;
fr += fs;
diff --git a/sys/dev/rasops/rasops15.c b/sys/dev/rasops/rasops15.c
index 6ffeb20cba2..98f431dbd32 100644
--- a/sys/dev/rasops/rasops15.c
+++ b/sys/dev/rasops/rasops15.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops15.c,v 1.25 2019/07/24 18:33:49 rin Exp $ */
+/* $NetBSD: rasops15.c,v 1.26 2019/07/25 02:26:32 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.25 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.26 2019/07/25 02:26:32 rin Exp $");
#include "opt_rasops.h"
@@ -169,7 +169,8 @@ rasops15_putchar(void *cookie, int row, int col, u_int uc, long attr)
while (height--) {
dp = rp;
- fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) | (fr[0] << 24);
+ fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) |
+ (fr[0] << 24);
fr += font->stride;
rp += ri->ri_stride;
if (ri->ri_hwbits) {
@@ -373,12 +374,11 @@ rasops15_putchar8(void *cookie, int row, int col, u_int uc, long attr)
height = font->fontheight;
if (uc == (u_int)-1) {
- uint32_t c = stamp[0];
while (height--) {
- rp[0] = rp[1] = rp[2] = rp[3] = c;
+ rp[0] = rp[1] = rp[2] = rp[3] = stamp[0];
DELTA(rp, ri->ri_stride, uint32_t *);
if (ri->ri_hwbits) {
- hrp[0] = hrp[1] = hrp[2] = hrp[3] = c;
+ hrp[0] = hrp[1] = hrp[2] = hrp[3] = stamp[0];
DELTA(hrp, ri->ri_stride, uint32_t *);
}
}
@@ -470,13 +470,13 @@ rasops15_putchar12(void *cookie, int row, int col, u_int uc, long attr)
height = font->fontheight;
if (uc == (u_int)-1) {
- uint32_t c = stamp[0];
while (height--) {
- rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = c;
+ rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] =
+ stamp[0];
DELTA(rp, ri->ri_stride, uint32_t *);
if (ri->ri_hwbits) {
hrp[0] = hrp[1] = hrp[2] = hrp[3] = hrp[4] =
- hrp[5] = c;
+ hrp[5] = stamp[0];
DELTA(hrp, ri->ri_stride, uint32_t *);
}
}
@@ -576,14 +576,13 @@ rasops15_putchar16(void *cookie, int row, int col, u_int uc, long attr)
height = font->fontheight;
if (uc == (u_int)-1) {
- uint32_t c = stamp[0];
while (height--) {
rp[0] = rp[1] = rp[2] = rp[3] =
- rp[4] = rp[5] = rp[6] = rp[7] = c;
+ rp[4] = rp[5] = rp[6] = rp[7] = stamp[0];
DELTA(rp, ri->ri_stride, uint32_t *);
if (ri->ri_hwbits) {
hrp[0] = hrp[1] = hrp[2] = hrp[3] =
- hrp[4] = hrp[5] = hrp[6] = hrp[7] = c;
+ hrp[4] = hrp[5] = hrp[6] = hrp[7] = stamp[0];
DELTA(hrp, ri->ri_stride, uint32_t *);
}
}
diff --git a/sys/dev/rasops/rasops2.c b/sys/dev/rasops/rasops2.c
index a601d849819..aeba82d6cd1 100644
--- a/sys/dev/rasops/rasops2.c
+++ b/sys/dev/rasops/rasops2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops2.c,v 1.21 2019/07/24 18:33:49 rin Exp $ */
+/* $NetBSD: rasops2.c,v 1.22 2019/07/25 02:26:32 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.21 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.22 2019/07/25 02:26:32 rin Exp $");
#include "opt_rasops.h"
@@ -291,9 +291,8 @@ rasops2_putchar8(void *cookie, int row, int col, u_int uc, long attr)
rasops2_makestamp(ri, attr);
if (uc == ' ') {
- uint8_t c = stamp[0];
while (height--) {
- *(uint16_t *)rp = c;
+ *(uint16_t *)rp = stamp[0];
rp += rs;
}
} else {
@@ -356,9 +355,8 @@ rasops2_putchar12(void *cookie, int row, int col, u_int uc, long attr)
rasops2_makestamp(ri, attr);
if (uc == ' ') {
- uint8_t c = stamp[0];
while (height--) {
- rp[0] = rp[1] = rp[2] = c;
+ rp[0] = rp[1] = rp[2] = stamp[0];
rp += rs;
}
} else {
@@ -424,9 +422,8 @@ rasops2_putchar16(void *cookie, int row, int col, u_int uc, long attr)
rasops2_makestamp(ri, attr);
if (uc == ' ') {
- uint8_t c = stamp[0];
while (height--) {
- *(uint32_t *)rp = c;
+ *(uint32_t *)rp = stamp[0];
rp += rs;
}
} else {
diff --git a/sys/dev/rasops/rasops24.c b/sys/dev/rasops/rasops24.c
index c1cf7e871c0..de0f6e57572 100644
--- a/sys/dev/rasops/rasops24.c
+++ b/sys/dev/rasops/rasops24.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops24.c,v 1.32 2019/07/24 18:33:49 rin Exp $ */
+/* $NetBSD: rasops24.c,v 1.33 2019/07/25 02:26:32 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.32 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.33 2019/07/25 02:26:32 rin Exp $");
#include "opt_rasops.h"
@@ -272,9 +272,9 @@ rasops24_putchar8(void *cookie, int row, int col, u_int uc, long attr)
height = font->fontheight;
if (uc == (u_int)-1) {
- uint32_t c = stamp[0];
while (height--) {
- rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = c;
+ rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] =
+ stamp[0];
DELTA(rp, ri->ri_stride, uint32_t *);
}
} else {
@@ -300,10 +300,8 @@ rasops24_putchar8(void *cookie, int row, int col, u_int uc, long attr)
/* Do underline */
if ((attr & WSATTR_UNDERLINE) != 0) {
- uint32_t c = STAMP_READ(52);
-
DELTA(rp, -(ri->ri_stride << 1), uint32_t *);
- rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = c;
+ rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = STAMP_READ(52);
}
stamp_mutex--;
@@ -348,10 +346,9 @@ rasops24_putchar12(void *cookie, int row, int col, u_int uc, long attr)
height = font->fontheight;
if (uc == (u_int)-1) {
- uint32_t c = stamp[0];
while (height--) {
rp[0] = rp[1] = rp[2] = rp[3] =
- rp[4] = rp[5] = rp[6] = rp[7] = rp[8] = c;
+ rp[4] = rp[5] = rp[6] = rp[7] = rp[8] = stamp[0];
DELTA(rp, ri->ri_stride, uint32_t *);
}
} else {
@@ -382,11 +379,9 @@ rasops24_putchar12(void *cookie, int row, int col, u_int uc, long attr)
/* Do underline */
if ((attr & WSATTR_UNDERLINE) != 0) {
- uint32_t c = STAMP_READ(52);
-
DELTA(rp, -(ri->ri_stride << 1), uint32_t *);
rp[0] = rp[1] = rp[2] = rp[3] =
- rp[4] = rp[5] = rp[6] = rp[7] = rp[8] = c;
+ rp[4] = rp[5] = rp[6] = rp[7] = rp[8] = STAMP_READ(52);
}
stamp_mutex--;
@@ -431,11 +426,10 @@ rasops24_putchar16(void *cookie, int row, int col, u_int uc, long attr)
height = font->fontheight;
if (uc == (u_int)-1) {
- uint32_t c = stamp[0];
while (height--) {
rp[0] = rp[1] = rp[2] = rp[3] =
rp[4] = rp[5] = rp[6] = rp[7] =
- rp[8] = rp[9] = rp[10] = rp[11] = c;
+ rp[8] = rp[9] = rp[10] = rp[11] = stamp[0];
DELTA(rp, ri->ri_stride, uint32_t *);
}
} else {
@@ -471,12 +465,10 @@ rasops24_putchar16(void *cookie, int row, int col, u_int uc, long attr)
/* Do underline */
if ((attr & WSATTR_UNDERLINE) != 0) {
- uint32_t c = STAMP_READ(52);
-
DELTA(rp, -(ri->ri_stride << 1), uint32_t *);
rp[0] = rp[1] = rp[2] = rp[3] =
rp[4] = rp[5] = rp[6] = rp[7] =
- rp[8] = rp[9] = rp[10] = rp[11] = c;
+ rp[8] = rp[9] = rp[10] = rp[11] = STAMP_READ(52);
}
stamp_mutex--;
diff --git a/sys/dev/rasops/rasops4.c b/sys/dev/rasops/rasops4.c
index 67023706218..3937ff5abb0 100644
--- a/sys/dev/rasops/rasops4.c
+++ b/sys/dev/rasops/rasops4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops4.c,v 1.15 2019/07/24 18:33:49 rin Exp $ */
+/* $NetBSD: rasops4.c,v 1.16 2019/07/25 02:26:32 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.15 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.16 2019/07/25 02:26:32 rin Exp $");
#include "opt_rasops.h"
@@ -283,7 +283,8 @@ rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
}
#endif
- rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale);
+ rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale +
+ col * ri->ri_xscale);
height = font->fontheight;
rs = ri->ri_stride / sizeof(*rp);
@@ -292,10 +293,8 @@ rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
rasops4_makestamp(ri, attr);
if (uc == ' ') {
- uint16_t c = stamp[0];
while (height--) {
- rp[0] = c;
- rp[1] = c;
+ rp[0] = rp[1] = stamp[0];
rp += rs;
}
} else {
@@ -314,8 +313,7 @@ rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
/* Do underline */
if ((attr & WSATTR_UNDERLINE) != 0) {
rp -= (rs << 1);
- rp[0] = stamp[15];
- rp[1] = stamp[15];
+ rp[0] = rp[1] = stamp[15];
}
stamp_mutex--;
@@ -353,7 +351,8 @@ rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
}
#endif
- rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale);
+ rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale +
+ col * ri->ri_xscale);
height = font->fontheight;
rs = ri->ri_stride / sizeof(*rp);
@@ -362,11 +361,8 @@ rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
rasops4_makestamp(ri, attr);
if (uc == ' ') {
- uint16_t c = stamp[0];
while (height--) {
- rp[0] = c;
- rp[1] = c;
- rp[2] = c;
+ rp[0] = rp[1] = rp[2] = stamp[0];
rp += rs;
}
} else {
@@ -386,9 +382,7 @@ rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
/* Do underline */
if ((attr & WSATTR_UNDERLINE) != 0) {
rp -= (rs << 1);
- rp[0] = stamp[15];
- rp[1] = stamp[15];
- rp[2] = stamp[15];
+ rp[0] = rp[1] = rp[2] = stamp[15];
}
stamp_mutex--;
@@ -426,7 +420,8 @@ rasops4_putchar16(void *cookie, int row, int col, u_int uc, long attr)
}
#endif
- rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale);
+ rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale +
+ col * ri->ri_xscale);
height = font->fontheight;
rs = ri->ri_stride / sizeof(*rp);
@@ -435,12 +430,8 @@ rasops4_putchar16(void *cookie, int row, int col, u_int uc, long attr)
rasops4_makestamp(ri, attr);
if (uc == ' ') {
- uint16_t c = stamp[0];
while (height--) {
- rp[0] = c;
- rp[1] = c;
- rp[2] = c;
- rp[3] = c;
+ rp[0] = rp[1] = rp[2] = rp[3] = stamp[0];
rp += rs;
}
} else {
@@ -461,10 +452,7 @@ rasops4_putchar16(void *cookie, int row, int col, u_int uc, long attr)
/* Do underline */
if ((attr & WSATTR_UNDERLINE) != 0) {
rp -= (rs << 1);
- rp[0] = stamp[15];
- rp[1] = stamp[15];
- rp[2] = stamp[15];
- rp[3] = stamp[15];
+ rp[0] = rp[1] = rp[2] = rp[3] = stamp[15];
}
stamp_mutex--;
diff --git a/sys/dev/rasops/rasops8.c b/sys/dev/rasops/rasops8.c
index 41d6e5f5d09..00a7e7b6344 100644
--- a/sys/dev/rasops/rasops8.c
+++ b/sys/dev/rasops/rasops8.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops8.c,v 1.39 2019/07/25 01:07:32 rin Exp $ */
+/* $NetBSD: rasops8.c,v 1.40 2019/07/25 02:26:32 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.39 2019/07/25 01:07:32 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.40 2019/07/25 02:26:32 rin Exp $");
#include "opt_rasops.h"
@@ -482,9 +482,12 @@ rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
rp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
rp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
if (ri->ri_hwbits) {
- hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
- hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
- hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
+ hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) &
+ STAMP_MASK);
+ hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) &
+ STAMP_MASK);
+ hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) &
+ STAMP_MASK);
}
fr += fs;
@@ -572,10 +575,14 @@ rasops8_putchar16(void *cookie, int row, int col, u_int uc, long attr)
rp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
rp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) & STAMP_MASK);
if (ri->ri_hwbits) {
- hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
- hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
- hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
- hrp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) & STAMP_MASK);
+ hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) &
+ STAMP_MASK);
+ hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) &
+ STAMP_MASK);
+ hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) &
+ STAMP_MASK);
+ hrp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) &
+ STAMP_MASK);
}
fr += fs;
diff --git a/sys/dev/rasops/rasops_bitops.h b/sys/dev/rasops/rasops_bitops.h
index c8a6540dc2a..04d213f0ad5 100644
--- a/sys/dev/rasops/rasops_bitops.h
+++ b/sys/dev/rasops/rasops_bitops.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_bitops.h,v 1.15 2013/12/02 14:05:51 tsutsui Exp $ */
+/* $NetBSD: rasops_bitops.h,v 1.16 2019/07/25 02:26:32 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -143,7 +143,8 @@ NAME(do_cursor)(struct rasops_info *ri)
col = ri->ri_ccol * ri->ri_font->fontwidth << PIXEL_SHIFT;
height = ri->ri_font->fontheight;
num = ri->ri_font->fontwidth << PIXEL_SHIFT;
- rp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale + ((col >> 3) & ~3));
+ rp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale +
+ ((col >> 3) & ~3));
if (ri->ri_hwbits)
hrp = (uint32_t *)(ri->ri_hwbits + row * ri->ri_yscale +
((col >> 3) & ~3));