Skip to content
Snippets Groups Projects
Commit 0948ed70 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard
Browse files

Fixed colorkey conversion.

Handle null surface pointer when creating surface.
parent fa4036eb
No related branches found
No related tags found
No related merge requests found
......@@ -658,6 +658,12 @@ Main_DirectDraw_CreateSurface(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
pDDSD->dwFlags &= ~DDSD_LPSURFACE;
}
if ((pDDSD->dwFlags & DDSD_LPSURFACE) && (pDDSD->lpSurface == NULL)) {
/* Frank Herbert's Dune specifies a null pointer for the surface, ignore the LPSURFACE field */
WARN("Null surface pointer specified, ignore it!\n");
pDDSD->dwFlags &= ~DDSD_LPSURFACE;
}
if (ppSurf == NULL) {
FIXME("You want to get back a surface? Don't give NULL ptrs!\n");
return E_POINTER; /* unchecked */
......
......@@ -1195,7 +1195,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
unsigned int x, y;
BYTE *src = (BYTE *) (((BYTE *) src_d->lpSurface) + (bpp * rect->left) + (src_d->u1.lPitch * rect->top));
DWORD *dst;
if (*temp_buffer == NULL)
*temp_buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
current_tex_width * current_tex_height * sizeof(DWORD));
......@@ -1205,7 +1205,7 @@ HRESULT upload_surface_to_tex_memory(RECT *rect, DWORD xoffset, DWORD yoffset, v
for (x = 0; x < width; x++) {
DWORD color = *((DWORD *) src) & 0x00FFFFFF;
src += 3;
*dst = *src++ << 8;
*dst = color << 8;
if ((color < src_d->ddckCKSrcBlt.dwColorSpaceLowValue) ||
(color > src_d->ddckCKSrcBlt.dwColorSpaceHighValue))
*dst |= 0xFF;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment