Module Name: src
Committed By: rin
Date: Wed Aug 7 13:23:12 UTC 2019
Modified Files:
src/sys/dev/wsfb: genfb.c
Log Message:
We support anti-aliasing for depth 2.
Use switch appropriately.
To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/wsfb/genfb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.68 src/sys/dev/wsfb/genfb.c:1.69
--- src/sys/dev/wsfb/genfb.c:1.68 Fri Aug 2 10:34:39 2019
+++ src/sys/dev/wsfb/genfb.c Wed Aug 7 13:23:12 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb.c,v 1.68 2019/08/02 10:34:39 rin Exp $ */
+/* $NetBSD: genfb.c,v 1.69 2019/08/07 13:23:12 rin Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.68 2019/08/02 10:34:39 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.69 2019/08/07 13:23:12 rin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -541,6 +541,7 @@ genfb_init_screen(void *cookie, struct v
struct genfb_softc *sc = cookie;
struct rasops_info *ri = &scr->scr_ri;
int wantcols;
+ bool is_bgr;
ri->ri_depth = sc->sc_depth;
ri->ri_width = sc->sc_width;
@@ -563,10 +564,11 @@ genfb_init_screen(void *cookie, struct v
if (existing && sc->sc_want_clear)
ri->ri_flg |= RI_CLEAR;
- if (ri->ri_depth == 32 || ri->ri_depth == 24) {
+ switch (ri->ri_depth) {
+ case 32:
+ case 24:
ri->ri_flg |= RI_ENABLE_ALPHA;
- bool is_bgr = false;
prop_dictionary_get_bool(device_properties(sc->sc_dev),
"is_bgr", &is_bgr);
if (is_bgr) {
@@ -586,13 +588,25 @@ genfb_init_screen(void *cookie, struct v
ri->ri_gpos = 8;
ri->ri_bpos = 0;
}
- }
+ break;
- if (ri->ri_depth == 16 || ri->ri_depth == 15)
+ case 16:
+ case 15:
ri->ri_flg |= RI_ENABLE_ALPHA;
+ break;
+
+ case 8:
+ if (sc->sc_cmcb != NULL)
+ ri->ri_flg |= RI_ENABLE_ALPHA | RI_8BIT_IS_RGB;
+ break;
- if (ri->ri_depth == 8 && sc->sc_cmcb != NULL)
- ri->ri_flg |= RI_ENABLE_ALPHA | RI_8BIT_IS_RGB;
+ case 2:
+ ri->ri_flg |= RI_ENABLE_ALPHA;
+ break;
+
+ default:
+ break;
+ }
wantcols = genfb_calc_cols(sc);