gui: move retainaspect handling to the resource ctors

LoadResources should only decide on the resource type,
everything else is handled by the resources themselves.

Change-Id: I30f68293960c23560979f650efc4393992cf5824
diff --git a/gui/resources.cpp b/gui/resources.cpp
index dcd4ca8..41655c3 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -179,7 +179,7 @@
 	}
 }
 
-ImageResource::ImageResource(xml_node<>* node, ZipArchive* pZip, int retain_aspect)
+ImageResource::ImageResource(xml_node<>* node, ZipArchive* pZip)
  : Resource(node, pZip)
 {
 	std::string file;
@@ -198,6 +198,8 @@
 		return;
 	}
 
+	bool retain_aspect = (node->first_attribute("retainaspect") != NULL);
+	// the value does not matter, if retainaspect is present, we assume that we want to retain it
 	LoadImage(pZip, file, &temp_surface);
 	CheckAndScaleImage(temp_surface, &mSurface, retain_aspect);
 }
@@ -208,7 +210,7 @@
 		res_free_surface(mSurface);
 }
 
-AnimationResource::AnimationResource(xml_node<>* node, ZipArchive* pZip, int retain_aspect)
+AnimationResource::AnimationResource(xml_node<>* node, ZipArchive* pZip)
  : Resource(node, pZip)
 {
 	std::string file;
@@ -224,6 +226,8 @@
 		return;
 	}
 
+	bool retain_aspect = (node->first_attribute("retainaspect") != NULL);
+	// the value does not matter, if retainaspect is present, we assume that we want to retain it
 	for (;;)
 	{
 		std::ostringstream fileName;
@@ -313,11 +317,7 @@
 		}
 		else if (type == "image")
 		{
-			int retain = 0;
-			xml_attribute<>* retain_aspect_ratio = child->first_attribute("retainaspect");
-			if (retain_aspect_ratio)
-				retain = 1; // the value does not matter, if retainaspect is present, we assume that we want to retain it
-			ImageResource* res = new ImageResource(child, pZip, retain);
+			ImageResource* res = new ImageResource(child, pZip);
 			if (res->GetResource())
 				mImages.push_back(res);
 			else {
@@ -327,11 +327,7 @@
 		}
 		else if (type == "animation")
 		{
-			int retain = 0;
-			xml_attribute<>* retain_aspect_ratio = child->first_attribute("retainaspect");
-			if (retain_aspect_ratio)
-				retain = 1; // the value does not matter, if retainaspect is present, we assume that we want to retain it
-			AnimationResource* res = new AnimationResource(child, pZip, retain);
+			AnimationResource* res = new AnimationResource(child, pZip);
 			if (res->GetResourceCount())
 				mAnimations.push_back(res);
 			else {
diff --git a/gui/resources.hpp b/gui/resources.hpp
index 0ce9684..0eb3267 100644
--- a/gui/resources.hpp
+++ b/gui/resources.hpp
@@ -58,7 +58,7 @@
 class ImageResource : public Resource
 {
 public:
-	ImageResource(xml_node<>* node, ZipArchive* pZip, int retain_aspect);
+	ImageResource(xml_node<>* node, ZipArchive* pZip);
 	virtual ~ImageResource();
 
 public:
@@ -73,7 +73,7 @@
 class AnimationResource : public Resource
 {
 public:
-	AnimationResource(xml_node<>* node, ZipArchive* pZip, int retain_aspect);
+	AnimationResource(xml_node<>* node, ZipArchive* pZip);
 	virtual ~AnimationResource();
 
 public: