render: patched to compile on C89 compilers, other untested code fixes. SDL-ryan-batching-renderer
authorRyan C. Gordon <icculus@icculus.org>
Sat, 29 Sep 2018 04:00:38 +0000
branchSDL-ryan-batching-renderer
changeset 122649727984170f7
parent 12263 b16e5f26d6bd
child 12278 f0e949a32e2f
render: patched to compile on C89 compilers, other untested code fixes.
src/render/SDL_render.c
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
     1.1 --- a/src/render/SDL_render.c	Fri Sep 28 19:48:14 2018 -0400
     1.2 +++ b/src/render/SDL_render.c	Sat Sep 29 04:00:38 2018 +0000
     1.3 @@ -600,8 +600,8 @@
     1.4                 const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
     1.5  {
     1.6      SDL_RenderCommand *cmd = PrepQueueCmdDrawTexture(renderer, texture, SDL_RENDERCMD_COPY_EX);
     1.7 +    int retval = -1;
     1.8      SDL_assert(renderer->QueueCopyEx != NULL);  /* should have caught at higher level. */
     1.9 -    int retval = -1;
    1.10      if (cmd != NULL) {
    1.11          retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip);
    1.12          if (retval < 0) {
    1.13 @@ -1287,11 +1287,8 @@
    1.14  int
    1.15  SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
    1.16  {
    1.17 -    SDL_Renderer *renderer;
    1.18 -
    1.19      CHECK_TEXTURE_MAGIC(texture, -1);
    1.20  
    1.21 -    renderer = texture->renderer;
    1.22      if (r < 255 || g < 255 || b < 255) {
    1.23          texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
    1.24      } else {
    1.25 @@ -1327,11 +1324,8 @@
    1.26  int
    1.27  SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha)
    1.28  {
    1.29 -    SDL_Renderer *renderer;
    1.30 -
    1.31      CHECK_TEXTURE_MAGIC(texture, -1);
    1.32  
    1.33 -    renderer = texture->renderer;
    1.34      if (alpha < 255) {
    1.35          texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
    1.36      } else {
     2.1 --- a/src/render/opengles/SDL_render_gles.c	Fri Sep 28 19:48:14 2018 -0400
     2.2 +++ b/src/render/opengles/SDL_render_gles.c	Sat Sep 29 04:00:38 2018 +0000
     2.3 @@ -731,7 +731,7 @@
     2.4  }
     2.5  
     2.6  static void
     2.7 -SetCopyState(const GLES_RenderData *data, const SDL_RenderCommand *cmd)
     2.8 +SetCopyState(GLES_RenderData *data, const SDL_RenderCommand *cmd)
     2.9  {
    2.10      SDL_Texture *texture = cmd->data.draw.texture;
    2.11      SetDrawState(data, cmd);
    2.12 @@ -793,6 +793,7 @@
    2.13                                        0.0, 1.0);
    2.14                      }
    2.15                      data->glMatrixMode(GL_MODELVIEW);
    2.16 +                }
    2.17                  break;
    2.18              }
    2.19  
    2.20 @@ -831,13 +832,13 @@
    2.21                      data->drawstate.clear_color = color;
    2.22                  }
    2.23  
    2.24 -                if (cliprect_enabled) {
    2.25 +                if (data->drawstate.cliprect_enabled) {
    2.26                      data->glDisable(GL_SCISSOR_TEST);
    2.27                  }
    2.28  
    2.29                  data->glClear(GL_COLOR_BUFFER_BIT);
    2.30  
    2.31 -                if (cliprect_enabled) {
    2.32 +                if (data->drawstate.cliprect_enabled) {
    2.33                      data->glEnable(GL_SCISSOR_TEST);
    2.34                  }
    2.35                  break;
    2.36 @@ -919,7 +920,7 @@
    2.37  
    2.38  static int
    2.39  GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
    2.40 -                    Uint32 pixel_format, void * pixels, int pitch)
    2.41 +                      Uint32 pixel_format, void * pixels, int pitch)
    2.42  {
    2.43      GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
    2.44      Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
     3.1 --- a/src/render/opengles2/SDL_render_gles2.c	Fri Sep 28 19:48:14 2018 -0400
     3.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Sat Sep 29 04:00:38 2018 +0000
     3.3 @@ -939,6 +939,7 @@
     3.4      const SDL_bool was_copy_ex = data->drawstate.is_copy_ex;
     3.5      const SDL_bool is_copy_ex = (cmd->command == SDL_RENDERCMD_COPY_EX);
     3.6      SDL_Texture *texture = cmd->data.draw.texture;
     3.7 +    const SDL_BlendMode blend = cmd->data.draw.blend;
     3.8      GLES2_ProgramCacheEntry *program;
     3.9  
    3.10      SDL_assert((texture != NULL) == (imgsrc != GLES2_IMAGESOURCE_SOLID));
    3.11 @@ -1001,7 +1002,6 @@
    3.12          }
    3.13      }
    3.14  
    3.15 -    const SDL_BlendMode blend = cmd->data.draw.blend;
    3.16      if (blend != data->drawstate.blend) {
    3.17          if (blend == SDL_BLENDMODE_NONE) {
    3.18              data->glDisable(GL_BLEND);