[Commits] SDL: render: patched to compile on C89 compilers, other untested...

libsdl.org revision control commits-owner at libsdl.org
Sat Sep 29 13:49:52 PDT 2018


details:   https://hg.libsdl.org/SDL/rev/9727984170f7
changeset: 12264:9727984170f7
user:      Ryan C. Gordon <icculus at icculus.org>
date:      Sat Sep 29 04:00:38 2018 +0000
description:
render: patched to compile on C89 compilers, other untested code fixes.

diffstat:

 src/render/SDL_render.c                 |  8 +-------
 src/render/opengles/SDL_render_gles.c   |  9 +++++----
 src/render/opengles2/SDL_render_gles2.c |  2 +-
 3 files changed, 7 insertions(+), 12 deletions(-)

diffs (101 lines):

diff -r b16e5f26d6bd -r 9727984170f7 src/render/SDL_render.c
--- a/src/render/SDL_render.c	Fri Sep 28 19:48:14 2018 -0400
+++ b/src/render/SDL_render.c	Sat Sep 29 04:00:38 2018 +0000
@@ -600,8 +600,8 @@
                const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
 {
     SDL_RenderCommand *cmd = PrepQueueCmdDrawTexture(renderer, texture, SDL_RENDERCMD_COPY_EX);
+    int retval = -1;
     SDL_assert(renderer->QueueCopyEx != NULL);  /* should have caught at higher level. */
-    int retval = -1;
     if (cmd != NULL) {
         retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip);
         if (retval < 0) {
@@ -1287,11 +1287,8 @@
 int
 SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
 {
-    SDL_Renderer *renderer;
-
     CHECK_TEXTURE_MAGIC(texture, -1);
 
-    renderer = texture->renderer;
     if (r < 255 || g < 255 || b < 255) {
         texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
     } else {
@@ -1327,11 +1324,8 @@
 int
 SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha)
 {
-    SDL_Renderer *renderer;
-
     CHECK_TEXTURE_MAGIC(texture, -1);
 
-    renderer = texture->renderer;
     if (alpha < 255) {
         texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
     } else {
diff -r b16e5f26d6bd -r 9727984170f7 src/render/opengles/SDL_render_gles.c
--- a/src/render/opengles/SDL_render_gles.c	Fri Sep 28 19:48:14 2018 -0400
+++ b/src/render/opengles/SDL_render_gles.c	Sat Sep 29 04:00:38 2018 +0000
@@ -731,7 +731,7 @@
 }
 
 static void
-SetCopyState(const GLES_RenderData *data, const SDL_RenderCommand *cmd)
+SetCopyState(GLES_RenderData *data, const SDL_RenderCommand *cmd)
 {
     SDL_Texture *texture = cmd->data.draw.texture;
     SetDrawState(data, cmd);
@@ -793,6 +793,7 @@
                                       0.0, 1.0);
                     }
                     data->glMatrixMode(GL_MODELVIEW);
+                }
                 break;
             }
 
@@ -831,13 +832,13 @@
                     data->drawstate.clear_color = color;
                 }
 
-                if (cliprect_enabled) {
+                if (data->drawstate.cliprect_enabled) {
                     data->glDisable(GL_SCISSOR_TEST);
                 }
 
                 data->glClear(GL_COLOR_BUFFER_BIT);
 
-                if (cliprect_enabled) {
+                if (data->drawstate.cliprect_enabled) {
                     data->glEnable(GL_SCISSOR_TEST);
                 }
                 break;
@@ -919,7 +920,7 @@
 
 static int
 GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
-                    Uint32 pixel_format, void * pixels, int pitch)
+                      Uint32 pixel_format, void * pixels, int pitch)
 {
     GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
     Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
diff -r b16e5f26d6bd -r 9727984170f7 src/render/opengles2/SDL_render_gles2.c
--- a/src/render/opengles2/SDL_render_gles2.c	Fri Sep 28 19:48:14 2018 -0400
+++ b/src/render/opengles2/SDL_render_gles2.c	Sat Sep 29 04:00:38 2018 +0000
@@ -939,6 +939,7 @@
     const SDL_bool was_copy_ex = data->drawstate.is_copy_ex;
     const SDL_bool is_copy_ex = (cmd->command == SDL_RENDERCMD_COPY_EX);
     SDL_Texture *texture = cmd->data.draw.texture;
+    const SDL_BlendMode blend = cmd->data.draw.blend;
     GLES2_ProgramCacheEntry *program;
 
     SDL_assert((texture != NULL) == (imgsrc != GLES2_IMAGESOURCE_SOLID));
@@ -1001,7 +1002,6 @@
         }
     }
 
-    const SDL_BlendMode blend = cmd->data.draw.blend;
     if (blend != data->drawstate.blend) {
         if (blend == SDL_BLENDMODE_NONE) {
             data->glDisable(GL_BLEND);


More information about the commits mailing list