add RI_PREFER_ALPHA flag, for drivers that can draw such fonts by hardware

This commit is contained in:
macallan 2017-04-22 15:05:02 +00:00
parent 71dda27406
commit b810592ab9
2 changed files with 14 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops.c,v 1.74 2017/02/23 12:16:30 nonaka Exp $ */
/* $NetBSD: rasops.c,v 1.75 2017/04/22 15:05:02 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.74 2017/02/23 12:16:30 nonaka Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.75 2017/04/22 15:05:02 macallan Exp $");
#include "opt_rasops.h"
#include "rasops_glue.h"
@ -208,7 +208,8 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
flags = WSFONT_FIND_BESTWIDTH | WSFONT_FIND_BITMAP;
if ((ri->ri_flg & RI_ENABLE_ALPHA) != 0)
flags |= WSFONT_FIND_ALPHA;
if ((ri->ri_flg & RI_PREFER_ALPHA) != 0)
flags |= WSFONT_PREFER_ALPHA;
cookie = wsfont_find(NULL,
ri->ri_width / wantcols,
0,
@ -376,14 +377,14 @@ rasops_reconfig(struct rasops_info *ri, int wantrows, int wantcols)
if ((ri->ri_delta & 3) != 0)
panic("rasops_init: ri_delta not aligned on 32-bit boundary");
#endif
ri->ri_origbits = ri->ri_bits;
ri->ri_hworigbits = ri->ri_hwbits;
/* Clear the entire display */
if ((ri->ri_flg & RI_CLEAR) != 0)
memset(ri->ri_bits, 0, ri->ri_stride * ri->ri_height);
/* Now centre our window if needs be */
ri->ri_origbits = ri->ri_bits;
ri->ri_hworigbits = ri->ri_hwbits;
if ((ri->ri_flg & RI_CENTER) != 0) {
ri->ri_bits += (((ri->ri_width * bpp >> 3) -
ri->ri_emustride) >> 1) & ~3;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops.h,v 1.31 2012/04/19 06:57:39 macallan Exp $ */
/* $NetBSD: rasops.h,v 1.32 2017/04/22 15:05:02 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -63,6 +63,11 @@
#define RI_ENABLE_ALPHA 0x1000
/* set this in order to use r3g3b2 'true' colour in 8 bit */
#define RI_8BIT_IS_RGB 0x2000
/*
* drivers can set this to tell the font selection code that they'd rather
* use alpha fonts
*/
#define RI_PREFER_ALPHA 0x4000
struct rasops_info {
/* These must be filled in by the caller */