ChangeSet ID: 21255 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/11/14 06:27:55
Modified files: dlls/ddraw : surface_main.c
Log message: Lionel Ulmer lionel.ulmer@free.fr Use the front buffer palette for DC operations on off-screen buffers.
Patch: http://cvs.winehq.org/patch.py?id=21255
Old revision New revision Changes Path 1.8 1.9 +25 -0 wine/dlls/ddraw/surface_main.c
Index: wine/dlls/ddraw/surface_main.c diff -u -p wine/dlls/ddraw/surface_main.c:1.8 wine/dlls/ddraw/surface_main.c:1.9 --- wine/dlls/ddraw/surface_main.c:1.8 14 Nov 2005 12:27:55 -0000 +++ wine/dlls/ddraw/surface_main.c 14 Nov 2005 12:27:55 -0000 @@ -900,6 +900,31 @@ Main_DirectDrawSurface_GetDC(LPDIRECTDRA }
hr = This->get_dc(This, &This->hDC); + + if ((This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) && + (This->palette == NULL)) { + IDirectDrawImpl *ddraw = This->ddraw_owner; + IDirectDrawSurfaceImpl *surf; + + for (surf = ddraw->surfaces; surf != NULL; surf = surf->next_ddraw) { + if (((surf->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER)) == (DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER)) && + (surf->palette != NULL)) { + RGBQUAD col[256]; + IDirectDrawPaletteImpl *pal = surf->palette; + unsigned int n; + for (n=0; n<256; n++) { + col[n].rgbRed = pal->palents[n].peRed; + col[n].rgbGreen = pal->palents[n].peGreen; + col[n].rgbBlue = pal->palents[n].peBlue; + col[n].rgbReserved = 0; + } + SetDIBColorTable(This->hDC, 0, 256, col); + break; + } + } + + } + if (SUCCEEDED(hr)) { TRACE("returning %p\n",This->hDC);