From: Henri Verbeet hverbeet@locutus.nl
--- dlls/quartz/vmr7_presenter.c | 51 ++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 20 deletions(-)
diff --git a/dlls/quartz/vmr7_presenter.c b/dlls/quartz/vmr7_presenter.c index 90a0b906610..1abee7b957d 100644 --- a/dlls/quartz/vmr7_presenter.c +++ b/dlls/quartz/vmr7_presenter.c @@ -187,29 +187,40 @@ static HRESULT WINAPI surface_allocator_AllocateSurface(IVMRSurfaceAllocator *if surface_desc.ddsCaps.dwCaps = DDSCAPS_FLIP | DDSCAPS_COMPLEX | DDSCAPS_OFFSCREENPLAIN; surface_desc.dwBackBufferCount = *count;
- if (info->lpHdr->biCompression == BI_RGB) + if (info->lpHdr->biCompression == BI_RGB || info->lpHdr->biCompression == BI_BITFIELDS) { - if (info->lpHdr->biBitCount != 32) - { - FIXME("Unhandled bit depth %u.\n", info->lpHdr->biBitCount); - return E_NOTIMPL; - } + DDSURFACEDESC2 primary_desc; + DWORD *mask;
- surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; - surface_desc.ddpfPixelFormat.dwRGBBitCount = 32; - surface_desc.ddpfPixelFormat.dwRBitMask = 0x00ff0000; - surface_desc.ddpfPixelFormat.dwGBitMask = 0x0000ff00; - surface_desc.ddpfPixelFormat.dwBBitMask = 0x000000ff; - } - else if (info->lpHdr->biCompression == BI_BITFIELDS) - { - const DWORD *mask = (DWORD *)((BITMAPINFO *)info->lpHdr)->bmiColors; + primary_desc.dwSize = sizeof(primary_desc); + if (FAILED(hr = IDirectDrawSurface7_GetSurfaceDesc(presenter->primary, &primary_desc))) + return hr; + if (info->lpHdr->biBitCount != primary_desc.ddpfPixelFormat.dwRGBBitCount) + return E_FAIL;
- surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; - surface_desc.ddpfPixelFormat.dwRGBBitCount = info->lpHdr->biBitCount; - surface_desc.ddpfPixelFormat.dwRBitMask = mask[0]; - surface_desc.ddpfPixelFormat.dwGBitMask = mask[1]; - surface_desc.ddpfPixelFormat.dwBBitMask = mask[2]; + if (info->lpHdr->biCompression == BI_RGB) + { + if (info->lpHdr->biBitCount != 32) + { + FIXME("Unhandled bit depth %u.\n", info->lpHdr->biBitCount); + return E_NOTIMPL; + } + + surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; + surface_desc.ddpfPixelFormat.dwRGBBitCount = 32; + surface_desc.ddpfPixelFormat.dwRBitMask = 0x00ff0000; + surface_desc.ddpfPixelFormat.dwGBitMask = 0x0000ff00; + surface_desc.ddpfPixelFormat.dwBBitMask = 0x000000ff; + } + else + { + mask = (DWORD *)((BITMAPINFO *)info->lpHdr)->bmiColors; + surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; + surface_desc.ddpfPixelFormat.dwRGBBitCount = info->lpHdr->biBitCount; + surface_desc.ddpfPixelFormat.dwRBitMask = mask[0]; + surface_desc.ddpfPixelFormat.dwGBitMask = mask[1]; + surface_desc.ddpfPixelFormat.dwBBitMask = mask[2]; + } } else {