summaryrefslogtreecommitdiffstats
path: root/gui/image.cpp
diff options
context:
space:
mode:
authorVojtech Bocek <vbocek@gmail.com>2013-07-25 22:53:02 +0200
committerGerrit Code Review <gerrit@198.50.184.117>2013-08-24 14:56:48 +0200
commitfafb0c541bb4b24515c57251a44d87825eec90fb (patch)
tree9cddb55ceef8912c8fafe618c98147ff6df19ef6 /gui/image.cpp
parentClean-up in partitions.hpp (diff)
downloadandroid_bootable_recovery-fafb0c541bb4b24515c57251a44d87825eec90fb.tar
android_bootable_recovery-fafb0c541bb4b24515c57251a44d87825eec90fb.tar.gz
android_bootable_recovery-fafb0c541bb4b24515c57251a44d87825eec90fb.tar.bz2
android_bootable_recovery-fafb0c541bb4b24515c57251a44d87825eec90fb.tar.lz
android_bootable_recovery-fafb0c541bb4b24515c57251a44d87825eec90fb.tar.xz
android_bootable_recovery-fafb0c541bb4b24515c57251a44d87825eec90fb.tar.zst
android_bootable_recovery-fafb0c541bb4b24515c57251a44d87825eec90fb.zip
Diffstat (limited to '')
-rw-r--r--gui/image.cpp105
1 files changed, 55 insertions, 50 deletions
diff --git a/gui/image.cpp b/gui/image.cpp
index c684d1b53..45d863673 100644
--- a/gui/image.cpp
+++ b/gui/image.cpp
@@ -27,71 +27,76 @@ extern "C" {
GUIImage::GUIImage(xml_node<>* node)
{
- xml_attribute<>* attr;
- xml_node<>* child;
+ xml_attribute<>* attr;
+ xml_node<>* child;
- mImage = NULL;
+ mImage = NULL;
mHighlightImage = NULL;
isHighlighted = false;
- if (!node)
- return;
+ if (!node)
+ return;
- child = node->first_node("image");
- if (child)
- {
- attr = child->first_attribute("resource");
- if (attr)
- mImage = PageManager::FindResource(attr->value());
+ child = node->first_node("image");
+ if (child)
+ {
+ attr = child->first_attribute("resource");
+ if (attr)
+ mImage = PageManager::FindResource(attr->value());
attr = child->first_attribute("highlightresource");
- if (attr)
- mHighlightImage = PageManager::FindResource(attr->value());
- }
-
- // Load the placement
- LoadPlacement(node->first_node("placement"), &mRenderX, &mRenderY, NULL, NULL, &mPlacement);
-
- if (mImage && mImage->GetResource())
- {
- mRenderW = gr_get_width(mImage->GetResource());
- mRenderH = gr_get_height(mImage->GetResource());
-
- // Adjust for placement
- if (mPlacement != TOP_LEFT && mPlacement != BOTTOM_LEFT)
- {
- if (mPlacement == CENTER)
- mRenderX -= (mRenderW / 2);
- else
- mRenderX -= mRenderW;
- }
- if (mPlacement != TOP_LEFT && mPlacement != TOP_RIGHT)
- {
- if (mPlacement == CENTER)
- mRenderY -= (mRenderH / 2);
- else
- mRenderY -= mRenderH;
- }
- SetPlacement(TOP_LEFT);
- }
-
- return;
+ if (attr)
+ mHighlightImage = PageManager::FindResource(attr->value());
+ }
+
+ // Load the placement
+ LoadPlacement(node->first_node("placement"), &mRenderX, &mRenderY, NULL, NULL, &mPlacement);
+
+ if (mImage && mImage->GetResource())
+ {
+ mRenderW = gr_get_width(mImage->GetResource());
+ mRenderH = gr_get_height(mImage->GetResource());
+
+ // Adjust for placement
+ if (mPlacement != TOP_LEFT && mPlacement != BOTTOM_LEFT)
+ {
+ if (mPlacement == CENTER)
+ mRenderX -= (mRenderW / 2);
+ else
+ mRenderX -= mRenderW;
+ }
+ if (mPlacement != TOP_LEFT && mPlacement != TOP_RIGHT)
+ {
+ if (mPlacement == CENTER)
+ mRenderY -= (mRenderH / 2);
+ else
+ mRenderY -= mRenderH;
+ }
+ SetPlacement(TOP_LEFT);
+ }
+
+ return;
}
int GUIImage::Render(void)
{
- if (isHighlighted && mHighlightImage && mHighlightImage->GetResource()) {
+ if (isHighlighted && mHighlightImage && mHighlightImage->GetResource()) {
gr_blit(mHighlightImage->GetResource(), 0, 0, mRenderW, mRenderH, mRenderX, mRenderY);
return 0;
- } else if (!mImage || !mImage->GetResource()) return -1;
- gr_blit(mImage->GetResource(), 0, 0, mRenderW, mRenderH, mRenderX, mRenderY);
- return 0;
+ }
+ else if (!mImage || !mImage->GetResource())
+ return -1;
+
+ gr_blit(mImage->GetResource(), 0, 0, mRenderW, mRenderH, mRenderX, mRenderY);
+ return 0;
}
int GUIImage::SetRenderPos(int x, int y, int w, int h)
{
- if (w || h) return -1;
- mRenderX = x;
- mRenderY = y;
- return 0;
+ if (w || h)
+ return -1;
+
+ mRenderX = x;
+ mRenderY = y;
+ return 0;
}