Commit 29c43e2e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Rename PixelFormat_WineD3DtoDD() to ddrawformat_from_wined3dformat().

parent 86eb2111
...@@ -1375,7 +1375,7 @@ static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2 ...@@ -1375,7 +1375,7 @@ static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2
DDSD->u2.dwRefreshRate = 60; DDSD->u2.dwRefreshRate = 60;
DDSD->ddsCaps.dwCaps = 0; DDSD->ddsCaps.dwCaps = 0;
DDSD->u4.ddpfPixelFormat.dwSize = sizeof(DDSD->u4.ddpfPixelFormat); DDSD->u4.ddpfPixelFormat.dwSize = sizeof(DDSD->u4.ddpfPixelFormat);
PixelFormat_WineD3DtoDD(&DDSD->u4.ddpfPixelFormat, mode.format_id); ddrawformat_from_wined3dformat(&DDSD->u4.ddpfPixelFormat, mode.format_id);
DDSD->u1.lPitch = mode.width * DDSD->u4.ddpfPixelFormat.u1.dwRGBBitCount / 8; DDSD->u1.lPitch = mode.width * DDSD->u4.ddpfPixelFormat.u1.dwRGBBitCount / 8;
if(TRACE_ON(ddraw)) if(TRACE_ON(ddraw))
...@@ -2115,7 +2115,7 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, ...@@ -2115,7 +2115,7 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
BOOL found = FALSE; BOOL found = FALSE;
unsigned i; unsigned i;
PixelFormat_WineD3DtoDD(&pixelformat, mode.format_id); ddrawformat_from_wined3dformat(&pixelformat, mode.format_id);
if (DDSD) if (DDSD)
{ {
if (DDSD->dwFlags & DDSD_WIDTH && mode.width != DDSD->dwWidth) if (DDSD->dwFlags & DDSD_WIDTH && mode.width != DDSD->dwWidth)
...@@ -2717,7 +2717,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD, ...@@ -2717,7 +2717,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
desc2.dwFlags |= DDSD_PIXELFORMAT; desc2.dwFlags |= DDSD_PIXELFORMAT;
desc2.u4.ddpfPixelFormat.dwSize=sizeof(DDPIXELFORMAT); desc2.u4.ddpfPixelFormat.dwSize=sizeof(DDPIXELFORMAT);
PixelFormat_WineD3DtoDD(&desc2.u4.ddpfPixelFormat, mode.format_id); ddrawformat_from_wined3dformat(&desc2.u4.ddpfPixelFormat, mode.format_id);
} }
/* No Width or no Height? Use the original screen size /* No Width or no Height? Use the original screen size
...@@ -4428,7 +4428,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device ...@@ -4428,7 +4428,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
memset(&pformat, 0, sizeof(pformat)); memset(&pformat, 0, sizeof(pformat));
pformat.dwSize = sizeof(pformat); pformat.dwSize = sizeof(pformat);
PixelFormat_WineD3DtoDD(&pformat, formats[i]); ddrawformat_from_wined3dformat(&pformat, formats[i]);
TRACE("Enumerating wined3d format %#x.\n", formats[i]); TRACE("Enumerating wined3d format %#x.\n", formats[i]);
hr = callback(&pformat, context); hr = callback(&pformat, context);
......
...@@ -551,7 +551,8 @@ struct d3d_vertex_buffer *unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVerte ...@@ -551,7 +551,8 @@ struct d3d_vertex_buffer *unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVerte
#define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \ #define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \
(((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1) (((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)
void PixelFormat_WineD3DtoDD(DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_id WineD3DFormat) DECLSPEC_HIDDEN; void ddrawformat_from_wined3dformat(DDPIXELFORMAT *ddraw_format,
enum wined3d_format_id wined3d_format) DECLSPEC_HIDDEN;
enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *format) DECLSPEC_HIDDEN; enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *format) DECLSPEC_HIDDEN;
void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd) DECLSPEC_HIDDEN; void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd) DECLSPEC_HIDDEN;
void dump_D3DMATRIX(const D3DMATRIX *mat) DECLSPEC_HIDDEN; void dump_D3DMATRIX(const D3DMATRIX *mat) DECLSPEC_HIDDEN;
......
...@@ -1111,7 +1111,7 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface, ...@@ -1111,7 +1111,7 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
memset(&pformat, 0, sizeof(pformat)); memset(&pformat, 0, sizeof(pformat));
pformat.dwSize = sizeof(pformat); pformat.dwSize = sizeof(pformat);
PixelFormat_WineD3DtoDD(&pformat, FormatList[i]); ddrawformat_from_wined3dformat(&pformat, FormatList[i]);
TRACE("Enumerating WineD3DFormat %d\n", FormatList[i]); TRACE("Enumerating WineD3DFormat %d\n", FormatList[i]);
hr = callback(&pformat, context); hr = callback(&pformat, context);
...@@ -1134,7 +1134,7 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface, ...@@ -1134,7 +1134,7 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
memset(&pformat, 0, sizeof(pformat)); memset(&pformat, 0, sizeof(pformat));
pformat.dwSize = sizeof(pformat); pformat.dwSize = sizeof(pformat);
PixelFormat_WineD3DtoDD(&pformat, BumpFormatList[i]); ddrawformat_from_wined3dformat(&pformat, BumpFormatList[i]);
TRACE("Enumerating WineD3DFormat %d\n", BumpFormatList[i]); TRACE("Enumerating WineD3DFormat %d\n", BumpFormatList[i]);
hr = callback(&pformat, context); hr = callback(&pformat, context);
...@@ -1242,7 +1242,7 @@ static HRESULT WINAPI d3d_device2_EnumTextureFormats(IDirect3DDevice2 *iface, ...@@ -1242,7 +1242,7 @@ static HRESULT WINAPI d3d_device2_EnumTextureFormats(IDirect3DDevice2 *iface,
sdesc.dwFlags = DDSD_PIXELFORMAT | DDSD_CAPS; sdesc.dwFlags = DDSD_PIXELFORMAT | DDSD_CAPS;
sdesc.ddsCaps.dwCaps = DDSCAPS_TEXTURE; sdesc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
sdesc.ddpfPixelFormat.dwSize = sizeof(sdesc.ddpfPixelFormat); sdesc.ddpfPixelFormat.dwSize = sizeof(sdesc.ddpfPixelFormat);
PixelFormat_WineD3DtoDD(&sdesc.ddpfPixelFormat, FormatList[i]); ddrawformat_from_wined3dformat(&sdesc.ddpfPixelFormat, FormatList[i]);
TRACE("Enumerating WineD3DFormat %d\n", FormatList[i]); TRACE("Enumerating WineD3DFormat %d\n", FormatList[i]);
hr = callback(&sdesc, context); hr = callback(&sdesc, context);
...@@ -2463,7 +2463,7 @@ static HRESULT WINAPI d3d_device3_GetRenderState(IDirect3DDevice3 *iface, ...@@ -2463,7 +2463,7 @@ static HRESULT WINAPI d3d_device3_GetRenderState(IDirect3DDevice3 *iface,
wined3d_resource_get_desc(sub_resource, &desc); wined3d_resource_get_desc(sub_resource, &desc);
ddfmt.dwSize = sizeof(ddfmt); ddfmt.dwSize = sizeof(ddfmt);
PixelFormat_WineD3DtoDD(&ddfmt, desc.format); ddrawformat_from_wined3dformat(&ddfmt, desc.format);
if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE;
} }
} }
...@@ -2752,7 +2752,7 @@ static HRESULT WINAPI d3d_device3_SetRenderState(IDirect3DDevice3 *iface, ...@@ -2752,7 +2752,7 @@ static HRESULT WINAPI d3d_device3_SetRenderState(IDirect3DDevice3 *iface,
wined3d_resource_get_desc(sub_resource, &desc); wined3d_resource_get_desc(sub_resource, &desc);
ddfmt.dwSize = sizeof(ddfmt); ddfmt.dwSize = sizeof(ddfmt);
PixelFormat_WineD3DtoDD(&ddfmt, desc.format); ddrawformat_from_wined3dformat(&ddfmt, desc.format);
if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE;
} }
} }
...@@ -4616,7 +4616,7 @@ static HRESULT WINAPI d3d_device3_SetTexture(IDirect3DDevice3 *iface, ...@@ -4616,7 +4616,7 @@ static HRESULT WINAPI d3d_device3_SetTexture(IDirect3DDevice3 *iface,
wined3d_resource_get_desc(sub_resource, &desc); wined3d_resource_get_desc(sub_resource, &desc);
ddfmt.dwSize = sizeof(ddfmt); ddfmt.dwSize = sizeof(ddfmt);
PixelFormat_WineD3DtoDD(&ddfmt, desc.format); ddrawformat_from_wined3dformat(&ddfmt, desc.format);
if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE;
} }
} }
......
...@@ -30,26 +30,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw); ...@@ -30,26 +30,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
static void DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf); static void DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf);
/***************************************************************************** void ddrawformat_from_wined3dformat(DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_id wined3d_format)
* PixelFormat_WineD3DtoDD
*
* Converts an wined3d format ID into a DDPIXELFORMAT structure
*
* Params:
* DDPixelFormat: Address of the structure to write the pixel format to
* WineD3DFormat: Source format
*
*****************************************************************************/
void PixelFormat_WineD3DtoDD(DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_id WineD3DFormat)
{ {
DWORD Size = DDPixelFormat->dwSize; DWORD Size = DDPixelFormat->dwSize;
TRACE("Converting wined3d format %#x to DDRAW.\n", WineD3DFormat);
if(Size==0) return; if(Size==0) return;
memset(DDPixelFormat, 0x00, Size); memset(DDPixelFormat, 0x00, Size);
DDPixelFormat->dwSize = Size; DDPixelFormat->dwSize = Size;
switch(WineD3DFormat) switch (wined3d_format)
{ {
case WINED3DFMT_B8G8R8_UNORM: case WINED3DFMT_B8G8R8_UNORM:
DDPixelFormat->dwFlags = DDPF_RGB; DDPixelFormat->dwFlags = DDPF_RGB;
...@@ -247,13 +236,13 @@ void PixelFormat_WineD3DtoDD(DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_i ...@@ -247,13 +236,13 @@ void PixelFormat_WineD3DtoDD(DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_i
case WINED3DFMT_YUY2: case WINED3DFMT_YUY2:
DDPixelFormat->u1.dwYUVBitCount = 16; DDPixelFormat->u1.dwYUVBitCount = 16;
DDPixelFormat->dwFlags = DDPF_FOURCC; DDPixelFormat->dwFlags = DDPF_FOURCC;
DDPixelFormat->dwFourCC = WineD3DFormat; DDPixelFormat->dwFourCC = wined3d_format;
break; break;
case WINED3DFMT_YV12: case WINED3DFMT_YV12:
DDPixelFormat->u1.dwYUVBitCount = 12; DDPixelFormat->u1.dwYUVBitCount = 12;
DDPixelFormat->dwFlags = DDPF_FOURCC; DDPixelFormat->dwFlags = DDPF_FOURCC;
DDPixelFormat->dwFourCC = WineD3DFormat; DDPixelFormat->dwFourCC = wined3d_format;
break; break;
case WINED3DFMT_DXT1: case WINED3DFMT_DXT1:
...@@ -265,7 +254,7 @@ void PixelFormat_WineD3DtoDD(DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_i ...@@ -265,7 +254,7 @@ void PixelFormat_WineD3DtoDD(DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_i
case WINED3DFMT_G8R8_G8B8: case WINED3DFMT_G8R8_G8B8:
case WINED3DFMT_R8G8_B8G8: case WINED3DFMT_R8G8_B8G8:
DDPixelFormat->dwFlags = DDPF_FOURCC; DDPixelFormat->dwFlags = DDPF_FOURCC;
DDPixelFormat->dwFourCC = WineD3DFormat; DDPixelFormat->dwFourCC = wined3d_format;
break; break;
/* Luminance */ /* Luminance */
...@@ -341,7 +330,8 @@ void PixelFormat_WineD3DtoDD(DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_i ...@@ -341,7 +330,8 @@ void PixelFormat_WineD3DtoDD(DDPIXELFORMAT *DDPixelFormat, enum wined3d_format_i
break; break;
default: default:
ERR("Can't translate this Pixelformat %d\n", WineD3DFormat); FIXME("Unhandled wined3d format %#x.\n", wined3d_format);
break;
} }
if(TRACE_ON(ddraw)) { if(TRACE_ON(ddraw)) {
......
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