Skip to content
Permalink
Browse files

Code style cleanup in the GLES and GLES2 render backends.

  • Loading branch information
slime73 committed May 16, 2015
1 parent 240a3fb commit fcee3e734d61ab5b19e57a79bc6fd7a4f7cbca84
Showing with 140 additions and 148 deletions.
  1. +12 −10 src/render/opengles/SDL_render_gles.c
  2. +122 −126 src/render/opengles2/SDL_render_gles2.c
  3. +6 −12 src/render/opengles2/SDL_shaders_gles2.c
@@ -220,12 +220,10 @@ GLES_FBOList *
GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h)
{
GLES_FBOList *result = data->framebuffers;
while ((result) && ((result->w != w) || (result->h != h)) )
{
while ((result) && ((result->w != w) || (result->h != h)) ) {
result = result->next;
}
if (result == NULL)
{
if (result == NULL) {
result = SDL_malloc(sizeof(GLES_FBOList));
result->w = w;
result->h = h;
@@ -572,8 +570,9 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
GLES_ActivateRenderer(renderer);

/* Bail out if we're supposed to update an empty rectangle */
if (rect->w <= 0 || rect->h <= 0)
if (rect->w <= 0 || rect->h <= 0) {
return 0;
}

/* Reformat the texture data into a tightly packed array */
srcPitch = rect->w * SDL_BYTESPERPIXEL(texture->format);
@@ -608,8 +607,7 @@ GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
src);
SDL_free(blob);

if (renderdata->glGetError() != GL_NO_ERROR)
{
if (renderdata->glGetError() != GL_NO_ERROR) {
return SDL_SetError("Failed to update texture");
}
return 0;
@@ -650,7 +648,7 @@ GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
GLenum status;

GLES_ActivateRenderer(renderer);

if (!data->GL_OES_framebuffer_object_supported) {
return SDL_SetError("Can't enable render target support in this renderer");
}
@@ -1206,8 +1204,12 @@ static int GLES_BindTexture (SDL_Renderer * renderer, SDL_Texture *texture, floa
data->glEnable(GL_TEXTURE_2D);
data->glBindTexture(texturedata->type, texturedata->texture);

if(texw) *texw = (float)texturedata->texw;
if(texh) *texh = (float)texturedata->texh;
if (texw) {
*texw = (float)texturedata->texw;
}
if (texh) {
*texh = (float)texturedata->texh;
}

return 0;
}

0 comments on commit fcee3e7

Please sign in to comment.