winex11: Use ColorShifts from physDev in X11DRV_PALETTE_ToPhysical.

This commit is contained in:
Roderick Colenbrander 2009-09-01 21:48:29 +02:00 committed by Alexandre Julliard
parent 3ad349f316
commit 5fc017c497
5 changed files with 31 additions and 3 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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 );

View File

@ -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

View File

@ -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];