Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/rasops - Style nits
details: https://anonhg.NetBSD.org/src/rev/b211806bb82d
branches: trunk
changeset: 474814:b211806bb82d
user: ad <ad%NetBSD.org@localhost>
date: Wed Jul 21 19:19:03 1999 +0000
description:
- Style nits
- Kill some of the dainbramage in variable-depth copycols()
diffstat:
sys/dev/rasops/rasops.c | 22 +++++++-------
sys/dev/rasops/rasops1.c | 6 ++--
sys/dev/rasops/rasops2.c | 6 ++--
sys/dev/rasops/rasops_bitops.h | 59 ++++++++++++++++++++---------------------
4 files changed, 46 insertions(+), 47 deletions(-)
diffs (256 lines):
diff -r c040ff59cc43 -r b211806bb82d sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c Wed Jul 21 17:56:34 1999 +0000
+++ b/sys/dev/rasops/rasops.c Wed Jul 21 19:19:03 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.c,v 1.11 1999/06/15 22:34:45 ad Exp $ */
+/* $NetBSD: rasops.c,v 1.12 1999/07/21 19:19:03 ad Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.11 1999/06/15 22:34:45 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.12 1999/07/21 19:19:03 ad Exp $");
#include "rasops_glue.h"
@@ -400,8 +400,8 @@
#ifdef RASOPS_CLIPPING
flg &= 255;
#endif
- fg = fg ? 1 : 0;
- bg = bg ? 1 : 0;
+ fg = (fg ? 1 : 0);
+ bg = (bg ? 1 : 0);
if (flg & WSATTR_BLINK)
return (EINVAL);
@@ -652,21 +652,21 @@
p = rasops_cmap;
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < 16; i++, p++) {
if (ri->ri_rnum <= 8)
- c = (*p++ >> (8 - ri->ri_rnum)) << ri->ri_rpos;
+ c = (*p >> (8 - ri->ri_rnum)) << ri->ri_rpos;
else
- c = (*p++ << (ri->ri_rnum - 8)) << ri->ri_rpos;
+ c = (*p << (ri->ri_rnum - 8)) << ri->ri_rpos;
if (ri->ri_gnum <= 8)
- c |= (*p++ >> (8 - ri->ri_gnum)) << ri->ri_gpos;
+ c |= (*p >> (8 - ri->ri_gnum)) << ri->ri_gpos;
else
- c |= (*p++ << (ri->ri_gnum - 8)) << ri->ri_gpos;
+ c |= (*p << (ri->ri_gnum - 8)) << ri->ri_gpos;
if (ri->ri_bnum <= 8)
- c |= (*p++ >> (8 - ri->ri_bnum)) << ri->ri_bpos;
+ c |= (*p >> (8 - ri->ri_bnum)) << ri->ri_bpos;
else
- c |= (*p++ << (ri->ri_bnum - 8)) << ri->ri_bpos;
+ c |= (*p << (ri->ri_bnum - 8)) << ri->ri_bpos;
/* Fill the word for generic routines, which want this */
if (ri->ri_depth == 24)
diff -r c040ff59cc43 -r b211806bb82d sys/dev/rasops/rasops1.c
--- a/sys/dev/rasops/rasops1.c Wed Jul 21 17:56:34 1999 +0000
+++ b/sys/dev/rasops/rasops1.c Wed Jul 21 19:19:03 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1.c,v 1.5 1999/05/18 21:51:59 ad Exp $ */
+/* $NetBSD: rasops1.c,v 1.6 1999/07/21 19:19:04 ad Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include "opt_rasops.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.5 1999/05/18 21:51:59 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.6 1999/07/21 19:19:04 ad Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -80,7 +80,7 @@
break;
}
- if (ri->ri_font->fontwidth & 7) {
+ if ((ri->ri_font->fontwidth & 7) != 0) {
ri->ri_ops.erasecols = rasops1_erasecols;
ri->ri_ops.copycols = rasops1_copycols;
ri->ri_do_cursor = rasops1_do_cursor;
diff -r c040ff59cc43 -r b211806bb82d sys/dev/rasops/rasops2.c
--- a/sys/dev/rasops/rasops2.c Wed Jul 21 17:56:34 1999 +0000
+++ b/sys/dev/rasops/rasops2.c Wed Jul 21 19:19:03 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops2.c,v 1.2 1999/05/18 21:51:59 ad Exp $ */
+/* $NetBSD: rasops2.c,v 1.3 1999/07/21 19:19:04 ad Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include "opt_rasops.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.2 1999/05/18 21:51:59 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.3 1999/07/21 19:19:04 ad Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -93,7 +93,7 @@
break;
}
- if (ri->ri_font->fontwidth & 3) {
+ if ((ri->ri_font->fontwidth & 3) != 0) {
ri->ri_ops.erasecols = rasops2_erasecols;
ri->ri_ops.copycols = rasops2_copycols;
ri->ri_do_cursor = rasops2_do_cursor;
diff -r c040ff59cc43 -r b211806bb82d sys/dev/rasops/rasops_bitops.h
--- a/sys/dev/rasops/rasops_bitops.h Wed Jul 21 17:56:34 1999 +0000
+++ b/sys/dev/rasops/rasops_bitops.h Wed Jul 21 19:19:03 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_bitops.h,v 1.3 1999/05/18 21:51:59 ad Exp $ */
+/* $NetBSD: rasops_bitops.h,v 1.4 1999/07/21 19:19:04 ad Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -157,7 +157,7 @@
/*
- * Copy columns. This is slow. Ick!
+ * Copy columns. Ick!
*/
static void
NAME(copycols)(cookie, row, src, dst, num)
@@ -198,21 +198,19 @@
return;
#endif
- /* XXX pacify gcc until this is fixed XXX */
- db = 0;
-
cnt = ri->ri_font->fontwidth << PIXEL_SHIFT;
src *= cnt;
dst *= cnt;
num *= cnt;
row *= ri->ri_yscale;
height = ri->ri_font->fontheight;
+ db = dst & 31;
if (db + num <= 32) {
+ /* Destination is contained within a single word */
srp = (int32_t *)(ri->ri_bits + row + ((src >> 3) & ~3));
drp = (int32_t *)(ri->ri_bits + row + ((dst >> 3) & ~3));
sb = src & 31;
- db = dst & 31;
while (height--) {
GETBITS(srp, sb, num, tmp);
@@ -224,58 +222,61 @@
return;
}
- lmask = rasops_rmask[dst & 31];
+ lmask = rasops_rmask[db];
rmask = rasops_lmask[(dst + num) & 31];
-
- lnum = (lmask ? 32 - db : 0);
- rnum = (rmask ? (dst + num) & 31 : 0);
- sb = src < dst && src + num > dst;
+ lnum = (32 - db) & 31;
+ rnum = (dst + num) & 31;
if (lmask)
full = (num - (32 - (dst & 31))) >> 5;
else
full = num >> 5;
- if (sb) {
- /* Go backwards */
- /* XXX this is broken! */
+ if (src < dst && src + num > dst) {
+ /* Copy right-to-left */
+ sb = src & 31;
src = src + num;
dst = dst + num;
srp = (int32_t *)(ri->ri_bits + row + ((src >> 3) & ~3));
drp = (int32_t *)(ri->ri_bits + row + ((dst >> 3) & ~3));
src = src & 31;
+ rnum = 32 - lnum;
db = dst & 31;
-
+
+ if ((src -= db) < 0) {
+ sp--;
+ src += 32;
+ }
+
while (height--) {
- sb = src;
sp = srp;
dp = drp;
DELTA(srp, ri->ri_stride, int32_t *);
DELTA(drp, ri->ri_stride, int32_t *);
if (db) {
- GETBITS(sp, sb, db, tmp);
- PUTBITS(tmp, db, db, dp);
+ GETBITS(sp, src, db, tmp);
+ PUTBITS(tmp, 0, db, dp);
dp--;
- if ((sb -= rnum) < 0) {
- sp--;
- sb += 32;
- }
+ sp--;
}
- /* Now we're aligned to 32-bits with dp :) */
+ /* Now aligned to 32-bits wrt dp */
for (cnt = full; cnt; cnt--, sp--) {
- GETBITS(sp, sb, 32, tmp);
+ GETBITS(sp, src, 32, tmp);
*dp-- = tmp;
}
if (lmask) {
- GETBITS(sp, sb, rnum, tmp);
- PUTBITS(tmp, 0, rnum, dp);
+// if (src > sb)
+// sp++;
+ GETBITS(sp, sb, lnum, tmp);
+ PUTBITS(tmp, rnum, lnum, dp);
}
}
} else {
+ /* Copy left-to-right */
srp = (int32_t *)(ri->ri_bits + row + ((src >> 3) & ~3));
drp = (int32_t *)(ri->ri_bits + row + ((dst >> 3) & ~3));
db = dst & 31;
@@ -298,11 +299,10 @@
}
}
- /* Now we're aligned to 32-bits with dp :) */
- for (cnt = full; cnt; cnt--) {
+ /* Now aligned to 32-bits wrt dp */
+ for (cnt = full; cnt; cnt--, sp++) {
GETBITS(sp, sb, 32, tmp);
*dp++ = tmp;
- sp++;
}
if (rmask) {
@@ -312,5 +312,4 @@
}
}
}
-
#endif /* _RASOPS_BITOPS_H_ */
Home |
Main Index |
Thread Index |
Old Index