render: patched to compile on C89 compilers, other untested code fixes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 9a8c2f7..5c7e36d 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -600,8 +600,8 @@ QueueCmdCopyEx(SDL_Renderer *renderer, SDL_Texture * texture,
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
{
SDL_RenderCommand *cmd = PrepQueueCmdDrawTexture(renderer, texture, SDL_RENDERCMD_COPY_EX);
- SDL_assert(renderer->QueueCopyEx != NULL); /* should have caught at higher level. */
int retval = -1;
+ SDL_assert(renderer->QueueCopyEx != NULL); /* should have caught at higher level. */
if (cmd != NULL) {
retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip);
if (retval < 0) {
@@ -1287,11 +1287,8 @@ SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access,
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 @@ SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g,
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 --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index 52a3e99..64801db 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -731,7 +731,7 @@ SetDrawState(GLES_RenderData *data, const SDL_RenderCommand *cmd)
}
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 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
0.0, 1.0);
}
data->glMatrixMode(GL_MODELVIEW);
+ }
break;
}
@@ -831,13 +832,13 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
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 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
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 --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 052a277..c1be710 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -939,6 +939,7 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I
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 @@ SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, const GLES2_I
}
}
- const SDL_BlendMode blend = cmd->data.draw.blend;
if (blend != data->drawstate.blend) {
if (blend == SDL_BLENDMODE_NONE) {
data->glDisable(GL_BLEND);