Module: wine Branch: master Commit: 0efefef34b7e0eae68d90683a2cd8f1d3d94ed7e URL: http://source.winehq.org/git/wine.git/?a=commit;h=0efefef34b7e0eae68d90683a2...
Author: Roderick Colenbrander thunderbird2k@gmx.net Date: Thu Apr 3 22:45:28 2008 +0000
wined3d: Use the render target its palette when performing a texture copy as the texture doesn't hold one.
---
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;