Commit 61c82f80 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wined3d: Add a GDI version of RealizePalette.

The base version won't suffice anymore as it is not able to upload palette changes to the drawable in an efficient way for both GDI and GL. Further the LoadLocation code in RealizePalette isn't needed for the GDI version as in all cases it works on system memory.
parent 448ede1a
......@@ -631,6 +631,41 @@ HRESULT WINAPI IWineGDISurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) {
return WINED3D_OK;
}
HRESULT WINAPI IWineGDISurfaceImpl_RealizePalette(IWineD3DSurface *iface) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
RGBQUAD col[256];
IWineD3DPaletteImpl *pal = This->palette;
unsigned int n;
TRACE("(%p)\n", This);
if(This->Flags & SFLAG_DIBSECTION) {
TRACE("(%p): Updating the hdc's palette\n", This);
for (n=0; n<256; n++) {
if(pal) {
col[n].rgbRed = pal->palents[n].peRed;
col[n].rgbGreen = pal->palents[n].peGreen;
col[n].rgbBlue = pal->palents[n].peBlue;
} else {
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
/* Use the default device palette */
col[n].rgbRed = device->palettes[device->currentPalette][n].peRed;
col[n].rgbGreen = device->palettes[device->currentPalette][n].peGreen;
col[n].rgbBlue = device->palettes[device->currentPalette][n].peBlue;
}
col[n].rgbReserved = 0;
}
SetDIBColorTable(This->hDC, 0, 256, col);
}
/* Update the image because of the palette change. Some games like e.g Red Alert
* call SetEntries a lot to implement fading.
*/
if(This->resource.usage & WINED3DUSAGE_RENDERTARGET)
x11_copy_to_screen(This, NULL);
return WINED3D_OK;
}
/*****************************************************************************
* IWineD3DSurface::PrivateSetup, GDI version
*
......@@ -808,7 +843,7 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
IWineD3DBaseSurfaceImpl_BltFast,
IWineD3DBaseSurfaceImpl_GetPalette,
IWineD3DBaseSurfaceImpl_SetPalette,
IWineD3DBaseSurfaceImpl_RealizePalette,
IWineGDISurfaceImpl_RealizePalette,
IWineD3DBaseSurfaceImpl_SetColorKey,
IWineD3DBaseSurfaceImpl_GetPitch,
IWineGDISurfaceImpl_SetMem,
......
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