GUI: Normalize width/height parameters

The fact that ThemeLayout had them int, and GuiObject as uint, was
leading to number of unexpected overflows.
This commit is contained in:
Eugene Sandulenko 2020-05-09 21:04:53 +02:00
parent 77c51088ee
commit 6aacdb1938
8 changed files with 22 additions and 18 deletions

View file

@ -71,7 +71,7 @@ void ThemeLayout::resetLayout() {
_children[i]->resetLayout();
}
bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y, uint16 &w, uint16 &h) {
bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) {
if (name.empty()) {
assert(getLayoutType() == kLayoutMain);
x = _x; y = _y;
@ -158,7 +158,7 @@ void ThemeLayout::debugDraw(Graphics::Surface *screen, const Graphics::Font *fon
#endif
bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int16 &y, uint16 &w, uint16 &h) {
bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) {
if (name == _name) {
x = _x; y = _y;
w = _w; h = _h;
@ -229,7 +229,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
_w = _defaultW > 0 ? MIN(_defaultW, g_system->getOverlayWidth()) : -1;
_h = _defaultH > 0 ? MIN(_defaultH, g_system->getOverlayHeight()) : -1;
} else {
if (!g_gui.xmlEval()->getWidgetData(_overlays, _x, _y, (uint16 &) _w, (uint16 &) _h)) {
if (!g_gui.xmlEval()->getWidgetData(_overlays, _x, _y, _w, _h)) {
warning("Unable to retrieve overlayed dialog position %s", _overlays.c_str());
}