render: patched to compile on C89 compilers, other untested code fixes.

This commit is contained in:
Ryan C. Gordon 2018-09-29 04:00:38 +00:00
parent daad53af13
commit fdc52a65dd
3 changed files with 7 additions and 12 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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);