Fix cond jump on uninitialized var.
Merge remote-tracking branch 'upstream/master' into renderdevice
Merge remote-tracking branch 'upstream/master' into renderdevice
Merge remote-tracking branch 'upstream/master' into renderdevice
Merge remote-tracking branch 'upstream/master' into renderdevice
Merge remote-tracking branch 'upstream/master' into renderdevice
Merge remote-tracking branch 'upstream/master' into renderdevice
Merge remote-tracking branch 'upstream/master' into renderdevice
Merge remote-tracking branch 'upstream/master' into renderdevice
Part1: RenderDevice Abstraction Refactor.

This is the first part of fixes for issue #969.

- Removed ISprite and replaced it with Sprite implementation
  from SDLRenderDevice. There is no need to make Sprite an interface
  due to it have the same functionality independently of render backend.

- Update Image to be factory of Sprite's, added Image::createSprite().
  Made constructor private and added Image as friend for compiletime
  control of who can instantiate a Image.

- Added reference counting on Image and logics for freeing a
  resource when last reference is released using RenderDevice::freeImage().

- Made Sprite to increase reference on source image in constructor and
  release the reference in destructor.

- Update RenderDevice to be a factory of Images's, made constructor
  of Image private and SDLRenderDevice a friend of Image. FIXME, this
  should be changed so that RenderDevice is friend instead.

- Added RenderDevice.cpp for implementations of Sprite, Image, RenderDevice

- Replaced all instantiations of Image to use the RenderDevice as factory

- Replaced all instantiations of Sprites to use the Image as factory

- Changed Menu to handle shared code for background of derived menus,
  setBackground(), setBackgroundClip() and setBackgroundDest()

- Made Menu::render() non pure virtual and added implementation to render
  background image if availabl in Menu baseclass.

- Updated all derivied menus of base class Menu to use the new background
  rendering implementation by calling Menu::render().

- Update all code that used Image and Sprite to use the new factories for
  allocation and release of resources.

I have tested this big refactor through valgrind and there is one leak left
in ImageManager class, this however will be removed completly and replaced
with same base functionality implementation in RenderDevice::loadGraphicsSurface()
Part2: RenderDevice Abstraction Refactor.
This is the second part of fixes for issue #969.

- Refactored Image to be completly abstracted

- Added implemenation of SDLImage derived from Image which now
  owns the SDL specific resource SDL_Surface

- Updated SDLRenderDevice implemenation to use the new SDLImage
  instead of old Image. static_cast<SDLImage *>(Image *) is used
  to get the derived SDLImage pointer.
Merge remote-tracking branch 'upstream/master' into renderdevice

Conflicts:
	src/SDLRenderDevice.cpp
Part3: RenderDevice Abstraction Refactor.
This is the third part of fixes for issue #969.

This change with the new image cache in RenderDevice will fix
problems reported on issue #972

- Added image cache implementation to RenderDevice,
  cacheLookup(), cacheStore() and cacheRemove() are added.

- Updated SDLRenderDevice to use the new image cache in base
  class. The cache is instrumented at load and free of an Image.

- Added helper loadTextureImage() to Utils, this will construct a
  filename to load noalpha or not, code migrated from ImageManager.

- Removed ImageManager completly now when we have a image cache in
  RenderDevice. Update all use of image manager to use the new
  loadTextureImage() util function.

- Added a few missing unref() of images to cleanup memleaks.
Merge remote-tracking branch 'upstream/master' into renderdevice

Conflicts:
	src/GameStateResolution.cpp
	src/SharedResources.cpp

Rewrote the CursorManager to use the new RenderDevice abstraction.
Fix crash when switching resolutions.
When background is deleted we need to clear background pointer.
Merge remote-tracking branch 'upstream/master' into renderdevice

Conflicts:
	src/CursorManager.cpp
Merge remote-tracking branch 'upstream/master' into renderdevice
Merge remote-tracking branch 'upstream/master' into renderdevice

Conflicts:
	src/GameStateTitle.cpp
	src/Menu.cpp
	src/Utils.cpp
Part4: Render Device abstraction

Part of bug #969

Moved local to global transformation implementation from SDLRenderDevice
into RenderDevice so it could be reused by other RenderDevice implementations.
Merge remote-tracking branch 'upstream/master' into renderdevice