Skip to content

Commit

Permalink
render: patched to compile on C89 compilers, other untested code fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Sep 29, 2018
1 parent daad53a commit fdc52a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
8 changes: 1 addition & 7 deletions src/render/SDL_render.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 5 additions & 4 deletions src/render/opengles/SDL_render_gles.c
Expand Up @@ -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);
Expand Down Expand Up @@ -793,6 +793,7 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
0.0, 1.0);
}
data->glMatrixMode(GL_MODELVIEW);
}
break;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/render/opengles2/SDL_render_gles2.c
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fdc52a6

Please sign in to comment.