xserver: Branch 'master'
Alan Coopersmith
alanc at kemper.freedesktop.org
Tue Nov 25 16:31:54 PST 2008
hw/kdrive/ephyr/hostx.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
New commits:
commit 416685c295353b5816689994c7c58ae7db3e878d
Author: Jeremy Uejio <jeremy.uejio at sun.com>
Date: Tue Nov 25 16:26:44 2008 -0800
Refix Sun bug #6685465: Xephyr uses wrong or bad colortable in 8-bit mode
<http://bugs.opensolaris.org/view_bug.do?bug_id=6685465>
This is a refix of the previous fix for CR 6685465. In the first fix
I was shifting the colors to match the mask by the bits_per_rgb amount
in the visual structure. That field has nothing to do with the # of
bits to shift by. I should just instead shift the bits to match the mask.
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 1bc95a8..d289d73 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -578,14 +578,14 @@ hostx_get_visual_masks (EphyrScreenInfo screen,
}
static int
-hostx_calculate_color_shift(unsigned long mask,
- int bits_per_rgb)
+hostx_calculate_color_shift(unsigned long mask)
{
- int shift = 0;
- while(mask) {
- mask = mask >> bits_per_rgb;
- if (mask) shift += bits_per_rgb;
- }
+ int shift = 1;
+ /* count # of bits in mask */
+ while (mask=(mask>>1)) shift++;
+ /* cmap entry is an unsigned char so adjust it by size of that */
+ shift = shift - sizeof(unsigned char) * 8;
+ if (shift < 0) shift = 0;
return shift;
}
@@ -601,12 +601,9 @@ hostx_set_cmap_entry(unsigned char idx,
static int first_time = 1;
if (first_time) {
first_time = 0;
- rshift = hostx_calculate_color_shift(HostX.visual->red_mask,
- HostX.visual->bits_per_rgb);
- gshift = hostx_calculate_color_shift(HostX.visual->green_mask,
- HostX.visual->bits_per_rgb);
- bshift = hostx_calculate_color_shift(HostX.visual->blue_mask,
- HostX.visual->bits_per_rgb);
+ rshift = hostx_calculate_color_shift(HostX.visual->red_mask);
+ gshift = hostx_calculate_color_shift(HostX.visual->green_mask);
+ bshift = hostx_calculate_color_shift(HostX.visual->blue_mask);
}
HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) |
((g << gshift) & HostX.visual->green_mask) |
More information about the xorg-commit
mailing list