summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-03 23:41:16 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-04 01:34:43 +0300
commit4431f40818f832e2cbae061927bdf59904cf5d3b (patch)
tree06e2f050d61d25ef9116c592569ac31cbf60e143 /src
parent55694af091d01efc65c27df4ae7bbbe8444818da (diff)
downloadmv-4431f40818f832e2cbae061927bdf59904cf5d3b.tar.gz
mv-4431f40818f832e2cbae061927bdf59904cf5d3b.tar.bz2
mv-4431f40818f832e2cbae061927bdf59904cf5d3b.tar.xz
mv-4431f40818f832e2cbae061927bdf59904cf5d3b.zip
Imrove compound images update speed in software mode and fix memory leak.
Diffstat (limited to 'src')
-rw-r--r--src/being/compoundsprite.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index 4f5c6bf3e..ae62ead8f 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -366,20 +366,15 @@ void CompoundSprite::redraw() const
delete2(graphics);
- SDL_Surface *const surfaceA = MSDL_CreateRGBSurface(SDL_HWSURFACE,
- BUFFER_WIDTH, BUFFER_HEIGHT, 32, rmask, gmask, bmask, amask);
-
SDL_SetAlpha(surface, 0, SDL_ALPHA_OPAQUE);
- SDL_BlitSurface(surface, nullptr, surfaceA, nullptr);
- delete mImage;
delete mAlphaImage;
- mImage = imageHelper->loadSurface(surface);
- MSDL_FreeSurface(surface);
-
if (ImageHelper::mEnableAlpha)
{
+ SDL_Surface *const surfaceA = MSDL_CreateRGBSurface(SDL_HWSURFACE,
+ BUFFER_WIDTH, BUFFER_HEIGHT, 32, rmask, gmask, bmask, amask);
+ SDL_BlitSurface(surface, nullptr, surfaceA, nullptr);
mAlphaImage = imageHelper->loadSurface(surfaceA);
MSDL_FreeSurface(surfaceA);
}
@@ -387,6 +382,10 @@ void CompoundSprite::redraw() const
{
mAlphaImage = nullptr;
}
+
+ delete mImage;
+ mImage = imageHelper->loadSurface(surface);
+ MSDL_FreeSurface(surface);
#endif // USE_SDL2
}