When using stamp, drop attributions other than back and foreground

colors so that stamp is not updated unnecessarily.
This commit is contained in:
rin 2019-08-14 00:51:10 +00:00
parent 12b0ad45ff
commit f48f7ada9d
8 changed files with 32 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops.h,v 1.47 2019/08/10 01:24:17 rin Exp $ */
/* $NetBSD: rasops.h,v 1.48 2019/08/14 00:51:10 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -203,6 +203,9 @@ void rasops32_init(struct rasops_info *);
#define ATTR_BG(ri, attr) ((ri)->ri_devcmap[((uint32_t)(attr) >> 16) & 0xf])
#define ATTR_FG(ri, attr) ((ri)->ri_devcmap[((uint32_t)(attr) >> 24) & 0xf])
#define ATTR_MASK_BG __BITS(16, 19)
#define ATTR_MASK_FG __BITS(24, 27)
#define DELTA(p, d, cast) ((p) = (cast)((uint8_t *)(p) + (d)))
#define FBOFFSET(ri, row, col) \

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops15.c,v 1.38 2019/08/10 01:24:17 rin Exp $ */
/* $NetBSD: rasops15.c,v 1.39 2019/08/14 00:51:10 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.38 2019/08/10 01:24:17 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.39 2019/08/14 00:51:10 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_rasops.h"
@ -109,7 +109,7 @@ rasops15_init(struct rasops_info *ri)
}
#ifndef RASOPS_SMALL
stamp_attr = 0;
stamp_attr = -1;
stamp_ri = NULL;
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops2.c,v 1.32 2019/08/10 01:24:17 rin Exp $ */
/* $NetBSD: rasops2.c,v 1.33 2019/08/14 00:51:10 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.32 2019/08/10 01:24:17 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.33 2019/08/14 00:51:10 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_rasops.h"
@ -111,7 +111,7 @@ rasops2_init(struct rasops_info *ri)
}
#ifndef RASOPS_SMALL
stamp_attr = 0;
stamp_attr = -1;
stamp_ri = NULL;
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops24.c,v 1.49 2019/08/10 01:24:17 rin Exp $ */
/* $NetBSD: rasops24.c,v 1.50 2019/08/14 00:51:10 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.49 2019/08/10 01:24:17 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.50 2019/08/14 00:51:10 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_rasops.h"
@ -120,7 +120,7 @@ rasops24_init(struct rasops_info *ri)
}
#ifndef RASOPS_SMALL
stamp_attr = 0;
stamp_attr = -1;
stamp_ri = NULL;
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops32.c,v 1.45 2019/08/10 01:24:17 rin Exp $ */
/* $NetBSD: rasops32.c,v 1.46 2019/08/14 00:51:10 rin Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.45 2019/08/10 01:24:17 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.46 2019/08/14 00:51:10 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_rasops.h"
@ -110,7 +110,7 @@ rasops32_init(struct rasops_info *ri)
}
#ifndef RASOPS_SMALL
stamp_attr = 0;
stamp_attr = -1;
stamp_ri = NULL;
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops4.c,v 1.27 2019/08/10 01:24:17 rin Exp $ */
/* $NetBSD: rasops4.c,v 1.28 2019/08/14 00:51:10 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.27 2019/08/10 01:24:17 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.28 2019/08/14 00:51:10 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_rasops.h"
@ -105,7 +105,7 @@ rasops4_init(struct rasops_info *ri)
}
#ifndef RASOPS_SMALL
stamp_attr = 0;
stamp_attr = -1;
stamp_ri = NULL;
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops8.c,v 1.50 2019/08/10 01:24:17 rin Exp $ */
/* $NetBSD: rasops8.c,v 1.51 2019/08/14 00:51:10 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.50 2019/08/10 01:24:17 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.51 2019/08/14 00:51:10 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_rasops.h"
@ -108,7 +108,7 @@ rasops8_init(struct rasops_info *ri)
}
#ifndef RASOPS_SMALL
stamp_attr = 0;
stamp_attr = -1;
stamp_ri = NULL;
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops_putchar_width.h,v 1.14 2019/08/10 01:24:17 rin Exp $ */
/* $NetBSD: rasops_putchar_width.h,v 1.15 2019/08/14 00:51:10 rin Exp $ */
/* NetBSD: rasops8.c,v 1.41 2019/07/25 03:02:44 rin Exp */
/*-
@ -210,6 +210,7 @@ NAME(RASOPS_DEPTH, RASOPS_WIDTH)(void *cookie, int row, int col, u_int uc,
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height;
uint8_t *fr;
bool do_ul;
STAMP_TYPE *rp, *hp;
hp = NULL; /* XXX GCC */
@ -227,6 +228,13 @@ NAME(RASOPS_DEPTH, RASOPS_WIDTH)(void *cookie, int row, int col, u_int uc,
return;
#endif
/*
* We don't care attributions other than back/foreground
* colors when using stamp.
*/
do_ul = (attr & WSATTR_UNDERLINE) != 0;
attr &= (ATTR_MASK_BG | ATTR_MASK_FG);
/* Recompute stamp? */
if (attr != stamp_attr || __predict_false(ri != stamp_ri))
MAKESTAMP(RASOPS_DEPTH)(ri, attr);
@ -260,7 +268,7 @@ NAME(RASOPS_DEPTH, RASOPS_WIDTH)(void *cookie, int row, int col, u_int uc,
}
/* Do underline */
if ((attr & WSATTR_UNDERLINE) != 0) {
if (do_ul) {
DELTA(rp, - ri->ri_stride * ri->ri_ul.off, STAMP_TYPE *);
if (ri->ri_hwbits)
DELTA(hp, - ri->ri_stride * ri->ri_ul.off,