refactoring:
- move platform-specific graphic setup into a separate method.

bugfix:
- fix memory leak.

Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>