Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed SDL_SetAlpha compatibility function to match the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Dec 6, 2008
1 parent 901750a commit 7031994
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/SDL_compat.c
Expand Up @@ -686,16 +686,19 @@ SDL_GetVideoSurface(void)
int
SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
{
if (flag & SDL_RLEACCEL) {
SDL_SetSurfaceRLE(surface, 1);
}
if (flag) {
if (flag & SDL_SRCALPHA) {
/* According to the docs, value is ignored for alpha surfaces */
if (surface->format->Amask) {
value = 0xFF;
}
SDL_SetSurfaceAlphaMod(surface, value);
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
} else {
SDL_SetSurfaceAlphaMod(surface, 0xFF);
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_NONE);
}
SDL_SetSurfaceRLE(surface, (flag & SDL_RLEACCEL));

return 0;
}

Expand Down

0 comments on commit 7031994

Please sign in to comment.