Fixed infinite recursion in D3D_Reset()
authorSam Lantinga <slouken@libsdl.org>
Thu, 20 Feb 2014 21:07:56 -0800
changeset 8228010ae1267485
parent 8227 bd491250c87d
child 8229 437c4e5961e0
Fixed infinite recursion in D3D_Reset()
src/render/direct3d/SDL_render_d3d.c
     1.1 --- a/src/render/direct3d/SDL_render_d3d.c	Thu Feb 20 17:03:55 2014 -0300
     1.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Thu Feb 20 21:07:56 2014 -0800
     1.3 @@ -217,6 +217,7 @@
     1.4  static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
     1.5                             const SDL_Rect * rect, void **pixels, int *pitch);
     1.6  static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     1.7 +static int D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture);
     1.8  static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
     1.9  static int D3D_UpdateViewport(SDL_Renderer * renderer);
    1.10  static int D3D_UpdateClipRect(SDL_Renderer * renderer);
    1.11 @@ -512,7 +513,7 @@
    1.12  
    1.13      IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
    1.14      D3D_InitRenderState(data);
    1.15 -    D3D_SetRenderTarget(renderer, renderer->target);
    1.16 +    D3D_SetRenderTargetInternal(renderer, renderer->target);
    1.17      D3D_UpdateViewport(renderer);
    1.18  
    1.19      /* Let the application know that render targets were reset */
    1.20 @@ -1160,14 +1161,12 @@
    1.21  }
    1.22  
    1.23  static int
    1.24 -D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
    1.25 +D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture)
    1.26  {
    1.27      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
    1.28      D3D_TextureData *texturedata;
    1.29      HRESULT result;
    1.30  
    1.31 -    D3D_ActivateRenderer(renderer);
    1.32 -
    1.33      /* Release the previous render target if it wasn't the default one */
    1.34      if (data->currentRenderTarget != NULL) {
    1.35          IDirect3DSurface9_Release(data->currentRenderTarget);
    1.36 @@ -1198,6 +1197,14 @@
    1.37  }
    1.38  
    1.39  static int
    1.40 +D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
    1.41 +{
    1.42 +    D3D_ActivateRenderer(renderer);
    1.43 +
    1.44 +    return D3D_SetRenderTargetInternal(renderer, texture);
    1.45 +}
    1.46 +
    1.47 +static int
    1.48  D3D_UpdateViewport(SDL_Renderer * renderer)
    1.49  {
    1.50      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;