Refactor drawing into separate functions

The tile drawing routine is quite long and hard to easily overview.
Divide it into more appropriate functions and call them from the main
drawing routine.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>