mirror of
https://github.com/yawut/SDL.git
synced 2026-09-08 09:06:29 -05:00
Fixed SDL_SetAlpha compatibility function to match the documentation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user