Fixed infinite recursion in D3D_Reset()

Sam Lantinga 2014-02-20 21:07:56 -08:00
parent ea71a5e074
commit 22e3217e59
1 changed files with 11 additions and 4 deletions

View File

@ -217,6 +217,7 @@ static int D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, void **pixels, int *pitch);
static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture);
static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
static int D3D_UpdateViewport(SDL_Renderer * renderer);
static int D3D_UpdateClipRect(SDL_Renderer * renderer);
@ -512,7 +513,7 @@ D3D_Reset(SDL_Renderer * renderer)
IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
D3D_InitRenderState(data);
D3D_SetRenderTarget(renderer, renderer->target);
D3D_SetRenderTargetInternal(renderer, renderer->target);
D3D_UpdateViewport(renderer);
/* Let the application know that render targets were reset */
@ -1160,14 +1161,12 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
static int
D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture)
{
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
D3D_TextureData *texturedata;
HRESULT result;
D3D_ActivateRenderer(renderer);
/* Release the previous render target if it wasn't the default one */
if (data->currentRenderTarget != NULL) {
IDirect3DSurface9_Release(data->currentRenderTarget);
@ -1197,6 +1196,14 @@ D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
return 0;
}
static int
D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
{
D3D_ActivateRenderer(renderer);
return D3D_SetRenderTargetInternal(renderer, texture);
}
static int
D3D_UpdateViewport(SDL_Renderer * renderer)
{