aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl/sdl.cpp
diff options
context:
space:
mode:
authorThierry Crozat2017-11-11 00:18:57 +0000
committerThierry Crozat2017-11-11 00:18:57 +0000
commit6b4195a542083c97f696c843b9823d578b018996 (patch)
tree3a76eb284a9fe6efb33997a86cf936f5cb68456e /backends/platform/sdl/sdl.cpp
parent1d1f898c012902c719b9f31c2db39e6026b8af69 (diff)
downloadscummvm-rg350-6b4195a542083c97f696c843b9823d578b018996.tar.gz
scummvm-rg350-6b4195a542083c97f696c843b9823d578b018996.tar.bz2
scummvm-rg350-6b4195a542083c97f696c843b9823d578b018996.zip
SDL: Use RLE acceleration for SDL2 transparent surfaces
We were already doing it for SDL1.2, but with SDL2 the SDL_RLEACCEL is not passed to SDL and instead we need to call SDL_SetSurfaceRLE.
Diffstat (limited to 'backends/platform/sdl/sdl.cpp')
-rw-r--r--backends/platform/sdl/sdl.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index f44d87666a..f2bf9590c5 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -754,10 +754,13 @@ int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha) {
if (SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE)) {
return -1;
}
+ SDL_SetSurfaceRLE(surface, 0);
} else {
if (SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND)) {
return -1;
}
+ if (flag & SDL_RLEACCEL)
+ SDL_SetSurfaceRLE(surface, 1);
}
return 0;
@@ -765,7 +768,13 @@ int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha) {
#undef SDL_SetColorKey
int SDL_SetColorKey_replacement(SDL_Surface *surface, Uint32 flag, Uint32 key) {
- return SDL_SetColorKey(surface, SDL_TRUE, key) ? -1 : 0;
+ if (SDL_SetColorKey(surface, SDL_TRUE, key)) {
+ return -1;
+ }
+
+ if (flag & SDL_RLEACCEL)
+ SDL_SetSurfaceRLE(surface, 1);
+ return 0;
}
#endif