- added ARGB 1555 format

- fixed refcount problem for Add/DeleteAttachedSurface
This commit is contained in:
Lionel Ulmer 2000-08-28 19:31:18 +00:00 committed by Alexandre Julliard
parent 1c79bbb13d
commit 6e408c4f16
3 changed files with 38 additions and 2 deletions

View file

@ -357,6 +357,16 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb,
return DD_OK;
#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");
pformat->dwFlags = DDPF_PALETTEINDEXED8;
pformat->u.dwRGBBitCount = 8;

View file

@ -530,6 +530,28 @@ HRESULT WINAPI IDirect3DTexture2Impl_Load(
GL_RGBA,
GL_UNSIGNED_SHORT_4_4_4_4,
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 {
ERR("Unhandled texture format (bad Aplha channel for a 16 bit texture)\n");
}

View file

@ -581,7 +581,10 @@ HRESULT WINAPI IDirectDrawSurface4Impl_GetAttachedSurface(
if (!found)
return DDERR_NOTFOUND;
*lpdsf = (LPDIRECTDRAWSURFACE4)chain->surfaces[found-1-xstart];
/* FIXME: AddRef? */
/* For EverQuest testing */
IDirectDrawSurface4_AddRef(*lpdsf);
TRACE("found %p\n",*lpdsf);
return DD_OK;
}
@ -950,7 +953,8 @@ HRESULT WINAPI IDirectDrawSurface4Impl_DeleteAttachedSurface(
chain = This->s.chain;
for (i=0;i<chain->nrofsurfaces;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;
memcpy( chain->surfaces+i,