mirror of https://github.com/encounter/SDL.git
render: patched to compile on C89 compilers, other untested code fixes.
This commit is contained in:
parent
daad53af13
commit
fdc52a65dd
|
@ -600,8 +600,8 @@ QueueCmdCopyEx(SDL_Renderer *renderer, SDL_Texture * texture,
|
||||||
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
|
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
|
||||||
{
|
{
|
||||||
SDL_RenderCommand *cmd = PrepQueueCmdDrawTexture(renderer, texture, SDL_RENDERCMD_COPY_EX);
|
SDL_RenderCommand *cmd = PrepQueueCmdDrawTexture(renderer, texture, SDL_RENDERCMD_COPY_EX);
|
||||||
SDL_assert(renderer->QueueCopyEx != NULL); /* should have caught at higher level. */
|
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
SDL_assert(renderer->QueueCopyEx != NULL); /* should have caught at higher level. */
|
||||||
if (cmd != NULL) {
|
if (cmd != NULL) {
|
||||||
retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip);
|
retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
|
@ -1287,11 +1287,8 @@ SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access,
|
||||||
int
|
int
|
||||||
SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
|
SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
|
||||||
{
|
{
|
||||||
SDL_Renderer *renderer;
|
|
||||||
|
|
||||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||||
|
|
||||||
renderer = texture->renderer;
|
|
||||||
if (r < 255 || g < 255 || b < 255) {
|
if (r < 255 || g < 255 || b < 255) {
|
||||||
texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
|
texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1327,11 +1324,8 @@ SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g,
|
||||||
int
|
int
|
||||||
SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha)
|
SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha)
|
||||||
{
|
{
|
||||||
SDL_Renderer *renderer;
|
|
||||||
|
|
||||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||||
|
|
||||||
renderer = texture->renderer;
|
|
||||||
if (alpha < 255) {
|
if (alpha < 255) {
|
||||||
texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
|
texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -731,7 +731,7 @@ SetDrawState(GLES_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
SetDrawState(data, cmd);
|
SetDrawState(data, cmd);
|
||||||
|
@ -793,6 +793,7 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
|
||||||
0.0, 1.0);
|
0.0, 1.0);
|
||||||
}
|
}
|
||||||
data->glMatrixMode(GL_MODELVIEW);
|
data->glMatrixMode(GL_MODELVIEW);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,13 +832,13 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
|
||||||
data->drawstate.clear_color = color;
|
data->drawstate.clear_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cliprect_enabled) {
|
if (data->drawstate.cliprect_enabled) {
|
||||||
data->glDisable(GL_SCISSOR_TEST);
|
data->glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
data->glClear(GL_COLOR_BUFFER_BIT);
|
data->glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
if (cliprect_enabled) {
|
if (data->drawstate.cliprect_enabled) {
|
||||||
data->glEnable(GL_SCISSOR_TEST);
|
data->glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -919,7 +920,7 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
|
||||||
|
|
||||||
static int
|
static int
|
||||||
GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
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;
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
||||||
Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
|
Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
|
||||||
|
|
|
@ -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 was_copy_ex = data->drawstate.is_copy_ex;
|
||||||
const SDL_bool is_copy_ex = (cmd->command == SDL_RENDERCMD_COPY_EX);
|
const SDL_bool is_copy_ex = (cmd->command == SDL_RENDERCMD_COPY_EX);
|
||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
|
const SDL_BlendMode blend = cmd->data.draw.blend;
|
||||||
GLES2_ProgramCacheEntry *program;
|
GLES2_ProgramCacheEntry *program;
|
||||||
|
|
||||||
SDL_assert((texture != NULL) == (imgsrc != GLES2_IMAGESOURCE_SOLID));
|
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 != data->drawstate.blend) {
|
||||||
if (blend == SDL_BLENDMODE_NONE) {
|
if (blend == SDL_BLENDMODE_NONE) {
|
||||||
data->glDisable(GL_BLEND);
|
data->glDisable(GL_BLEND);
|
||||||
|
|
Loading…
Reference in New Issue