winex11: Abstract the depth->bpp conversion and use it in X11DRV_DIB_CreateDIBFromPixmap.
This commit is contained in:
parent
68feed7e77
commit
0d30daa8e4
|
@ -4856,7 +4856,7 @@ HGLOBAL X11DRV_DIB_CreateDIBFromPixmap(Pixmap pixmap, HDC hdc)
|
||||||
* Create an HBITMAP with the same dimensions and BPP as the pixmap,
|
* Create an HBITMAP with the same dimensions and BPP as the pixmap,
|
||||||
* and make it a container for the pixmap passed.
|
* and make it a container for the pixmap passed.
|
||||||
*/
|
*/
|
||||||
hBmp = CreateBitmap( width, height, 1, depth, NULL );
|
if (!(hBmp = CreateBitmap( width, height, 1, depth_to_bpp(depth), NULL ))) return 0;
|
||||||
|
|
||||||
/* force bitmap to be owned by a screen DC */
|
/* force bitmap to be owned by a screen DC */
|
||||||
hdcMem = CreateCompatibleDC( hdc );
|
hdcMem = CreateCompatibleDC( hdc );
|
||||||
|
|
|
@ -463,6 +463,8 @@ extern BOOL X11DRV_IsSolidColor(COLORREF color);
|
||||||
extern COLORREF X11DRV_PALETTE_ToLogical(int pixel);
|
extern COLORREF X11DRV_PALETTE_ToLogical(int pixel);
|
||||||
extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color);
|
extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color);
|
||||||
|
|
||||||
|
extern unsigned int depth_to_bpp( unsigned int depth );
|
||||||
|
|
||||||
/* GDI escapes */
|
/* GDI escapes */
|
||||||
|
|
||||||
#define X11DRV_ESCAPE 6789
|
#define X11DRV_ESCAPE 6789
|
||||||
|
|
|
@ -277,6 +277,37 @@ void wine_tsx11_unlock(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* depth_to_bpp
|
||||||
|
*
|
||||||
|
* Convert X11-reported depth to the BPP value that Windows apps expect to see.
|
||||||
|
*/
|
||||||
|
unsigned int depth_to_bpp( unsigned int depth )
|
||||||
|
{
|
||||||
|
switch (depth)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 8:
|
||||||
|
return depth;
|
||||||
|
case 15:
|
||||||
|
case 16:
|
||||||
|
return 16;
|
||||||
|
case 24:
|
||||||
|
/* This is not necessarily right. X11 always has 24 bits per pixel, but it can run
|
||||||
|
* with 24 bit framebuffers and 32 bit framebuffers. It doesn't make any difference
|
||||||
|
* for windowing, but gl applications can get visuals with alpha channels. So we
|
||||||
|
* should check the framebuffer and/or opengl formats available to find out what the
|
||||||
|
* framebuffer actually does
|
||||||
|
*/
|
||||||
|
case 32:
|
||||||
|
return 32;
|
||||||
|
default:
|
||||||
|
FIXME( "Unexpected X11 depth %d bpp, what to report to app?\n", depth );
|
||||||
|
return depth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* get_config_key
|
* get_config_key
|
||||||
*
|
*
|
||||||
|
@ -491,35 +522,7 @@ static BOOL process_attach(void)
|
||||||
screen_depth = desktop_vi->depth;
|
screen_depth = desktop_vi->depth;
|
||||||
XFree(desktop_vi);
|
XFree(desktop_vi);
|
||||||
}
|
}
|
||||||
|
screen_bpp = depth_to_bpp( screen_depth );
|
||||||
switch(screen_depth) {
|
|
||||||
case 8:
|
|
||||||
screen_bpp = 8;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 15:
|
|
||||||
/* In GetDeviceCaps MSDN description explicitly states that
|
|
||||||
* in 15 bpp mode 16 is returned.
|
|
||||||
*/
|
|
||||||
/* fall through */
|
|
||||||
case 16:
|
|
||||||
screen_bpp = 16;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 24:
|
|
||||||
/* This is not necessarily right. X11 always has 24 bits per pixel, but it can run
|
|
||||||
* with 24 bit framebuffers and 32 bit framebuffers. It doesn't make any difference
|
|
||||||
* for windowing, but gl applications can get visuals with alpha channels. So we
|
|
||||||
* should check the framebuffer and/or opengl formats available to find out what the
|
|
||||||
* framebuffer actually does
|
|
||||||
*/
|
|
||||||
screen_bpp = 32;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
FIXME("Unexpected X11 depth %d bpp, what to report to app?\n", screen_depth);
|
|
||||||
screen_bpp = screen_depth;
|
|
||||||
}
|
|
||||||
|
|
||||||
XInternAtoms( display, (char **)atom_names, NB_XATOMS - FIRST_XATOM, False, X11DRV_Atoms );
|
XInternAtoms( display, (char **)atom_names, NB_XATOMS - FIRST_XATOM, False, X11DRV_Atoms );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue