Skip to content

Commit

Permalink
software: fix blits with color mods that change during a command queu…
Browse files Browse the repository at this point in the history
…e run.
  • Loading branch information
icculus committed Nov 15, 2018
1 parent 2e348c1 commit 9262c0d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/render/software/SDL_render_sw.c
Expand Up @@ -554,20 +554,17 @@ PrepTextureForCopy(const SDL_RenderCommand *cmd)
const SDL_BlendMode blend = cmd->data.draw.blend;
SDL_Texture *texture = cmd->data.draw.texture;
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
const SDL_bool colormod = ((r & g & b) != 0xFF);
const SDL_bool alphamod = (a != 0xFF);
const SDL_bool blending = ((blend == SDL_BLENDMODE_ADD) || (blend == SDL_BLENDMODE_MOD));

if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
if (colormod || alphamod || blending) {
SDL_SetSurfaceRLE(surface, 0);
SDL_SetSurfaceColorMod(surface, r, g, b);
}

if ((texture->modMode & SDL_TEXTUREMODULATE_ALPHA) && surface->format->Amask) {
SDL_SetSurfaceRLE(surface, 0);
SDL_SetSurfaceAlphaMod(surface, a);
}

if ((blend == SDL_BLENDMODE_ADD) || (blend == SDL_BLENDMODE_MOD)) {
SDL_SetSurfaceRLE(surface, 0);
}
/* !!! FIXME: we can probably avoid some of these calls. */
SDL_SetSurfaceColorMod(surface, r, g, b);
SDL_SetSurfaceAlphaMod(surface, a);
SDL_SetSurfaceBlendMode(surface, blend);
}

Expand Down

0 comments on commit 9262c0d

Please sign in to comment.