From 4735d4ba2d19dbc47012bef9b31749dba6ad43b3 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 04 Mar 2013 20:44:00 -0500 Subject: 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. --- (limited to 'src') diff --git a/src/area.c b/src/area.c index 2e55fe9..e605c6c 100644 --- a/src/area.c +++ b/src/area.c @@ -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)); } -- cgit v0.9.1