diff options
author | P. J. McDermott <pjm@nac.net> | 2013-03-04 20:44:00 (EST) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-03-04 21:25:08 (EST) |
commit | 4735d4ba2d19dbc47012bef9b31749dba6ad43b3 (patch) | |
tree | dfb0e808db7c817515a0207611acccc32efefc4d /src | |
parent | 198713a2b15ea835de6bc0f889c260c62a376e42 (diff) | |
download | overworld-rpg-4735d4ba2d19dbc47012bef9b31749dba6ad43b3.zip overworld-rpg-4735d4ba2d19dbc47012bef9b31749dba6ad43b3.tar.gz overworld-rpg-4735d4ba2d19dbc47012bef9b31749dba6ad43b3.tar.bz2 |
src/area.c: Disable RLE on area layers.
This mostly fixes the performance regression introduced by merging the
palette cycling and map movement demos.
I removed the 10-ms delay between frames in the demo and tested the
framerates:
Test Framerate with RLE (fps) Framerate without RLE (fps)
1 160.306202859 1730.255164034
2 142.599639495 1758.024691358
3 167.588560668 1797.97979798
4 162.279202279 1764.560099133
5 157.278550917 1625.570776256
avg 158.010431244 1735.278105752
I then restored the delay and watched the CPU usage:
CPU usage with RLE CPU usage without RLE
~9.00% ~1.00%
This is happening because we're now cycling palettes each frame and, as
a result, SDL needs to decode and encode the surfaces each frame to map
palettes (though I'm not sure why it needs a decoded surface just to map
palettes).
(Normally, we probably wouldn't cycle palettes /each frame/, so this is
something of an extreme case.)
See for example the SDL_UnRLESurface() call at line 551 of
src/video/SDL_pixels.c in SDL 1.2.15.
Diffstat (limited to 'src')
-rw-r--r-- | src/area.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -61,8 +61,7 @@ init_map_layers(struct area *area) SDL_FillRect(area->map_layers[l], &dstrect, SDL_MapRGB(area->map_layers[l]->format, 0xFC, 0x00, 0xFF)); - SDL_SetColorKey(area->map_layers[l], SDL_SRCCOLORKEY | - SDL_RLEACCEL, + SDL_SetColorKey(area->map_layers[l], SDL_SRCCOLORKEY, SDL_MapRGB(area->map_layers[l]->format, 0xFC, 0x00, 0xFF)); } |