summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Christopher Adduono <jc@adduono.com>2016-11-06 19:17:34 +0100
committerDees Troy <dees_troy@teamw.in>2017-01-11 18:04:29 +0100
commitdcd1e440e009b7861f09e2b718ea489bdcea34b5 (patch)
treea01f1650fd1597ef290d6bf3f627bcd3e3ae18e9
parentbuild: Consolidate the crypto_utils presence tests (diff)
downloadandroid_bootable_recovery-dcd1e440e009b7861f09e2b718ea489bdcea34b5.tar
android_bootable_recovery-dcd1e440e009b7861f09e2b718ea489bdcea34b5.tar.gz
android_bootable_recovery-dcd1e440e009b7861f09e2b718ea489bdcea34b5.tar.bz2
android_bootable_recovery-dcd1e440e009b7861f09e2b718ea489bdcea34b5.tar.lz
android_bootable_recovery-dcd1e440e009b7861f09e2b718ea489bdcea34b5.tar.xz
android_bootable_recovery-dcd1e440e009b7861f09e2b718ea489bdcea34b5.tar.zst
android_bootable_recovery-dcd1e440e009b7861f09e2b718ea489bdcea34b5.zip
-rw-r--r--gui/Android.mk6
-rw-r--r--gui/objects.hpp6
-rw-r--r--gui/pages.cpp27
3 files changed, 34 insertions, 5 deletions
diff --git a/gui/Android.mk b/gui/Android.mk
index b514e5be1..dab35a4ce 100644
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -67,6 +67,12 @@ endif
ifneq ($(TW_Y_OFFSET),)
LOCAL_CFLAGS += -DTW_Y_OFFSET=$(TW_Y_OFFSET)
endif
+ifneq ($(TW_W_OFFSET),)
+ LOCAL_CFLAGS += -DTW_W_OFFSET=$(TW_W_OFFSET)
+endif
+ifneq ($(TW_H_OFFSET),)
+ LOCAL_CFLAGS += -DTW_H_OFFSET=$(TW_H_OFFSET)
+endif
ifeq ($(TW_ROUND_SCREEN), true)
LOCAL_CFLAGS += -DTW_ROUND_SCREEN
endif
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 2a95022d3..750627729 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -42,6 +42,12 @@ using namespace rapidxml;
#ifndef TW_Y_OFFSET
#define TW_Y_OFFSET 0
#endif
+#ifndef TW_W_OFFSET
+#define TW_W_OFFSET 0
+#endif
+#ifndef TW_H_OFFSET
+#define TW_H_OFFSET 0
+#endif
class RenderObject
{
diff --git a/gui/pages.cpp b/gui/pages.cpp
index b6b72966a..d7cb92d63 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -71,6 +71,8 @@ std::vector<language_struct> Language_List;
int tw_x_offset = 0;
int tw_y_offset = 0;
+int tw_w_offset = 0;
+int tw_h_offset = 0;
// Helper routine to convert a string to a color declaration
int ConvertStrToColor(std::string str, COLOR* color)
@@ -895,16 +897,17 @@ int PageSet::LoadDetails(LoadingContext& ctx, xml_node<>* root)
}
#endif
if (width != 0 && height != 0) {
- float scale_w = ((float)gr_fb_width() - ((float)offx * 2.0)) / (float)width;
- float scale_h = ((float)gr_fb_height() - ((float)offy * 2.0)) / (float)height;
+ float scale_w = (((float)gr_fb_width() + (float)tw_w_offset) - ((float)offx * 2.0)) / (float)width;
+ float scale_h = (((float)gr_fb_height() + (float)tw_h_offset) - ((float)offy * 2.0)) / (float)height;
#ifdef TW_ROUND_SCREEN
- float scale_off_w = (float)gr_fb_width() / (float)width;
- float scale_off_h = (float)gr_fb_height() / (float)height;
+ float scale_off_w = ((float)gr_fb_width() + (float)tw_w_offset) / (float)width;
+ float scale_off_h = ((float)gr_fb_height() + (float)tw_h_offset) / (float)height;
tw_x_offset = offx * scale_off_w;
tw_y_offset = offy * scale_off_h;
#endif
if (scale_w != 1 || scale_h != 1) {
- LOGINFO("Scaling theme width %fx and height %fx, offsets x: %i y: %i\n", scale_w, scale_h, tw_x_offset, tw_y_offset);
+ LOGINFO("Scaling theme width %fx and height %fx, offsets x: %i y: %i w: %i h: %i\n",
+ scale_w, scale_h, tw_x_offset, tw_y_offset, tw_w_offset, tw_h_offset);
set_scale_values(scale_w, scale_h);
}
}
@@ -1018,6 +1021,16 @@ int PageSet::LoadVariables(xml_node<>* vars)
child = child->next_sibling("variable");
continue;
}
+ if (strcmp(name->value(), "tw_w_offset") == 0) {
+ tw_w_offset = atoi(value->value());
+ child = child->next_sibling("variable");
+ continue;
+ }
+ if (strcmp(name->value(), "tw_h_offset") == 0) {
+ tw_h_offset = atoi(value->value());
+ child = child->next_sibling("variable");
+ continue;
+ }
p = persist ? atoi(persist->value()) : 0;
string temp = value->value();
string valstr = gui_parse_text(temp);
@@ -1340,6 +1353,8 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string
LOGINFO("Load XML directly\n");
tw_x_offset = TW_X_OFFSET;
tw_y_offset = TW_Y_OFFSET;
+ tw_w_offset = TW_W_OFFSET;
+ tw_h_offset = TW_H_OFFSET;
if (name != "splash") {
LoadLanguageList(NULL);
languageFile = LoadFileToBuffer(TWRES "languages/en.xml", NULL);
@@ -1351,6 +1366,8 @@ int PageManager::LoadPackage(std::string name, std::string package, std::string
LOGINFO("Loading zip theme\n");
tw_x_offset = 0;
tw_y_offset = 0;
+ tw_w_offset = 0;
+ tw_h_offset = 0;
if (!TWFunc::Path_Exists(package))
return -1;
if (sysMapFile(package.c_str(), &map) != 0) {