Added 24->32 packed pixel mapping support to convert.
Slightly rewrote the conversion initialisation.
This commit is contained in:
parent
a6ae55542f
commit
9c51c96c6d
|
@ -44,7 +44,7 @@ static void pixel_convert_16_to_8(void *src, void *dst, DWORD width, DWORD heigh
|
|||
#endif
|
||||
}
|
||||
} else {
|
||||
WARN("No palette set...\n");
|
||||
FIXME("No palette set...\n");
|
||||
memset(dst, 0, width * height * 2);
|
||||
}
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ static void pixel_convert_24_to_8(
|
|||
c_src+=(pitch-width);
|
||||
}
|
||||
} else {
|
||||
WARN("No palette set...\n");
|
||||
memset(dst, 0, width * height * 4);
|
||||
FIXME("No palette set...\n");
|
||||
memset(dst, 0, width * height * 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ static void pixel_convert_32_to_8(
|
|||
#endif
|
||||
}
|
||||
} else {
|
||||
WARN("No palette set...\n");
|
||||
FIXME("No palette set...\n");
|
||||
memset(dst, 0, width * height * 4);
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,29 @@ static void pixel_convert_32_to_16(
|
|||
}
|
||||
}
|
||||
|
||||
Convert ModeEmulations[5] = {
|
||||
/* *************************************
|
||||
32 bpp to 24 bpp
|
||||
************************************* */
|
||||
static void pixel_convert_32_to_24(
|
||||
void *src, void *dst, DWORD width, DWORD height, LONG pitch,
|
||||
IDirectDrawPaletteImpl* palette
|
||||
) {
|
||||
unsigned char *c_src = (unsigned char *) src;
|
||||
unsigned int *c_dst = (unsigned int *) dst;
|
||||
int y;
|
||||
|
||||
for (y = height; y--; ) {
|
||||
unsigned char * srclineend = c_src+width*3;
|
||||
while (c_src < srclineend ) {
|
||||
*c_dst++ = (c_src[0] << 16)|(c_src[1] << 8)|c_src[2];
|
||||
c_src+=3;
|
||||
}
|
||||
c_src+=pitch-width*3;
|
||||
}
|
||||
}
|
||||
|
||||
Convert ModeEmulations[6] = {
|
||||
{ { 32, 24, 0x00FF0000, 0x0000FF00, 0x000000FF }, { 24, 24, 0xFF0000, 0x0FF0000, 0x00FF }, { pixel_convert_32_to_24, NULL } },
|
||||
{ { 32, 24, 0x00FF0000, 0x0000FF00, 0x000000FF }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_32_to_8, palette_convert_24_to_8 } },
|
||||
{ { 32, 24, 0x00FF0000, 0x0000FF00, 0x000000FF }, { 16, 16, 0xF800, 0x07E0, 0x001F }, { pixel_convert_32_to_16, NULL } },
|
||||
{ { 24, 24, 0xFF0000, 0x00FF00, 0x0000FF }, { 8, 8, 0x00, 0x00, 0x00 }, { pixel_convert_24_to_8, palette_convert_24_to_8 } },
|
||||
|
|
|
@ -215,7 +215,7 @@ static HRESULT WINAPI DGA_IDirectDrawImpl_SetDisplayMode(
|
|||
TRACE("(%p)->(%ld,%ld,%ld)\n", This, width, height, depth);
|
||||
|
||||
/* We hope getting the asked for depth */
|
||||
if (_common_depth_to_pixelformat(depth, &(This->d.directdraw_pixelformat), &(This->d.screen_pixelformat), NULL) != -1) {
|
||||
if (_common_depth_to_pixelformat(depth,iface)) {
|
||||
/* I.e. no visual found or emulated */
|
||||
ERR("(w=%ld,h=%ld,d=%ld), unsupported depth!\n",width,height,depth);
|
||||
return DDERR_UNSUPPORTEDMODE;
|
||||
|
|
|
@ -37,22 +37,26 @@ static inline BOOL get_option( const char *name, BOOL def ) {
|
|||
return PROFILE_GetWineIniBool( "x11drv", name, def );
|
||||
}
|
||||
|
||||
int _common_depth_to_pixelformat(
|
||||
DWORD depth, DDPIXELFORMAT *pixelformat,DDPIXELFORMAT *screen_pixelformat,
|
||||
int *pix_depth
|
||||
) {
|
||||
int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw)
|
||||
{
|
||||
ICOM_THIS(IDirectDrawImpl,ddraw);
|
||||
XVisualInfo *vi;
|
||||
XPixmapFormatValues *pf;
|
||||
XVisualInfo vt;
|
||||
int nvisuals, npixmap, i;
|
||||
int match = 0;
|
||||
int index = -2;
|
||||
DDPIXELFORMAT *pixelformat = &(This->d.directdraw_pixelformat);
|
||||
DDPIXELFORMAT *screen_pixelformat = &(This->d.screen_pixelformat);
|
||||
|
||||
This->d.pixel_convert = NULL;
|
||||
This->d.palette_convert = NULL;
|
||||
|
||||
vi = TSXGetVisualInfo(display, VisualNoMask, &vt, &nvisuals);
|
||||
pf = TSXListPixmapFormats(display, &npixmap);
|
||||
|
||||
for (i = 0; i < npixmap; i++) {
|
||||
if (pf[i].depth == depth) {
|
||||
if ((pf[i].depth == depth) && (pf[i].bits_per_pixel == depth)) {
|
||||
int j;
|
||||
|
||||
for (j = 0; j < nvisuals; j++) {
|
||||
|
@ -75,8 +79,7 @@ int _common_depth_to_pixelformat(
|
|||
|
||||
*screen_pixelformat = *pixelformat;
|
||||
|
||||
if (pix_depth)
|
||||
*pix_depth = vi[j].depth;
|
||||
This->d.pixmap_depth = vi[j].depth;
|
||||
|
||||
match = 1;
|
||||
index = -1;
|
||||
|
@ -92,7 +95,9 @@ int _common_depth_to_pixelformat(
|
|||
int c;
|
||||
|
||||
for (c = 0; c < sizeof(ModeEmulations) / sizeof(Convert); c++) {
|
||||
if (ModeEmulations[c].dest.depth == depth) {
|
||||
if ((ModeEmulations[c].dest.depth == depth) &&
|
||||
(ModeEmulations[c].dest.bpp == depth)
|
||||
) {
|
||||
/* Found an emulation function, now tries to find a matching visual / pixel format pair */
|
||||
for (i = 0; i < npixmap; i++) {
|
||||
if ((pf[i].depth == ModeEmulations[c].screen.depth) &&
|
||||
|
@ -126,12 +131,11 @@ int _common_depth_to_pixelformat(
|
|||
pixelformat->u3.dwBBitMask = ModeEmulations[c].dest.bmask;
|
||||
}
|
||||
pixelformat->u4.dwRGBAlphaBitMask= 0;
|
||||
|
||||
if (pix_depth)
|
||||
*pix_depth = vi[j].depth;
|
||||
|
||||
This->d.pixmap_depth = vi[j].depth;
|
||||
match = 2;
|
||||
index = c;
|
||||
This->d.pixel_convert =ModeEmulations[c].funcs.pixel_convert;
|
||||
This->d.palette_convert=ModeEmulations[c].funcs.palette_convert;
|
||||
goto clean_up_and_exit;
|
||||
}
|
||||
ERR("No visual corresponding to pixmap format !\n");
|
||||
|
@ -483,26 +487,16 @@ static HRESULT WINAPI Xlib_IDirectDrawImpl_SetDisplayMode(
|
|||
TRACE("(%p)->SetDisplayMode(%ld,%ld,%ld)\n",
|
||||
This, width, height, depth);
|
||||
|
||||
switch ((c = _common_depth_to_pixelformat(depth,
|
||||
&(This->d.directdraw_pixelformat),
|
||||
&(This->d.screen_pixelformat),
|
||||
&(This->d.pixmap_depth)))) {
|
||||
switch ((c = _common_depth_to_pixelformat(depth,iface))) {
|
||||
case -2:
|
||||
sprintf(buf,"SetDisplayMode(w=%ld,h=%ld,d=%ld), unsupported depth!",width,height,depth);
|
||||
MessageBoxA(0,buf,"WINE DirectDraw",MB_OK|MB_ICONSTOP);
|
||||
return DDERR_UNSUPPORTEDMODE;
|
||||
|
||||
case -1:
|
||||
/* No conversion */
|
||||
This->d.pixel_convert = NULL;
|
||||
This->d.palette_convert = NULL;
|
||||
/* No conversion. Good. */
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINTF("DirectDraw warning: running in depth-conversion mode. Should run using a %ld depth for optimal performances.\n", depth);
|
||||
/* Set the depth conversion routines */
|
||||
This->d.pixel_convert = ModeEmulations[c].funcs.pixel_convert;
|
||||
This->d.palette_convert = ModeEmulations[c].funcs.palette_convert;
|
||||
DPRINTF("DirectDraw warning: running in depth-conversion mode %d. Should run using a %ld depth for optimal performances.\n", c,depth);
|
||||
}
|
||||
|
||||
This->d.width = width;
|
||||
|
|
|
@ -364,8 +364,6 @@ extern void _common_IDirectDrawImpl_SetDisplayMode(IDirectDrawImpl* This);
|
|||
#define PFGET_BPP(pf) (pf.dwFlags&DDPF_PALETTEINDEXED8?1:(pf.u.dwRGBBitCount/8))
|
||||
#define GET_BPP(desc) PFGET_BPP(desc.ddpfPixelFormat)
|
||||
|
||||
extern int _common_depth_to_pixelformat(DWORD depth, DDPIXELFORMAT *pixelformat,DDPIXELFORMAT *screen_pixelformat, int *pix_depth);
|
||||
|
||||
typedef struct {
|
||||
unsigned short bpp,depth;
|
||||
unsigned int rmask,gmask,bmask;
|
||||
|
@ -381,11 +379,8 @@ typedef struct {
|
|||
ConvertFuncs funcs;
|
||||
} Convert;
|
||||
|
||||
extern Convert ModeEmulations[5];
|
||||
extern int _common_depth_to_pixelformat(
|
||||
DWORD depth,DDPIXELFORMAT *pixelformat,
|
||||
DDPIXELFORMAT *screen_pixelformat, int *pix_depth
|
||||
);
|
||||
extern Convert ModeEmulations[6];
|
||||
extern int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw);
|
||||
|
||||
extern HRESULT create_direct3d(LPVOID *obj,IDirectDraw2Impl*);
|
||||
extern HRESULT create_direct3d2(LPVOID *obj,IDirectDraw2Impl*);
|
||||
|
|
|
@ -165,7 +165,7 @@ DGA_Create( LPDIRECTDRAW *lplpDD ) {
|
|||
/* just assume the default depth is the DGA depth too */
|
||||
depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
|
||||
|
||||
_common_depth_to_pixelformat(depth, &(ddraw->d.directdraw_pixelformat), &(ddraw->d.screen_pixelformat), NULL);
|
||||
_common_depth_to_pixelformat(depth, ddraw);
|
||||
|
||||
#ifdef RESTORE_SIGNALS
|
||||
SIGNAL_Init();
|
||||
|
|
|
@ -237,15 +237,19 @@ void _dump_pixelformat(void *in) {
|
|||
DPRINTF(" R "); DPRINTF(cmd, pf->u1.dwRBitMask);
|
||||
DPRINTF(" G "); DPRINTF(cmd, pf->u2.dwGBitMask);
|
||||
DPRINTF(" B "); DPRINTF(cmd, pf->u3.dwBBitMask);
|
||||
if (pf->dwFlags & DDPF_ALPHAPIXELS)
|
||||
if (pf->dwFlags & DDPF_ALPHAPIXELS) {
|
||||
DPRINTF(" A "); DPRINTF(cmd, pf->u4.dwRGBAlphaBitMask);
|
||||
if (pf->dwFlags & DDPF_ZPIXELS)
|
||||
}
|
||||
if (pf->dwFlags & DDPF_ZPIXELS) {
|
||||
DPRINTF(" Z "); DPRINTF(cmd, pf->u4.dwRGBZBitMask);
|
||||
}
|
||||
if (pf->dwFlags & DDPF_ZBUFFER)
|
||||
}
|
||||
if (pf->dwFlags & DDPF_ZBUFFER) {
|
||||
DPRINTF(", Z bits : %ld", pf->u.dwZBufferBitDepth);
|
||||
if (pf->dwFlags & DDPF_ALPHA)
|
||||
}
|
||||
if (pf->dwFlags & DDPF_ALPHA) {
|
||||
DPRINTF(", Alpha bits : %ld", pf->u.dwAlphaBitDepth);
|
||||
}
|
||||
DPRINTF(")");
|
||||
}
|
||||
|
||||
|
|
|
@ -70,10 +70,8 @@ static HRESULT X11_Create( LPDIRECTDRAW *lplpDD ) {
|
|||
|
||||
/* At DirectDraw creation, the depth is the default depth */
|
||||
depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
|
||||
_common_depth_to_pixelformat(depth,
|
||||
&(ddraw->d.directdraw_pixelformat),
|
||||
&(ddraw->d.screen_pixelformat),
|
||||
&(ddraw->d.pixmap_depth));
|
||||
|
||||
_common_depth_to_pixelformat(depth,(LPDIRECTDRAW)ddraw);
|
||||
ddraw->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
|
||||
ddraw->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
|
||||
#ifdef HAVE_LIBXXSHM
|
||||
|
|
Loading…
Reference in New Issue