Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/rasops skip the multiplications for alpha values of ...
details: https://anonhg.NetBSD.org/src/rev/756026a1f583
branches: trunk
changeset: 772268:756026a1f583
user: macallan <macallan%NetBSD.org@localhost>
date: Tue Dec 27 06:24:40 2011 +0000
description:
skip the multiplications for alpha values of 0 and 255, just use background
and foreground colours there
diffstat:
sys/dev/rasops/rasops32.c | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diffs (46 lines):
diff -r c0595c707eeb -r 756026a1f583 sys/dev/rasops/rasops32.c
--- a/sys/dev/rasops/rasops32.c Tue Dec 27 01:24:27 2011 +0000
+++ b/sys/dev/rasops/rasops32.c Tue Dec 27 06:24:40 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops32.c,v 1.21 2011/12/24 02:13:21 macallan Exp $ */
+/* $NetBSD: rasops32.c,v 1.22 2011/12/27 06:24:40 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.21 2011/12/24 02:13:21 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.22 2011/12/27 06:24:40 macallan Exp $");
#include "opt_rasops.h"
@@ -158,12 +158,21 @@
dp = rp + ri->ri_width * y;
for (x = 0; x < width; x++) {
aval = *fr;
- r = aval * r1 + (255 - aval) * r0;
- g = aval * g1 + (255 - aval) * g0;
- b = aval * b1 + (255 - aval) * b0;
- *dp = (r & 0xff00) << 8 |
- (g & 0xff00) |
- (b & 0xff00) >> 8;
+ if (aval == 0) {
+ *dp = clr[0];
+ } else if (aval == 255) {
+ *dp = clr[1];
+ } else {
+ r = aval * r1 +
+ (255 - aval) * r0;
+ g = aval * g1 +
+ (255 - aval) * g0;
+ b = aval * b1 +
+ (255 - aval) * b0;
+ *dp = (r & 0xff00) << 8 |
+ (g & 0xff00) |
+ (b & 0xff00) >> 8;
+ }
dp++;
fr++;
}
Home |
Main Index |
Thread Index |
Old Index