Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 2838:00356f22195a
Fixed SDL_SetAlpha compatibility function to match the documentation
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 06 Dec 2008 05:49:53 +0000 |
parents | 7173fc5c7ef6 |
children | 7046f9567045 |
comparison
equal
deleted
inserted
replaced
2837:ff8db79a3cc9 | 2838:00356f22195a |
---|---|
684 } | 684 } |
685 | 685 |
686 int | 686 int |
687 SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value) | 687 SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value) |
688 { | 688 { |
689 if (flag & SDL_RLEACCEL) { | 689 if (flag & SDL_SRCALPHA) { |
690 SDL_SetSurfaceRLE(surface, 1); | 690 /* According to the docs, value is ignored for alpha surfaces */ |
691 } | 691 if (surface->format->Amask) { |
692 if (flag) { | 692 value = 0xFF; |
693 } | |
693 SDL_SetSurfaceAlphaMod(surface, value); | 694 SDL_SetSurfaceAlphaMod(surface, value); |
694 SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND); | 695 SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND); |
695 } else { | 696 } else { |
696 SDL_SetSurfaceAlphaMod(surface, 0xFF); | 697 SDL_SetSurfaceAlphaMod(surface, 0xFF); |
697 SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_NONE); | 698 SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_NONE); |
698 } | 699 } |
700 SDL_SetSurfaceRLE(surface, (flag & SDL_RLEACCEL)); | |
701 | |
699 return 0; | 702 return 0; |
700 } | 703 } |
701 | 704 |
702 SDL_Surface * | 705 SDL_Surface * |
703 SDL_DisplayFormat(SDL_Surface * surface) | 706 SDL_DisplayFormat(SDL_Surface * surface) |