Commit 6e408c4f authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

- added ARGB 1555 format

- fixed refcount problem for Add/DeleteAttachedSurface
parent 1c79bbb1
...@@ -357,6 +357,16 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb, ...@@ -357,6 +357,16 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb,
return DD_OK; return DD_OK;
#endif #endif
TRACE("Enumerating GL_ARGB (no direct OpenGL equivalent - conversion needed)\n");
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
pformat->u.dwRGBBitCount = 16;
pformat->u1.dwRBitMask = 0x00007C00;
pformat->u2.dwGBitMask = 0x000003E0;
pformat->u3.dwBBitMask = 0x0000001F;
pformat->u4.dwRGBAlphaBitMask = 0x00008000;
if (cb(&sdesc, context) == 0)
return DD_OK;
TRACE("Enumerating Paletted (8)\n"); TRACE("Enumerating Paletted (8)\n");
pformat->dwFlags = DDPF_PALETTEINDEXED8; pformat->dwFlags = DDPF_PALETTEINDEXED8;
pformat->u.dwRGBBitCount = 8; pformat->u.dwRGBBitCount = 8;
......
...@@ -530,6 +530,28 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load( ...@@ -530,6 +530,28 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
GL_RGBA, GL_RGBA,
GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4,
src_d->u1.lpSurface); src_d->u1.lpSurface);
} else if (src_d->ddpfPixelFormat.u4.dwRGBAlphaBitMask == 0x00008000) {
/* Converting the 1555 format in 5551 packed */
WORD *surface = (WORD *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, src_d->dwWidth * src_d->dwHeight * sizeof(WORD));
DWORD i;
WORD *src = (WORD *) src_d->u1.lpSurface, *dst = surface;
for (i = 0; i < src_d->dwHeight * src_d->dwWidth; i++) {
*dst++ = (((*src & 0x8000) >> 15) |
((*src & 0x7FFF) << 1));
src++;
}
glTexImage2D(GL_TEXTURE_2D,
0,
GL_RGBA,
src_d->dwWidth, src_d->dwHeight,
0,
GL_RGBA,
GL_UNSIGNED_SHORT_5_5_5_1,
surface);
HeapFree(GetProcessHeap(), 0, surface);
} else { } else {
ERR("Unhandled texture format (bad Aplha channel for a 16 bit texture)\n"); ERR("Unhandled texture format (bad Aplha channel for a 16 bit texture)\n");
} }
......
...@@ -581,7 +581,10 @@ HRESULT WINAPI IDirectDrawSurface4Impl_GetAttachedSurface( ...@@ -581,7 +581,10 @@ HRESULT WINAPI IDirectDrawSurface4Impl_GetAttachedSurface(
if (!found) if (!found)
return DDERR_NOTFOUND; return DDERR_NOTFOUND;
*lpdsf = (LPDIRECTDRAWSURFACE4)chain->surfaces[found-1-xstart]; *lpdsf = (LPDIRECTDRAWSURFACE4)chain->surfaces[found-1-xstart];
/* FIXME: AddRef? */
/* For EverQuest testing */
IDirectDrawSurface4_AddRef(*lpdsf);
TRACE("found %p\n",*lpdsf); TRACE("found %p\n",*lpdsf);
return DD_OK; return DD_OK;
} }
...@@ -950,7 +953,8 @@ HRESULT WINAPI IDirectDrawSurface4Impl_DeleteAttachedSurface( ...@@ -950,7 +953,8 @@ HRESULT WINAPI IDirectDrawSurface4Impl_DeleteAttachedSurface(
chain = This->s.chain; chain = This->s.chain;
for (i=0;i<chain->nrofsurfaces;i++) { for (i=0;i<chain->nrofsurfaces;i++) {
if ((IDirectDrawSurface4Impl*)lpDDSAttachedSurface==chain->surfaces[i]){ if ((IDirectDrawSurface4Impl*)lpDDSAttachedSurface==chain->surfaces[i]){
IDirectDrawSurface4_Release(lpDDSAttachedSurface); /* There is no AddRef in AddAttachedSurface, so why a release here :-)
IDirectDrawSurface4_Release(lpDDSAttachedSurface); */
chain->surfaces[i]->s.chain = NULL; chain->surfaces[i]->s.chain = NULL;
memcpy( chain->surfaces+i, memcpy( chain->surfaces+i,
......
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