diff options
-rw-r--r-- | gui/Android.mk | 6 | ||||
-rw-r--r-- | gui/objects.hpp | 6 | ||||
-rw-r--r-- | gui/pages.cpp | 27 |
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) { |