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.
This commit is contained in:
parent
d5f9a131a2
commit
416685c295
|
@ -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) |
|
||||
|
|
Loading…
Reference in New Issue
Block a user