From ee5d72b136fa4fa0ba2d52a6df63e6581a7b63ee Mon Sep 17 00:00:00 2001 From: Raphael Junqueira Date: Sat, 31 Dec 2005 13:13:34 +0100 Subject: [PATCH] wined3d: Added support for WINED3DFMT_X4R4G4B4. --- dlls/wined3d/directx.c | 3 +++ dlls/wined3d/surface.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index a0ae18297c4..b9178a157fe 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1073,6 +1073,9 @@ static BOOL IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(WineD3D_Context* c case WINED3DFMT_A1R5G5B5: if (5 == rb && 5 == gb && 5 == bb && 1 == ab) return TRUE; break; + case WINED3DFMT_X4R4G4B4: + if (16 == buf_sz && 4 == rb && 4 == gb && 4 == bb) return TRUE; + break; case WINED3DFMT_R5G6B5: if (5 == rb && 6 == gb && 5 == bb) return TRUE; break; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index e1711e6ad02..793f4e124dd 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -752,6 +752,25 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) { glRasterPos3i(This->lockedRect.left, This->lockedRect.top, 1); vcheckGLcall("glRasterPos2f"); switch (This->resource.format) { + case WINED3DFMT_X4R4G4B4: + { + int size; + unsigned short *data; + data = (unsigned short *)This->resource.allocatedMemory; + size = (This->lockedRect.bottom - This->lockedRect.top) * (This->lockedRect.right - This->lockedRect.left); + while(size > 0) { + *data |= 0xF000; + data++; + size--; + } + } + case WINED3DFMT_A4R4G4B4: + { + glDrawPixels(This->lockedRect.right - This->lockedRect.left, (This->lockedRect.bottom - This->lockedRect.top)-1, + GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, This->resource.allocatedMemory); + vcheckGLcall("glDrawPixels"); + } + break; case WINED3DFMT_R5G6B5: { glDrawPixels(This->lockedRect.right - This->lockedRect.left, (This->lockedRect.bottom - This->lockedRect.top)-1,