summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthat <github@that.at>2015-05-06 23:45:57 +0200
committerDees Troy <dees_troy@teamw.in>2015-06-01 03:03:28 +0200
commit5267a21667ab6117cdbb26d054c774b33ab3bb1f (patch)
tree917f75f1d189b3aca441c865139ed38db583eae4
parentDon't try to read temparature file if TW_NO_CPU_TEMP is set to true. (diff)
downloadandroid_bootable_recovery-5267a21667ab6117cdbb26d054c774b33ab3bb1f.tar
android_bootable_recovery-5267a21667ab6117cdbb26d054c774b33ab3bb1f.tar.gz
android_bootable_recovery-5267a21667ab6117cdbb26d054c774b33ab3bb1f.tar.bz2
android_bootable_recovery-5267a21667ab6117cdbb26d054c774b33ab3bb1f.tar.lz
android_bootable_recovery-5267a21667ab6117cdbb26d054c774b33ab3bb1f.tar.xz
android_bootable_recovery-5267a21667ab6117cdbb26d054c774b33ab3bb1f.tar.zst
android_bootable_recovery-5267a21667ab6117cdbb26d054c774b33ab3bb1f.zip
-rw-r--r--gui/resources.cpp20
-rw-r--r--gui/resources.hpp4
2 files changed, 10 insertions, 14 deletions
diff --git a/gui/resources.cpp b/gui/resources.cpp
index dcd4ca8b0..41655c376 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -179,7 +179,7 @@ FontResource::~FontResource()
}
}
-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 @@ ImageResource::ImageResource(xml_node<>* node, ZipArchive* pZip, int retain_aspe
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 @@ ImageResource::~ImageResource()
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 @@ AnimationResource::AnimationResource(xml_node<>* node, ZipArchive* pZip, int ret
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 @@ void ResourceManager::LoadResources(xml_node<>* resList, ZipArchive* pZip)
}
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 @@ void ResourceManager::LoadResources(xml_node<>* resList, ZipArchive* pZip)
}
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 0ce968427..0eb32674d 100644
--- a/gui/resources.hpp
+++ b/gui/resources.hpp
@@ -58,7 +58,7 @@ protected:
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 @@ protected:
class AnimationResource : public Resource
{
public:
- AnimationResource(xml_node<>* node, ZipArchive* pZip, int retain_aspect);
+ AnimationResource(xml_node<>* node, ZipArchive* pZip);
virtual ~AnimationResource();
public: