diff options
| author | nathanw <nathanw@NetBSD.org> | 2001-02-12 04:33:36 +0000 |
|---|---|---|
| committer | nathanw <nathanw@NetBSD.org> | 2001-02-12 04:33:36 +0000 |
| commit | 54caa65cf630bc386bc05af910be06ba55deb635 (patch) | |
| tree | c03b085c7949aa16eeae7fc6d0b5bdecf2f5349a /sys/dev/rasops | |
| parent | 3dce135b7686d45059790a088ed29bc9ddf794b7 (diff) | |
Correct the ri_xorigin calculation for the RI_CENTER case again.
Original calculation (bits += (ri_stride - ri_emustride) / 2) was
incorrect because stride may be wider than visible width.
Fix in 1.33 (bits += (ri_width - ri_emustride) / 2) was incorrect
because units do not match; "bits" and "ri_emustride" are in bytes,
but "width" is in pels. Works by accident for 8bpp displays.
Change to bits += ((ri_width * bpp / 8) - ri_emustride) / 2
to correctly account for visible width and bpp.
Diffstat (limited to 'sys/dev/rasops')
| -rw-r--r-- | sys/dev/rasops/rasops.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/rasops/rasops.c b/sys/dev/rasops/rasops.c index 5174c928394..4352a18f2a9 100644 --- a/sys/dev/rasops/rasops.c +++ b/sys/dev/rasops/rasops.c @@ -1,4 +1,4 @@ -/* $NetBSD: rasops.c,v 1.35 2001/02/02 06:01:01 marcus Exp $ */ +/* $NetBSD: rasops.c,v 1.36 2001/02/12 04:33:36 nathanw Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.35 2001/02/02 06:01:01 marcus Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.36 2001/02/12 04:33:36 nathanw Exp $"); #include "opt_rasops.h" #include "rasops_glue.h" @@ -234,7 +234,8 @@ rasops_reconfig(ri, wantrows, wantcols) ri->ri_origbits = ri->ri_bits; if ((ri->ri_flg & RI_CENTER) != 0) { - ri->ri_bits += ((ri->ri_width - ri->ri_emustride) >> 1) & ~3; + ri->ri_bits += (((ri->ri_width * bpp >> 3) - + ri->ri_emustride) >> 1) & ~3; ri->ri_bits += ((ri->ri_height - ri->ri_emuheight) >> 1) * ri->ri_stride; |
