Renamed SetTargetTexture() to SetRenderTarget()
authorSam Lantinga <slouken@libsdl.org>
Sun, 22 Jan 2012 01:26:28 -0500
changeset 6247b6212690f78d
parent 6246 c70ec935a4bb
child 6248 7fe4b2b78acc
Renamed SetTargetTexture() to SetRenderTarget()
include/SDL_render.h
src/render/SDL_render.c
src/render/SDL_sysrender.h
src/render/direct3d/SDL_render_d3d.c
src/render/opengl/SDL_render_gl.c
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
src/render/software/SDL_render_sw.c
test/testrendertarget.c
     1.1 --- a/include/SDL_render.h	Sat Jan 21 22:22:30 2012 -0500
     1.2 +++ b/include/SDL_render.h	Sun Jan 22 01:26:28 2012 -0500
     1.3 @@ -373,6 +373,25 @@
     1.4  extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture);
     1.5  
     1.6  /**
     1.7 + * \brief Determines whether a window supports the use of render targets
     1.8 + *
     1.9 + * \param renderer The renderer that will be checked
    1.10 + *
    1.11 + * \return SDL_TRUE if supported, SDL_FALSE if not.
    1.12 + */
    1.13 +extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
    1.14 +
    1.15 +/**
    1.16 + * \brief Set a texture as the current rendering target.
    1.17 + *
    1.18 + * \param texture The targeted texture, or NULL for the default render target
    1.19 + *
    1.20 + * \return 0 on success, or -1 on error
    1.21 + */
    1.22 +extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer,
    1.23 +                                                SDL_Texture *texture);
    1.24 +
    1.25 +/**
    1.26   *  \brief Set the drawing area for rendering on the current target.
    1.27   *
    1.28   *  \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
    1.29 @@ -566,30 +585,6 @@
    1.30  
    1.31  
    1.32  /**
    1.33 - * \fn SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer)
    1.34 - *
    1.35 - * \brief Determines whether a window supports the use of render targets
    1.36 - *
    1.37 - * \param renderer The renderer that will be checked
    1.38 - *
    1.39 - * \return SDL_TRUE if supported, SDL_FALSE if not.
    1.40 - */
    1.41 -extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer);
    1.42 -
    1.43 -/**
    1.44 - * \fn int SDL_SetTargetTexture(SDL_Renderer *renderer, SDL_Texture *texture)
    1.45 - *
    1.46 - * \brief Set a texture as the current rendering target.
    1.47 - *
    1.48 - * \param renderer The renderer that will be checked
    1.49 - *
    1.50 - * \param texture The targeted texture, or NULL for the default render target
    1.51 - *
    1.52 - * \return 0 on success, or -1 if there is no rendering context current, or the driver doesn't support the requested operation.
    1.53 - */
    1.54 -extern DECLSPEC int SDLCALL SDL_SetTargetTexture(SDL_Renderer *renderer, SDL_Texture *texture);
    1.55 -
    1.56 -/**
    1.57   *  \brief Read pixels from the current rendering target.
    1.58   *  
    1.59   *  \param rect   A pointer to the rectangle to read, or NULL for the entire 
     2.1 --- a/src/render/SDL_render.c	Sat Jan 21 22:22:30 2012 -0500
     2.2 +++ b/src/render/SDL_render.c	Sun Jan 22 01:26:28 2012 -0500
     2.3 @@ -804,14 +804,14 @@
     2.4  SDL_bool
     2.5  SDL_RenderTargetSupported(SDL_Renderer *renderer)
     2.6  {
     2.7 -    if (!renderer || !renderer->SetTargetTexture) {
     2.8 +    if (!renderer || !renderer->SetRenderTarget) {
     2.9          return SDL_FALSE;
    2.10      }
    2.11      return (renderer->info.flags & SDL_RENDERER_TARGETTEXTURE) != 0;
    2.12  }
    2.13  
    2.14  int
    2.15 -SDL_SetTargetTexture(SDL_Renderer *renderer, SDL_Texture *texture)
    2.16 +SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
    2.17  {
    2.18      SDL_Rect viewport;
    2.19  
    2.20 @@ -847,7 +847,7 @@
    2.21      }
    2.22      renderer->target = texture;
    2.23  
    2.24 -    if (renderer->SetTargetTexture(renderer, texture) < 0) {
    2.25 +    if (renderer->SetRenderTarget(renderer, texture) < 0) {
    2.26          return -1;
    2.27      }
    2.28  
     3.1 --- a/src/render/SDL_sysrender.h	Sat Jan 21 22:22:30 2012 -0500
     3.2 +++ b/src/render/SDL_sysrender.h	Sun Jan 22 01:26:28 2012 -0500
     3.3 @@ -77,7 +77,7 @@
     3.4      int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
     3.5                          const SDL_Rect * rect, void **pixels, int *pitch);
     3.6      void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
     3.7 -    int (*SetTargetTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
     3.8 +    int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture);
     3.9      int (*UpdateViewport) (SDL_Renderer * renderer);
    3.10      int (*RenderClear) (SDL_Renderer * renderer);
    3.11      int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
     4.1 --- a/src/render/direct3d/SDL_render_d3d.c	Sat Jan 21 22:22:30 2012 -0500
     4.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Sun Jan 22 01:26:28 2012 -0500
     4.3 @@ -99,7 +99,7 @@
     4.4  static int D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
     4.5                             const SDL_Rect * rect, void **pixels, int *pitch);
     4.6  static void D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     4.7 -static int D3D_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     4.8 +static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
     4.9  static int D3D_UpdateViewport(SDL_Renderer * renderer);
    4.10  static int D3D_RenderClear(SDL_Renderer * renderer);
    4.11  static int D3D_RenderDrawPoints(SDL_Renderer * renderer,
    4.12 @@ -388,7 +388,7 @@
    4.13      renderer->UpdateTexture = D3D_UpdateTexture;
    4.14      renderer->LockTexture = D3D_LockTexture;
    4.15      renderer->UnlockTexture = D3D_UnlockTexture;
    4.16 -    renderer->SetTargetTexture = D3D_SetTargetTexture;
    4.17 +    renderer->SetRenderTarget = D3D_SetRenderTarget;
    4.18      renderer->UpdateViewport = D3D_UpdateViewport;
    4.19      renderer->RenderClear = D3D_RenderClear;
    4.20      renderer->RenderDrawPoints = D3D_RenderDrawPoints;
    4.21 @@ -734,7 +734,7 @@
    4.22  }
    4.23  
    4.24  static int
    4.25 -D3D_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture)
    4.26 +D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
    4.27  {
    4.28      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
    4.29      D3D_TextureData *texturedata;
     5.1 --- a/src/render/opengl/SDL_render_gl.c	Sat Jan 21 22:22:30 2012 -0500
     5.2 +++ b/src/render/opengl/SDL_render_gl.c	Sun Jan 22 01:26:28 2012 -0500
     5.3 @@ -54,7 +54,7 @@
     5.4  static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
     5.5                            const SDL_Rect * rect, void **pixels, int *pitch);
     5.6  static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     5.7 -static int GL_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     5.8 +static int GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
     5.9  static int GL_UpdateViewport(SDL_Renderer * renderer);
    5.10  static int GL_RenderClear(SDL_Renderer * renderer);
    5.11  static int GL_RenderDrawPoints(SDL_Renderer * renderer,
    5.12 @@ -307,7 +307,7 @@
    5.13      renderer->UpdateTexture = GL_UpdateTexture;
    5.14      renderer->LockTexture = GL_LockTexture;
    5.15      renderer->UnlockTexture = GL_UnlockTexture;
    5.16 -    renderer->SetTargetTexture = GL_SetTargetTexture;
    5.17 +    renderer->SetRenderTarget = GL_SetRenderTarget;
    5.18      renderer->UpdateViewport = GL_UpdateViewport;
    5.19      renderer->RenderClear = GL_RenderClear;
    5.20      renderer->RenderDrawPoints = GL_RenderDrawPoints;
    5.21 @@ -707,7 +707,7 @@
    5.22  }
    5.23  
    5.24  static int
    5.25 -GL_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture)
    5.26 +GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
    5.27  {
    5.28      GL_RenderData *data = (GL_RenderData *) renderer->driverdata;    
    5.29      GL_TextureData *texturedata;
     6.1 --- a/src/render/opengles/SDL_render_gles.c	Sat Jan 21 22:22:30 2012 -0500
     6.2 +++ b/src/render/opengles/SDL_render_gles.c	Sun Jan 22 01:26:28 2012 -0500
     6.3 @@ -56,7 +56,7 @@
     6.4                              const SDL_Rect * rect, void **pixels, int *pitch);
     6.5  static void GLES_UnlockTexture(SDL_Renderer * renderer,
     6.6                                 SDL_Texture * texture);
     6.7 -static int GLES_SetTargetTexture(SDL_Renderer * renderer,
     6.8 +static int GLES_SetRenderTarget(SDL_Renderer * renderer,
     6.9                                   SDL_Texture * texture);
    6.10  static int GLES_UpdateViewport(SDL_Renderer * renderer);
    6.11  static int GLES_RenderClear(SDL_Renderer * renderer);
    6.12 @@ -295,7 +295,7 @@
    6.13      renderer->UpdateTexture = GLES_UpdateTexture;
    6.14      renderer->LockTexture = GLES_LockTexture;
    6.15      renderer->UnlockTexture = GLES_UnlockTexture;
    6.16 -    renderer->SetTargetTexture = GLES_SetTargetTexture;
    6.17 +    renderer->SetRenderTarget = GLES_SetRenderTarget;
    6.18      renderer->UpdateViewport = GLES_UpdateViewport;
    6.19      renderer->RenderClear = GLES_RenderClear;
    6.20      renderer->RenderDrawPoints = GLES_RenderDrawPoints;
    6.21 @@ -575,7 +575,7 @@
    6.22  }
    6.23  
    6.24  static int
    6.25 -GLES_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture)
    6.26 +GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
    6.27  {
    6.28      GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
    6.29      GLES_TextureData *texturedata = NULL;
     7.1 --- a/src/render/opengles2/SDL_render_gles2.c	Sat Jan 21 22:22:30 2012 -0500
     7.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Sun Jan 22 01:26:28 2012 -0500
     7.3 @@ -327,7 +327,7 @@
     7.4  static void GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture);
     7.5  static int GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect,
     7.6                                 const void *pixels, int pitch);
     7.7 -static int GLES2_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     7.8 +static int GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
     7.9  
    7.10  static GLenum
    7.11  GetScaleQuality(void)
    7.12 @@ -533,7 +533,7 @@
    7.13  }
    7.14  
    7.15  static int
    7.16 -GLES2_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture)
    7.17 +GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
    7.18  {
    7.19      GLES2_DriverContext *data = (GLES2_DriverContext *) renderer->driverdata;
    7.20      GLES2_TextureData *texturedata = NULL;
    7.21 @@ -1489,7 +1489,7 @@
    7.22      renderer->UpdateTexture       = &GLES2_UpdateTexture;
    7.23      renderer->LockTexture         = &GLES2_LockTexture;
    7.24      renderer->UnlockTexture       = &GLES2_UnlockTexture;
    7.25 -    renderer->SetTargetTexture    = &GLES2_SetTargetTexture;
    7.26 +    renderer->SetRenderTarget     = &GLES2_SetRenderTarget;
    7.27      renderer->UpdateViewport      = &GLES2_UpdateViewport;
    7.28      renderer->RenderClear         = &GLES2_RenderClear;
    7.29      renderer->RenderDrawPoints    = &GLES2_RenderDrawPoints;
     8.1 --- a/src/render/software/SDL_render_sw.c	Sat Jan 21 22:22:30 2012 -0500
     8.2 +++ b/src/render/software/SDL_render_sw.c	Sun Jan 22 01:26:28 2012 -0500
     8.3 @@ -51,7 +51,7 @@
     8.4  static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
     8.5                            const SDL_Rect * rect, void **pixels, int *pitch);
     8.6  static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     8.7 -static int SW_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     8.8 +static int SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
     8.9  static int SW_UpdateViewport(SDL_Renderer * renderer);
    8.10  static int SW_RenderClear(SDL_Renderer * renderer);
    8.11  static int SW_RenderDrawPoints(SDL_Renderer * renderer,
    8.12 @@ -145,7 +145,7 @@
    8.13      renderer->UpdateTexture = SW_UpdateTexture;
    8.14      renderer->LockTexture = SW_LockTexture;
    8.15      renderer->UnlockTexture = SW_UnlockTexture;
    8.16 -    renderer->SetTargetTexture = SW_SetTargetTexture;
    8.17 +    renderer->SetRenderTarget = SW_SetRenderTarget;
    8.18      renderer->UpdateViewport = SW_UpdateViewport;
    8.19      renderer->RenderClear = SW_RenderClear;
    8.20      renderer->RenderDrawPoints = SW_RenderDrawPoints;
    8.21 @@ -283,7 +283,7 @@
    8.22  }
    8.23  
    8.24  static int
    8.25 -SW_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture)
    8.26 +SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
    8.27  {
    8.28      SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
    8.29  
     9.1 --- a/test/testrendertarget.c	Sat Jan 21 22:22:30 2012 -0500
     9.2 +++ b/test/testrendertarget.c	Sun Jan 22 01:26:28 2012 -0500
     9.3 @@ -99,7 +99,7 @@
     9.4      SDL_RenderGetViewport(s->renderer, &viewport);
     9.5  
     9.6      target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h);
     9.7 -    SDL_SetTargetTexture(s->renderer, target);
     9.8 +    SDL_SetRenderTarget(s->renderer, target);
     9.9  
    9.10      /* Draw the background */
    9.11      SDL_RenderCopy(s->renderer, s->background, NULL, NULL);
    9.12 @@ -121,7 +121,7 @@
    9.13  
    9.14      SDL_RenderCopy(s->renderer, s->sprite, NULL, &s->sprite_rect);
    9.15  
    9.16 -    SDL_SetTargetTexture(s->renderer, NULL);
    9.17 +    SDL_SetRenderTarget(s->renderer, NULL);
    9.18      SDL_RenderCopy(s->renderer, target, NULL, NULL);
    9.19      SDL_DestroyTexture(target);
    9.20