[PATCH] Use the render target its palette when performing a texture copy as the texture doesn't hold one.
Roderick Colenbrander
thunderbird2k at gmx.net
Thu Apr 3 17:45:28 CDT 2008
---
dlls/wined3d/surface.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ac4224e..33812b7 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3093,6 +3093,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
/* Blit from render target to texture */
WINED3DRECT srect;
BOOL upsideDown, stretchx;
+ BOOL paletteOverride = FALSE;
if(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) {
TRACE("Color keying not supported by frame buffer to texture blit\n");
@@ -3139,6 +3140,14 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
stretchx = FALSE;
}
+ /* When blitting from a render target a texture, the texture isn't required to have a palette.
+ * In this case grab the palette from the render target. */
+ if((This->resource.format == WINED3DFMT_P8) && (This->palette == NULL)) {
+ paletteOverride = TRUE;
+ TRACE("Source surface (%p) lacks palette, overriding palette with palette %p of destination surface (%p)\n", Src, This->palette, This);
+ This->palette = Src->palette;
+ }
+
/* Blt is a pretty powerful call, while glCopyTexSubImage2D is not. glCopyTexSubImage cannot
* flip the image nor scale it.
*
@@ -3166,6 +3175,10 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
fb_copy_to_texture_hwstretch(This, SrcSurface, srcSwapchain, &srect, &rect, upsideDown, Filter);
}
+ /* Clear the palette as the surface didn't have a palette attached, it would confuse GetPalette and other calls */
+ if(paletteOverride)
+ This->palette = NULL;
+
if(!(This->Flags & SFLAG_DONOTFREE)) {
HeapFree(GetProcessHeap(), 0, This->resource.heapMemory);
This->resource.allocatedMemory = NULL;
--
1.5.3.8
--========GMX7187120751046949679--
More information about the wine-patches
mailing list