Fixed SDL_SetAlpha compatibility function to match the documentation
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403299
This commit is contained in:
parent
ffbae1776d
commit
535f3bf809
1 changed files with 7 additions and 4 deletions
|
@ -686,16 +686,19 @@ SDL_GetVideoSurface(void)
|
||||||
int
|
int
|
||||||
SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
|
SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
|
||||||
{
|
{
|
||||||
if (flag & SDL_RLEACCEL) {
|
if (flag & SDL_SRCALPHA) {
|
||||||
SDL_SetSurfaceRLE(surface, 1);
|
/* According to the docs, value is ignored for alpha surfaces */
|
||||||
|
if (surface->format->Amask) {
|
||||||
|
value = 0xFF;
|
||||||
}
|
}
|
||||||
if (flag) {
|
|
||||||
SDL_SetSurfaceAlphaMod(surface, value);
|
SDL_SetSurfaceAlphaMod(surface, value);
|
||||||
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
|
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
|
||||||
} else {
|
} else {
|
||||||
SDL_SetSurfaceAlphaMod(surface, 0xFF);
|
SDL_SetSurfaceAlphaMod(surface, 0xFF);
|
||||||
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_NONE);
|
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_NONE);
|
||||||
}
|
}
|
||||||
|
SDL_SetSurfaceRLE(surface, (flag & SDL_RLEACCEL));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue