Commit 9914a8ec authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

- only enumerate 32 bpp ARGB texture format and remove RGBA one

- add support for 32 bpp ARGB texture format
parent 5548822a
......@@ -385,6 +385,8 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
pformat->dwSize = sizeof(DDPIXELFORMAT);
pformat->dwFourCC = 0;
#if 0
/* See argument about the RGBA format for 'packed' texture formats */
TRACE("Enumerating GL_RGBA unpacked (32)\n");
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
pformat->u1.dwRGBBitCount = 32;
......@@ -394,6 +396,17 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
pformat->u5.dwRGBAlphaBitMask = 0x000000FF;
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
#endif
TRACE("Enumerating GL_RGBA unpacked (32)\n");
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
pformat->u1.dwRGBBitCount = 32;
pformat->u2.dwRBitMask = 0x00FF0000;
pformat->u3.dwGBitMask = 0x0000FF00;
pformat->u4.dwBBitMask = 0x000000FF;
pformat->u5.dwRGBAlphaBitMask = 0xFF000000;
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
TRACE("Enumerating GL_RGB unpacked (24)\n");
pformat->dwFlags = DDPF_RGB;
......
......@@ -386,6 +386,35 @@ gltex_upload_texture(IDirectDrawSurfaceImpl *This) {
} else if ((src_d->ddpfPixelFormat.u2.dwRBitMask == 0x00FF0000) &&
(src_d->ddpfPixelFormat.u3.dwGBitMask == 0x0000FF00) &&
(src_d->ddpfPixelFormat.u4.dwBBitMask == 0x000000FF) &&
(src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0xFF000000)) {
/* Convert from ARGB (Windows' format) to RGBA.
Note: need to check for GL extensions handling ARGB instead of always converting */
DWORD i;
DWORD *src = (DWORD *) src_d->lpSurface, *dst;
surface = (DWORD *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, src_d->dwWidth * src_d->dwHeight * sizeof(DWORD));
dst = (DWORD *) surface;
if (src_d->dwFlags & DDSD_CKSRCBLT) {
for (i = 0; i < src_d->dwHeight * src_d->dwWidth; i++) {
DWORD color = *src++;
*dst = (color & 0x00FFFFFF) << 8;
if ((color < src_d->ddckCKSrcBlt.dwColorSpaceLowValue) ||
(color > src_d->ddckCKSrcBlt.dwColorSpaceHighValue))
*dst |= (color & 0xFF000000) >> 24;
dst++;
}
} else {
for (i = 0; i < src_d->dwHeight * src_d->dwWidth; i++) {
DWORD color = *src++;
*dst = (color & 0x00FFFFFF) << 8;
*dst |= (color & 0xFF000000) >> 24;
}
}
format = GL_RGBA;
pixel_format = GL_UNSIGNED_INT_8_8_8_8;
} else if ((src_d->ddpfPixelFormat.u2.dwRBitMask == 0x00FF0000) &&
(src_d->ddpfPixelFormat.u3.dwGBitMask == 0x0000FF00) &&
(src_d->ddpfPixelFormat.u4.dwBBitMask == 0x000000FF) &&
(src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000000)) {
/* Just add an alpha component and handle color-keying... */
DWORD 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