ephyr: Implement per-screen colormaps
Xephyr's pseudocolor emulation added in:
commit 81a3b6fe27
Author: Matthew Allum <breakfast@10.am>
Date: Mon Nov 8 22:39:47 2004 +0000
Add support to Xephyr for lower depths than hosts
only tracks one global colormap for the whole (Xephyr) display. Move
this to per-screen state so each screen's colormap can be correct.
[ajax: rebased to 1.17, cleaned up commit message]
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Michele Baldessari <michele@redhat.com>
This commit is contained in:
parent
cadd70c809
commit
e774663fa5
|
@ -1292,7 +1292,7 @@ ephyrPutColors(ScreenPtr pScreen, int n, xColorItem * pdefs)
|
|||
if (p > max)
|
||||
max = p;
|
||||
|
||||
hostx_set_cmap_entry(p,
|
||||
hostx_set_cmap_entry(pScreen, p,
|
||||
pdefs->red >> 8,
|
||||
pdefs->green >> 8, pdefs->blue >> 8);
|
||||
pdefs++;
|
||||
|
|
|
@ -83,6 +83,7 @@ typedef struct _ephyrScrPriv {
|
|||
|
||||
KdScreenInfo *screen;
|
||||
int mynum; /* Screen number */
|
||||
unsigned long cmap[256];
|
||||
|
||||
/**
|
||||
* Per-screen Xlib-using state for glamor (private to
|
||||
|
|
|
@ -82,8 +82,6 @@ struct EphyrHostXVars {
|
|||
KdScreenInfo **screens;
|
||||
|
||||
long damage_debug_msec;
|
||||
|
||||
unsigned long cmap[256];
|
||||
};
|
||||
|
||||
/* memset ( missing> ) instead of below */
|
||||
|
@ -751,9 +749,12 @@ hostx_calculate_color_shift(unsigned long mask)
|
|||
}
|
||||
|
||||
void
|
||||
hostx_set_cmap_entry(unsigned char idx,
|
||||
hostx_set_cmap_entry(ScreenPtr pScreen, unsigned char idx,
|
||||
unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
EphyrScrPriv *scrpriv = screen->driver;
|
||||
/* need to calculate the shifts for RGB because server could be BGR. */
|
||||
/* XXX Not sure if this is correct for 8 on 16, but this works for 8 on 24.*/
|
||||
static int rshift, bshift, gshift = 0;
|
||||
|
@ -765,7 +766,7 @@ hostx_set_cmap_entry(unsigned char idx,
|
|||
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) |
|
||||
scrpriv->cmap[idx] = ((r << rshift) & HostX.visual->red_mask) |
|
||||
((g << gshift) & HostX.visual->green_mask) |
|
||||
((b << bshift) & HostX.visual->blue_mask);
|
||||
}
|
||||
|
@ -1017,7 +1018,7 @@ hostx_paint_rect(KdScreenInfo *screen,
|
|||
unsigned char pixel =
|
||||
*(unsigned char *) (scrpriv->fb_data + idx);
|
||||
xcb_image_put_pixel(scrpriv->ximg, x, y,
|
||||
HostX.cmap[pixel]);
|
||||
scrpriv->cmap[pixel]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -141,7 +141,7 @@ hostx_get_visual_masks(KdScreenInfo *screen,
|
|||
CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk);
|
||||
void
|
||||
|
||||
hostx_set_cmap_entry(unsigned char idx,
|
||||
hostx_set_cmap_entry(ScreenPtr pScreen, unsigned char idx,
|
||||
unsigned char r, unsigned char g, unsigned char b);
|
||||
|
||||
void *hostx_screen_init(KdScreenInfo *screen,
|
||||
|
|
Loading…
Reference in New Issue