diff options
author | Sam Lantinga <slouken@libsdl.org> | 2012-01-22 01:26:28 -0500 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2012-01-22 01:26:28 -0500 |
commit | b52857ee96c2554ebd85ea998862aabfe7a204ae (patch) | |
tree | 94157e67430620820ab43abc6d404a3df1cc6d90 | |
parent | dff2ecc869b0ad6bc8458f07cce63c86cc5063da (diff) |
Renamed SetTargetTexture() to SetRenderTarget()
-rw-r--r-- | include/SDL_render.h | 43 | ||||
-rwxr-xr-x | src/render/SDL_render.c | 6 | ||||
-rwxr-xr-x | src/render/SDL_sysrender.h | 2 | ||||
-rwxr-xr-x | src/render/direct3d/SDL_render_d3d.c | 6 | ||||
-rwxr-xr-x | src/render/opengl/SDL_render_gl.c | 6 | ||||
-rwxr-xr-x | src/render/opengles/SDL_render_gles.c | 6 | ||||
-rwxr-xr-x | src/render/opengles2/SDL_render_gles2.c | 6 | ||||
-rwxr-xr-x | src/render/software/SDL_render_sw.c | 6 | ||||
-rw-r--r-- | test/testrendertarget.c | 4 |
9 files changed, 40 insertions, 45 deletions
diff --git a/include/SDL_render.h b/include/SDL_render.h index 416f4c80..2d413df5 100644 --- a/include/SDL_render.h +++ b/include/SDL_render.h @@ -373,6 +373,25 @@ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); /** + * \brief Determines whether a window supports the use of render targets + * + * \param renderer The renderer that will be checked + * + * \return SDL_TRUE if supported, SDL_FALSE if not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer); + +/** + * \brief Set a texture as the current rendering target. + * + * \param texture The targeted texture, or NULL for the default render target + * + * \return 0 on success, or -1 on error + */ +extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, + SDL_Texture *texture); + +/** * \brief Set the drawing area for rendering on the current target. * * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. @@ -566,30 +585,6 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, /** - * \fn SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer) - * - * \brief Determines whether a window supports the use of render targets - * - * \param renderer The renderer that will be checked - * - * \return SDL_TRUE if supported, SDL_FALSE if not. - */ -extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer); - -/** - * \fn int SDL_SetTargetTexture(SDL_Renderer *renderer, SDL_Texture *texture) - * - * \brief Set a texture as the current rendering target. - * - * \param renderer The renderer that will be checked - * - * \param texture The targeted texture, or NULL for the default render target - * - * \return 0 on success, or -1 if there is no rendering context current, or the driver doesn't support the requested operation. - */ -extern DECLSPEC int SDLCALL SDL_SetTargetTexture(SDL_Renderer *renderer, SDL_Texture *texture); - -/** * \brief Read pixels from the current rendering target. * * \param rect A pointer to the rectangle to read, or NULL for the entire diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index fdfc6dce..dc59fd86 100755 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -804,14 +804,14 @@ SDL_UnlockTexture(SDL_Texture * texture) SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer) { - if (!renderer || !renderer->SetTargetTexture) { + if (!renderer || !renderer->SetRenderTarget) { return SDL_FALSE; } return (renderer->info.flags & SDL_RENDERER_TARGETTEXTURE) != 0; } int -SDL_SetTargetTexture(SDL_Renderer *renderer, SDL_Texture *texture) +SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) { SDL_Rect viewport; @@ -847,7 +847,7 @@ SDL_SetTargetTexture(SDL_Renderer *renderer, SDL_Texture *texture) } renderer->target = texture; - if (renderer->SetTargetTexture(renderer, texture) < 0) { + if (renderer->SetRenderTarget(renderer, texture) < 0) { return -1; } diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h index f49db45d..e2e255a0 100755 --- a/src/render/SDL_sysrender.h +++ b/src/render/SDL_sysrender.h @@ -77,7 +77,7 @@ struct SDL_Renderer int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture); - int (*SetTargetTexture) (SDL_Renderer * renderer, SDL_Texture * texture); + int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture); int (*UpdateViewport) (SDL_Renderer * renderer); int (*RenderClear) (SDL_Renderer * renderer); int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points, diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index df307362..e058144d 100755 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -99,7 +99,7 @@ static int D3D_UpdateTexture(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_SetTargetTexture(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_RenderClear(SDL_Renderer * renderer); static int D3D_RenderDrawPoints(SDL_Renderer * renderer, @@ -388,7 +388,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->UpdateTexture = D3D_UpdateTexture; renderer->LockTexture = D3D_LockTexture; renderer->UnlockTexture = D3D_UnlockTexture; - renderer->SetTargetTexture = D3D_SetTargetTexture; + renderer->SetRenderTarget = D3D_SetRenderTarget; renderer->UpdateViewport = D3D_UpdateViewport; renderer->RenderClear = D3D_RenderClear; renderer->RenderDrawPoints = D3D_RenderDrawPoints; @@ -734,7 +734,7 @@ D3D_UpdateViewport(SDL_Renderer * renderer) } static int -D3D_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture) +D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) { D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; D3D_TextureData *texturedata; diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index ea8d95f8..c56c9f8a 100755 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -54,7 +54,7 @@ static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); -static int GL_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int GL_UpdateViewport(SDL_Renderer * renderer); static int GL_RenderClear(SDL_Renderer * renderer); static int GL_RenderDrawPoints(SDL_Renderer * renderer, @@ -307,7 +307,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->UpdateTexture = GL_UpdateTexture; renderer->LockTexture = GL_LockTexture; renderer->UnlockTexture = GL_UnlockTexture; - renderer->SetTargetTexture = GL_SetTargetTexture; + renderer->SetRenderTarget = GL_SetRenderTarget; renderer->UpdateViewport = GL_UpdateViewport; renderer->RenderClear = GL_RenderClear; renderer->RenderDrawPoints = GL_RenderDrawPoints; @@ -707,7 +707,7 @@ GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) } static int -GL_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture) +GL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata; GL_TextureData *texturedata; diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c index d0bef9a9..290d24b0 100755 --- a/src/render/opengles/SDL_render_gles.c +++ b/src/render/opengles/SDL_render_gles.c @@ -56,7 +56,7 @@ static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); static void GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); -static int GLES_SetTargetTexture(SDL_Renderer * renderer, +static int GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int GLES_UpdateViewport(SDL_Renderer * renderer); static int GLES_RenderClear(SDL_Renderer * renderer); @@ -295,7 +295,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->UpdateTexture = GLES_UpdateTexture; renderer->LockTexture = GLES_LockTexture; renderer->UnlockTexture = GLES_UnlockTexture; - renderer->SetTargetTexture = GLES_SetTargetTexture; + renderer->SetRenderTarget = GLES_SetRenderTarget; renderer->UpdateViewport = GLES_UpdateViewport; renderer->RenderClear = GLES_RenderClear; renderer->RenderDrawPoints = GLES_RenderDrawPoints; @@ -575,7 +575,7 @@ GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) } static int -GLES_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture) +GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) { GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; GLES_TextureData *texturedata = NULL; diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index d9d998d5..b7bfa87c 100755 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -327,7 +327,7 @@ static int GLES2_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const static void GLES2_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture); static int GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch); -static int GLES2_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static GLenum GetScaleQuality(void) @@ -533,7 +533,7 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect } static int -GLES2_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture) +GLES2_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) { GLES2_DriverContext *data = (GLES2_DriverContext *) renderer->driverdata; GLES2_TextureData *texturedata = NULL; @@ -1489,7 +1489,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->UpdateTexture = &GLES2_UpdateTexture; renderer->LockTexture = &GLES2_LockTexture; renderer->UnlockTexture = &GLES2_UnlockTexture; - renderer->SetTargetTexture = &GLES2_SetTargetTexture; + renderer->SetRenderTarget = &GLES2_SetRenderTarget; renderer->UpdateViewport = &GLES2_UpdateViewport; renderer->RenderClear = &GLES2_RenderClear; renderer->RenderDrawPoints = &GLES2_RenderDrawPoints; diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index fceb8277..aa72c936 100755 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -51,7 +51,7 @@ static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); -static int SW_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); static int SW_UpdateViewport(SDL_Renderer * renderer); static int SW_RenderClear(SDL_Renderer * renderer); static int SW_RenderDrawPoints(SDL_Renderer * renderer, @@ -145,7 +145,7 @@ SW_CreateRendererForSurface(SDL_Surface * surface) renderer->UpdateTexture = SW_UpdateTexture; renderer->LockTexture = SW_LockTexture; renderer->UnlockTexture = SW_UnlockTexture; - renderer->SetTargetTexture = SW_SetTargetTexture; + renderer->SetRenderTarget = SW_SetRenderTarget; renderer->UpdateViewport = SW_UpdateViewport; renderer->RenderClear = SW_RenderClear; renderer->RenderDrawPoints = SW_RenderDrawPoints; @@ -283,7 +283,7 @@ SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) } static int -SW_SetTargetTexture(SDL_Renderer * renderer, SDL_Texture * texture) +SW_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) { SW_RenderData *data = (SW_RenderData *) renderer->driverdata; diff --git a/test/testrendertarget.c b/test/testrendertarget.c index 10c52654..45153294 100644 --- a/test/testrendertarget.c +++ b/test/testrendertarget.c @@ -99,7 +99,7 @@ Draw(DrawState *s) SDL_RenderGetViewport(s->renderer, &viewport); target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h); - SDL_SetTargetTexture(s->renderer, target); + SDL_SetRenderTarget(s->renderer, target); /* Draw the background */ SDL_RenderCopy(s->renderer, s->background, NULL, NULL); @@ -121,7 +121,7 @@ Draw(DrawState *s) SDL_RenderCopy(s->renderer, s->sprite, NULL, &s->sprite_rect); - SDL_SetTargetTexture(s->renderer, NULL); + SDL_SetRenderTarget(s->renderer, NULL); SDL_RenderCopy(s->renderer, target, NULL, NULL); SDL_DestroyTexture(target); |