Check character if it in font limits before drawing it in rasops8_putchar

functions.
This commit is contained in:
petrov 2004-03-05 08:33:53 +00:00
parent f8e0478668
commit 2f82eaf699
2 changed files with 19 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops.h,v 1.15 2001/09/18 18:15:53 wiz Exp $ */
/* $NetBSD: rasops.h,v 1.16 2004/03/05 08:33:53 petrov Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -108,6 +108,10 @@ struct rasops_info {
#define DELTA(p, d, cast) ((p) = (cast)((caddr_t)(p) + (d)))
#define CHAR_IN_FONT(c,font) \
((c) >= (font)->firstchar && \
((c) - (font)->firstchar) < (font)->numchars)
/*
* rasops_init().
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops8.c,v 1.16 2002/02/11 20:50:58 uwe Exp $ */
/* $NetBSD: rasops8.c,v 1.17 2004/03/05 08:33:53 petrov Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.16 2002/02/11 20:50:58 uwe Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.17 2004/03/05 08:33:53 petrov Exp $");
#include "opt_rasops.h"
@ -118,6 +118,9 @@ rasops8_putchar(cookie, row, col, uc, attr)
ri = (struct rasops_info *)cookie;
if (!CHAR_IN_FONT(uc, ri->ri_font))
return;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
if ((unsigned)row >= (unsigned)ri->ri_rows)
@ -234,6 +237,9 @@ rasops8_putchar8(cookie, row, col, uc, attr)
ri = (struct rasops_info *)cookie;
if (!CHAR_IN_FONT(uc, ri->ri_font))
return;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows) {
stamp_mutex--;
@ -305,6 +311,9 @@ rasops8_putchar12(cookie, row, col, uc, attr)
ri = (struct rasops_info *)cookie;
if (!CHAR_IN_FONT(uc, ri->ri_font))
return;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows) {
stamp_mutex--;
@ -379,6 +388,9 @@ rasops8_putchar16(cookie, row, col, uc, attr)
ri = (struct rasops_info *)cookie;
if (!CHAR_IN_FONT(uc, ri->ri_font))
return;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows) {
stamp_mutex--;