Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/voyager add fastpaths for alpha == 0 and alpha =...
details: https://anonhg.NetBSD.org/src/rev/b66e43551094
branches: trunk
changeset: 772269:b66e43551094
user: macallan <macallan%NetBSD.org@localhost>
date: Tue Dec 27 07:05:53 2011 +0000
description:
add fastpaths for alpha == 0 and alpha == 255 - no need to do the six
multiplications dance there, just use background or foreground colour
diffstat:
sys/dev/pci/voyager/voyagerfb.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diffs (43 lines):
diff -r 756026a1f583 -r b66e43551094 sys/dev/pci/voyager/voyagerfb.c
--- a/sys/dev/pci/voyager/voyagerfb.c Tue Dec 27 06:24:40 2011 +0000
+++ b/sys/dev/pci/voyager/voyagerfb.c Tue Dec 27 07:05:53 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: voyagerfb.c,v 1.13 2011/12/24 02:28:50 macallan Exp $ */
+/* $NetBSD: voyagerfb.c,v 1.14 2011/12/27 07:05:53 macallan Exp $ */
/*
* Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.13 2011/12/24 02:28:50 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.14 2011/12/27 07:05:53 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -923,12 +923,18 @@
for (i = 0; i < wi * he; i++) {
aval = *data;
data++;
- r = aval * rf + (255 - aval) * rb;
- g = aval * gf + (255 - aval) * gb;
- b = aval * bf + (255 - aval) * bb;
- pixel = (r & 0xff00) << 8 |
- (g & 0xff00) |
- (b & 0xff00) >> 8;
+ if (aval == 0) {
+ pixel = bg;
+ } else if (aval == 255) {
+ pixel = fg;
+ } else {
+ r = aval * rf + (255 - aval) * rb;
+ g = aval * gf + (255 - aval) * gb;
+ b = aval * bf + (255 - aval) * bb;
+ pixel = (r & 0xff00) << 8 |
+ (g & 0xff00) |
+ (b & 0xff00) >> 8;
+ }
bus_space_write_4(sc->sc_memt, sc->sc_regh,
SM502_DATAPORT, pixel);
}
Home |
Main Index |
Thread Index |
Old Index