Commit 5fc017c4 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

winex11: Use ColorShifts from physDev in X11DRV_PALETTE_ToPhysical.

parent 3ad349f3
......@@ -110,6 +110,10 @@ HBITMAP CDECL X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
if (physDev->depth != physBitmap->pixmap_depth)
{
physDev->depth = physBitmap->pixmap_depth;
if(physDev->depth == 1)
physDev->color_shifts = NULL;
else
physDev->color_shifts = &physBitmap->pixmap_color_shifts;
wine_tsx11_lock();
XFreeGC( gdi_display, physDev->gc );
physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL );
......@@ -158,7 +162,15 @@ BOOL CDECL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID
/* Create the pixmap */
wine_tsx11_lock();
physBitmap->pixmap_depth = (bitmap.bmBitsPixel == 1) ? 1 : screen_depth;
if(bitmap.bmBitsPixel == 1)
{
physBitmap->pixmap_depth = 1;
}
else
{
physBitmap->pixmap_depth = screen_depth;
physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
}
physBitmap->pixmap = XCreatePixmap(gdi_display, root_window,
bitmap.bmWidth, bitmap.bmHeight, physBitmap->pixmap_depth);
wine_tsx11_unlock();
......
......@@ -4746,7 +4746,15 @@ HBITMAP CDECL X11DRV_CreateDIBSection( X11DRV_PDEVICE *physDev, HBITMAP hbitmap,
/* create pixmap and X image */
wine_tsx11_lock();
physBitmap->pixmap_depth = (dib.dsBm.bmBitsPixel == 1) ? 1 : screen_depth;
if(dib.dsBm.bmBitsPixel == 1)
{
physBitmap->pixmap_depth = 1;
}
else
{
physBitmap->pixmap_depth = screen_depth;
physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
}
#ifdef HAVE_LIBXXSHM
physBitmap->shminfo.shmid = -1;
......
......@@ -138,6 +138,7 @@ BOOL CDECL X11DRV_CreateDC( HDC hdc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCW
physDev->bitmap = &BITMAP_stock_phys_bitmap;
physDev->drawable = BITMAP_stock_phys_bitmap.pixmap;
physDev->depth = 1;
physDev->color_shifts = NULL;
SetRect( &physDev->drawable_rect, 0, 0, 1, 1 );
physDev->dc_rect = physDev->drawable_rect;
}
......@@ -146,6 +147,7 @@ BOOL CDECL X11DRV_CreateDC( HDC hdc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCW
physDev->bitmap = NULL;
physDev->drawable = root_window;
physDev->depth = screen_depth;
physDev->color_shifts = &X11DRV_PALETTE_default_shifts;
physDev->drawable_rect = virtual_screen_rect;
SetRect( &physDev->dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
virtual_screen_rect.bottom - virtual_screen_rect.top );
......
......@@ -60,7 +60,7 @@ Colormap X11DRV_PALETTE_PaletteXColormap = 0;
UINT16 X11DRV_PALETTE_PaletteFlags = 0;
/* initialize to zero to handle abortive X11DRV_PALETTE_VIRTUAL visuals */
static ColorShifts X11DRV_PALETTE_default_shifts = { {0,0,0,}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} };
ColorShifts X11DRV_PALETTE_default_shifts = { {0,0,0,}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} };
static int X11DRV_PALETTE_Graymax = 0;
static int palette_size;
......@@ -874,6 +874,9 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
PALETTEENTRY entry;
ColorShifts *shifts = &X11DRV_PALETTE_default_shifts;
if(physDev->color_shifts)
shifts = physDev->color_shifts;
if ( X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_FIXED )
{
/* there is no colormap limitation; we are going to have to compute
......
......@@ -118,6 +118,7 @@ typedef struct
Pixmap pixmap;
XID glxpixmap;
int pixmap_depth;
ColorShifts pixmap_color_shifts;
/* the following fields are only used for DIB section bitmaps */
int status, p_status; /* mapping status */
XImage *image; /* cached XImage */
......@@ -155,6 +156,7 @@ typedef struct
int backgroundPixel;
int textPixel;
int depth; /* bit depth of the DC */
ColorShifts *color_shifts; /* color shifts of the DC */
int exposures; /* count of graphics exposures operations */
int current_pf;
Drawable gl_drawable;
......@@ -480,6 +482,7 @@ extern UINT16 X11DRV_PALETTE_PaletteFlags;
extern int *X11DRV_PALETTE_PaletteToXPixel;
extern int *X11DRV_PALETTE_XPixelToPalette;
extern ColorShifts X11DRV_PALETTE_default_shifts;
extern int X11DRV_PALETTE_mapEGAPixel[16];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment