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
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WARN("No palette set...\n");
|
FIXME("No palette set...\n");
|
||||||
memset(dst, 0, width * height * 2);
|
memset(dst, 0, width * height * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,8 +97,8 @@ static void pixel_convert_24_to_8(
|
||||||
c_src+=(pitch-width);
|
c_src+=(pitch-width);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WARN("No palette set...\n");
|
FIXME("No palette set...\n");
|
||||||
memset(dst, 0, width * height * 4);
|
memset(dst, 0, width * height * 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ static void pixel_convert_32_to_8(
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WARN("No palette set...\n");
|
FIXME("No palette set...\n");
|
||||||
memset(dst, 0, width * height * 4);
|
memset(dst, 0, width * height * 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ static void palette_convert_24_to_8(
|
||||||
) {
|
) {
|
||||||
int i;
|
int i;
|
||||||
unsigned int *pal = (unsigned int *) screen_palette;
|
unsigned int *pal = (unsigned int *) screen_palette;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
pal[start + i] = ((((unsigned int) palent[i].peRed) << 16) |
|
pal[start + i] = ((((unsigned int) palent[i].peRed) << 16) |
|
||||||
(((unsigned int) palent[i].peGreen) << 8) |
|
(((unsigned int) palent[i].peGreen) << 8) |
|
||||||
|
@ -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 }, { 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 } },
|
{ { 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 } },
|
{ { 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);
|
TRACE("(%p)->(%ld,%ld,%ld)\n", This, width, height, depth);
|
||||||
|
|
||||||
/* We hope getting the asked for 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 */
|
/* I.e. no visual found or emulated */
|
||||||
ERR("(w=%ld,h=%ld,d=%ld), unsupported depth!\n",width,height,depth);
|
ERR("(w=%ld,h=%ld,d=%ld), unsupported depth!\n",width,height,depth);
|
||||||
return DDERR_UNSUPPORTEDMODE;
|
return DDERR_UNSUPPORTEDMODE;
|
||||||
|
|
|
@ -37,22 +37,26 @@ static inline BOOL get_option( const char *name, BOOL def ) {
|
||||||
return PROFILE_GetWineIniBool( "x11drv", name, def );
|
return PROFILE_GetWineIniBool( "x11drv", name, def );
|
||||||
}
|
}
|
||||||
|
|
||||||
int _common_depth_to_pixelformat(
|
int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw)
|
||||||
DWORD depth, DDPIXELFORMAT *pixelformat,DDPIXELFORMAT *screen_pixelformat,
|
{
|
||||||
int *pix_depth
|
ICOM_THIS(IDirectDrawImpl,ddraw);
|
||||||
) {
|
|
||||||
XVisualInfo *vi;
|
XVisualInfo *vi;
|
||||||
XPixmapFormatValues *pf;
|
XPixmapFormatValues *pf;
|
||||||
XVisualInfo vt;
|
XVisualInfo vt;
|
||||||
int nvisuals, npixmap, i;
|
int nvisuals, npixmap, i;
|
||||||
int match = 0;
|
int match = 0;
|
||||||
int index = -2;
|
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);
|
vi = TSXGetVisualInfo(display, VisualNoMask, &vt, &nvisuals);
|
||||||
pf = TSXListPixmapFormats(display, &npixmap);
|
pf = TSXListPixmapFormats(display, &npixmap);
|
||||||
|
|
||||||
for (i = 0; i < npixmap; i++) {
|
for (i = 0; i < npixmap; i++) {
|
||||||
if (pf[i].depth == depth) {
|
if ((pf[i].depth == depth) && (pf[i].bits_per_pixel == depth)) {
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < nvisuals; j++) {
|
for (j = 0; j < nvisuals; j++) {
|
||||||
|
@ -75,8 +79,7 @@ int _common_depth_to_pixelformat(
|
||||||
|
|
||||||
*screen_pixelformat = *pixelformat;
|
*screen_pixelformat = *pixelformat;
|
||||||
|
|
||||||
if (pix_depth)
|
This->d.pixmap_depth = vi[j].depth;
|
||||||
*pix_depth = vi[j].depth;
|
|
||||||
|
|
||||||
match = 1;
|
match = 1;
|
||||||
index = -1;
|
index = -1;
|
||||||
|
@ -92,7 +95,9 @@ int _common_depth_to_pixelformat(
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
for (c = 0; c < sizeof(ModeEmulations) / sizeof(Convert); 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 */
|
/* Found an emulation function, now tries to find a matching visual / pixel format pair */
|
||||||
for (i = 0; i < npixmap; i++) {
|
for (i = 0; i < npixmap; i++) {
|
||||||
if ((pf[i].depth == ModeEmulations[c].screen.depth) &&
|
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->u3.dwBBitMask = ModeEmulations[c].dest.bmask;
|
||||||
}
|
}
|
||||||
pixelformat->u4.dwRGBAlphaBitMask= 0;
|
pixelformat->u4.dwRGBAlphaBitMask= 0;
|
||||||
|
This->d.pixmap_depth = vi[j].depth;
|
||||||
if (pix_depth)
|
|
||||||
*pix_depth = vi[j].depth;
|
|
||||||
|
|
||||||
match = 2;
|
match = 2;
|
||||||
index = c;
|
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;
|
goto clean_up_and_exit;
|
||||||
}
|
}
|
||||||
ERR("No visual corresponding to pixmap format !\n");
|
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",
|
TRACE("(%p)->SetDisplayMode(%ld,%ld,%ld)\n",
|
||||||
This, width, height, depth);
|
This, width, height, depth);
|
||||||
|
|
||||||
switch ((c = _common_depth_to_pixelformat(depth,
|
switch ((c = _common_depth_to_pixelformat(depth,iface))) {
|
||||||
&(This->d.directdraw_pixelformat),
|
|
||||||
&(This->d.screen_pixelformat),
|
|
||||||
&(This->d.pixmap_depth)))) {
|
|
||||||
case -2:
|
case -2:
|
||||||
sprintf(buf,"SetDisplayMode(w=%ld,h=%ld,d=%ld), unsupported depth!",width,height,depth);
|
sprintf(buf,"SetDisplayMode(w=%ld,h=%ld,d=%ld), unsupported depth!",width,height,depth);
|
||||||
MessageBoxA(0,buf,"WINE DirectDraw",MB_OK|MB_ICONSTOP);
|
MessageBoxA(0,buf,"WINE DirectDraw",MB_OK|MB_ICONSTOP);
|
||||||
return DDERR_UNSUPPORTEDMODE;
|
return DDERR_UNSUPPORTEDMODE;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
/* No conversion */
|
/* No conversion. Good. */
|
||||||
This->d.pixel_convert = NULL;
|
|
||||||
This->d.palette_convert = NULL;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DPRINTF("DirectDraw warning: running in depth-conversion mode. Should run using a %ld depth for optimal performances.\n", depth);
|
DPRINTF("DirectDraw warning: running in depth-conversion mode %d. Should run using a %ld depth for optimal performances.\n", c,depth);
|
||||||
/* Set the depth conversion routines */
|
|
||||||
This->d.pixel_convert = ModeEmulations[c].funcs.pixel_convert;
|
|
||||||
This->d.palette_convert = ModeEmulations[c].funcs.palette_convert;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
This->d.width = width;
|
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 PFGET_BPP(pf) (pf.dwFlags&DDPF_PALETTEINDEXED8?1:(pf.u.dwRGBBitCount/8))
|
||||||
#define GET_BPP(desc) PFGET_BPP(desc.ddpfPixelFormat)
|
#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 {
|
typedef struct {
|
||||||
unsigned short bpp,depth;
|
unsigned short bpp,depth;
|
||||||
unsigned int rmask,gmask,bmask;
|
unsigned int rmask,gmask,bmask;
|
||||||
|
@ -381,11 +379,8 @@ typedef struct {
|
||||||
ConvertFuncs funcs;
|
ConvertFuncs funcs;
|
||||||
} Convert;
|
} Convert;
|
||||||
|
|
||||||
extern Convert ModeEmulations[5];
|
extern Convert ModeEmulations[6];
|
||||||
extern int _common_depth_to_pixelformat(
|
extern int _common_depth_to_pixelformat(DWORD depth,LPDIRECTDRAW ddraw);
|
||||||
DWORD depth,DDPIXELFORMAT *pixelformat,
|
|
||||||
DDPIXELFORMAT *screen_pixelformat, int *pix_depth
|
|
||||||
);
|
|
||||||
|
|
||||||
extern HRESULT create_direct3d(LPVOID *obj,IDirectDraw2Impl*);
|
extern HRESULT create_direct3d(LPVOID *obj,IDirectDraw2Impl*);
|
||||||
extern HRESULT create_direct3d2(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 */
|
/* just assume the default depth is the DGA depth too */
|
||||||
depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
|
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
|
#ifdef RESTORE_SIGNALS
|
||||||
SIGNAL_Init();
|
SIGNAL_Init();
|
||||||
|
|
|
@ -237,15 +237,19 @@ void _dump_pixelformat(void *in) {
|
||||||
DPRINTF(" R "); DPRINTF(cmd, pf->u1.dwRBitMask);
|
DPRINTF(" R "); DPRINTF(cmd, pf->u1.dwRBitMask);
|
||||||
DPRINTF(" G "); DPRINTF(cmd, pf->u2.dwGBitMask);
|
DPRINTF(" G "); DPRINTF(cmd, pf->u2.dwGBitMask);
|
||||||
DPRINTF(" B "); DPRINTF(cmd, pf->u3.dwBBitMask);
|
DPRINTF(" B "); DPRINTF(cmd, pf->u3.dwBBitMask);
|
||||||
if (pf->dwFlags & DDPF_ALPHAPIXELS)
|
if (pf->dwFlags & DDPF_ALPHAPIXELS) {
|
||||||
DPRINTF(" A "); DPRINTF(cmd, pf->u4.dwRGBAlphaBitMask);
|
DPRINTF(" A "); DPRINTF(cmd, pf->u4.dwRGBAlphaBitMask);
|
||||||
if (pf->dwFlags & DDPF_ZPIXELS)
|
}
|
||||||
|
if (pf->dwFlags & DDPF_ZPIXELS) {
|
||||||
DPRINTF(" Z "); DPRINTF(cmd, pf->u4.dwRGBZBitMask);
|
DPRINTF(" Z "); DPRINTF(cmd, pf->u4.dwRGBZBitMask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pf->dwFlags & DDPF_ZBUFFER)
|
if (pf->dwFlags & DDPF_ZBUFFER) {
|
||||||
DPRINTF(", Z bits : %ld", pf->u.dwZBufferBitDepth);
|
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(", Alpha bits : %ld", pf->u.dwAlphaBitDepth);
|
||||||
|
}
|
||||||
DPRINTF(")");
|
DPRINTF(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,10 +70,8 @@ static HRESULT X11_Create( LPDIRECTDRAW *lplpDD ) {
|
||||||
|
|
||||||
/* At DirectDraw creation, the depth is the default depth */
|
/* At DirectDraw creation, the depth is the default depth */
|
||||||
depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
|
depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
|
||||||
_common_depth_to_pixelformat(depth,
|
|
||||||
&(ddraw->d.directdraw_pixelformat),
|
_common_depth_to_pixelformat(depth,(LPDIRECTDRAW)ddraw);
|
||||||
&(ddraw->d.screen_pixelformat),
|
|
||||||
&(ddraw->d.pixmap_depth));
|
|
||||||
ddraw->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
|
ddraw->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
|
||||||
ddraw->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
|
ddraw->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
|
||||||
#ifdef HAVE_LIBXXSHM
|
#ifdef HAVE_LIBXXSHM
|
||||||
|
|
Loading…
Reference in New Issue