wined3d: Don't use device palettes in RealizePalette.
This commit is contained in:
parent
13ce219235
commit
9b913b3b79
|
@ -3574,6 +3574,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface) {
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
TRACE("(%p)\n", This);
|
TRACE("(%p)\n", This);
|
||||||
|
|
||||||
|
if (!pal) return WINED3D_OK;
|
||||||
|
|
||||||
if(This->resource.format == WINED3DFMT_P8 ||
|
if(This->resource.format == WINED3DFMT_P8 ||
|
||||||
This->resource.format == WINED3DFMT_A8P8)
|
This->resource.format == WINED3DFMT_A8P8)
|
||||||
{
|
{
|
||||||
|
@ -3588,26 +3590,17 @@ HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface) {
|
||||||
if(This->Flags & SFLAG_DIBSECTION) {
|
if(This->Flags & SFLAG_DIBSECTION) {
|
||||||
TRACE("(%p): Updating the hdc's palette\n", This);
|
TRACE("(%p): Updating the hdc's palette\n", This);
|
||||||
for (n=0; n<256; n++) {
|
for (n=0; n<256; n++) {
|
||||||
if(pal) {
|
col[n].rgbRed = pal->palents[n].peRed;
|
||||||
col[n].rgbRed = pal->palents[n].peRed;
|
col[n].rgbGreen = pal->palents[n].peGreen;
|
||||||
col[n].rgbGreen = pal->palents[n].peGreen;
|
col[n].rgbBlue = pal->palents[n].peBlue;
|
||||||
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;
|
col[n].rgbReserved = 0;
|
||||||
}
|
}
|
||||||
SetDIBColorTable(This->hDC, 0, 256, col);
|
SetDIBColorTable(This->hDC, 0, 256, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Propagate the changes to the drawable when we have a palette. This function is also called
|
/* Propagate the changes to the drawable when we have a palette.
|
||||||
* when the palette is removed.
|
|
||||||
* TODO: in case of hardware p8 palettes we should only upload the palette. */
|
* TODO: in case of hardware p8 palettes we should only upload the palette. */
|
||||||
if(pal && (This->resource.usage & WINED3DUSAGE_RENDERTARGET))
|
if(This->resource.usage & WINED3DUSAGE_RENDERTARGET)
|
||||||
IWineD3DSurface_LoadLocation(iface, SFLAG_INDRAWABLE, NULL);
|
IWineD3DSurface_LoadLocation(iface, SFLAG_INDRAWABLE, NULL);
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
|
|
|
@ -635,30 +635,22 @@ HRESULT WINAPI IWineGDISurfaceImpl_RealizePalette(IWineD3DSurface *iface) {
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
TRACE("(%p)\n", This);
|
TRACE("(%p)\n", This);
|
||||||
|
|
||||||
|
if (!pal) return WINED3D_OK;
|
||||||
|
|
||||||
if(This->Flags & SFLAG_DIBSECTION) {
|
if(This->Flags & SFLAG_DIBSECTION) {
|
||||||
TRACE("(%p): Updating the hdc's palette\n", This);
|
TRACE("(%p): Updating the hdc's palette\n", This);
|
||||||
for (n=0; n<256; n++) {
|
for (n=0; n<256; n++) {
|
||||||
if(pal) {
|
col[n].rgbRed = pal->palents[n].peRed;
|
||||||
col[n].rgbRed = pal->palents[n].peRed;
|
col[n].rgbGreen = pal->palents[n].peGreen;
|
||||||
col[n].rgbGreen = pal->palents[n].peGreen;
|
col[n].rgbBlue = pal->palents[n].peBlue;
|
||||||
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;
|
col[n].rgbReserved = 0;
|
||||||
}
|
}
|
||||||
SetDIBColorTable(This->hDC, 0, 256, col);
|
SetDIBColorTable(This->hDC, 0, 256, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the image because of the palette change. Note that this function is also
|
/* Update the image because of the palette change. Some games like e.g Red Alert
|
||||||
* called on a palette removal. In such a case we don't have to update the screen.
|
call SetEntries a lot to implement fading. */
|
||||||
* Some games like e.g Red Alert call SetEntries a lot to implement fading.
|
if(This->resource.usage & WINED3DUSAGE_RENDERTARGET)
|
||||||
*/
|
|
||||||
if(pal && This->resource.usage & WINED3DUSAGE_RENDERTARGET)
|
|
||||||
x11_copy_to_screen(This, NULL);
|
x11_copy_to_screen(This, NULL);
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
|
|
Loading…
Reference in New Issue