CleverRaven/Cataclysm-DDA — pull request #7405 by BevapDin (2014-04-25 13:24:54+00:00)
Title: SDL fixes

What happens seems to be this:

SDL uses double buffering. When `SDL_RenderPresent` is called, it swaps the buffers and displays the active one (which was formerly used for drawing).

The games curses "simulation" (the WINDOW struct) caches which lines have been changed since they have been drawn. Later only those lines will be drawn again.

The remaining space is not redraw and the old content remains there. This is actually how ncurses does it and that's fine for it.

This leads to the situation:

1. draw all windows on buffer A,
2. present buffer A, make buffer B the drawing buffer,
3. draw (this time to buffer B) the changed things. Everything that has not changed is not drawn again and the old content remains there.
4. present buffer B, make buffer A the drawing buffer,
5. draw (this time to buffer A) the changed things. Unchanged parts of the screen remain as they have been in step 1 (because step 1 draws to buffer A). But step 3 draws to buffer B, so parts that have not changed are now in the state of step 1 instead of step 3 as they should be.

This is easily (on my system) seen in the main key bindings screen, accessed from the help screen. Because the key bindings screen is two tiles smaller than the help screen (and both are centered). The key bindings screen should still show the borders of the help screen. It does so every second frame (press '5' to skip a frame).

This PR renders to a texture, displays that texture and renders to the very same texture again. That way unchanged parts of the screen remain in the buffer and are presented on the next frame again.

----

The changes in the Hoder tileset are somehow related to this:
The grass foreground tile has transparent parts and those parts show the content of the previous frame in game. This is wrong when moving around as they would show the content of another square.
Instead they should show the dirt under the grass (dirt has tile "2" and tile "2" is completely opaque).