src/render/direct3d/SDL_render_d3d.c
changeset 8228 010ae1267485
parent 8224 32af2d3806d1
child 8255 49af9be342cd
equal deleted inserted replaced
8227:bd491250c87d 8228:010ae1267485
   215                                 const Uint8 *Uplane, int Upitch,
   215                                 const Uint8 *Uplane, int Upitch,
   216                                 const Uint8 *Vplane, int Vpitch);
   216                                 const Uint8 *Vplane, int Vpitch);
   217 static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   217 static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
   218                            const SDL_Rect * rect, void **pixels, int *pitch);
   218                            const SDL_Rect * rect, void **pixels, int *pitch);
   219 static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
   219 static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
       
   220 static int D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture);
   220 static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
   221 static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
   221 static int D3D_UpdateViewport(SDL_Renderer * renderer);
   222 static int D3D_UpdateViewport(SDL_Renderer * renderer);
   222 static int D3D_UpdateClipRect(SDL_Renderer * renderer);
   223 static int D3D_UpdateClipRect(SDL_Renderer * renderer);
   223 static int D3D_RenderClear(SDL_Renderer * renderer);
   224 static int D3D_RenderClear(SDL_Renderer * renderer);
   224 static int D3D_RenderDrawPoints(SDL_Renderer * renderer,
   225 static int D3D_RenderDrawPoints(SDL_Renderer * renderer,
   510         }
   511         }
   511     }
   512     }
   512 
   513 
   513     IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
   514     IDirect3DDevice9_GetRenderTarget(data->device, 0, &data->defaultRenderTarget);
   514     D3D_InitRenderState(data);
   515     D3D_InitRenderState(data);
   515     D3D_SetRenderTarget(renderer, renderer->target);
   516     D3D_SetRenderTargetInternal(renderer, renderer->target);
   516     D3D_UpdateViewport(renderer);
   517     D3D_UpdateViewport(renderer);
   517 
   518 
   518     /* Let the application know that render targets were reset */
   519     /* Let the application know that render targets were reset */
   519     {
   520     {
   520         SDL_Event event;
   521         SDL_Event event;
  1158         IDirect3DTexture9_UnlockRect(data->texture, 0);
  1159         IDirect3DTexture9_UnlockRect(data->texture, 0);
  1159     }
  1160     }
  1160 }
  1161 }
  1161 
  1162 
  1162 static int
  1163 static int
  1163 D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
  1164 D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture)
  1164 {
  1165 {
  1165     D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
  1166     D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
  1166     D3D_TextureData *texturedata;
  1167     D3D_TextureData *texturedata;
  1167     HRESULT result;
  1168     HRESULT result;
  1168 
       
  1169     D3D_ActivateRenderer(renderer);
       
  1170 
  1169 
  1171     /* Release the previous render target if it wasn't the default one */
  1170     /* Release the previous render target if it wasn't the default one */
  1172     if (data->currentRenderTarget != NULL) {
  1171     if (data->currentRenderTarget != NULL) {
  1173         IDirect3DSurface9_Release(data->currentRenderTarget);
  1172         IDirect3DSurface9_Release(data->currentRenderTarget);
  1174         data->currentRenderTarget = NULL;
  1173         data->currentRenderTarget = NULL;
  1193     if(FAILED(result)) {
  1192     if(FAILED(result)) {
  1194         return D3D_SetError("SetRenderTarget()", result);
  1193         return D3D_SetError("SetRenderTarget()", result);
  1195     }
  1194     }
  1196 
  1195 
  1197     return 0;
  1196     return 0;
       
  1197 }
       
  1198 
       
  1199 static int
       
  1200 D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
       
  1201 {
       
  1202     D3D_ActivateRenderer(renderer);
       
  1203 
       
  1204     return D3D_SetRenderTargetInternal(renderer, texture);
  1198 }
  1205 }
  1199 
  1206 
  1200 static int
  1207 static int
  1201 D3D_UpdateViewport(SDL_Renderer * renderer)
  1208 D3D_UpdateViewport(SDL_Renderer * renderer)
  1202 {
  1209 {