aboutsummaryrefslogtreecommitdiff
path: root/gui/widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r--gui/widget.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 62a69d9540..d3de824fc5 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -702,7 +702,7 @@ void GraphicsWidget::setGfx(const Graphics::Surface *gfx) {
_gfx.copyFrom(*gfx);
}
-void GraphicsWidget::setAGfx(const Graphics::TransparentSurface *gfx) {
+void GraphicsWidget::setAGfx(const Graphics::TransparentSurface *gfx, ThemeEngine::AutoScaleMode mode) {
_agfx.free();
if (!gfx || !gfx->getPixels())
@@ -713,12 +713,13 @@ void GraphicsWidget::setAGfx(const Graphics::TransparentSurface *gfx) {
return;
}
- if (gfx->w > _w || gfx->h > _h) {
+ if ((gfx->w > _w || gfx->h > _h) && mode == ThemeEngine::kAutoScaleNone) {
warning("GraphicsWidget has size %dx%d, but a surface with %dx%d is to be set", _w, _h, gfx->w, gfx->h);
return;
}
_agfx.copyFrom(*gfx);
+ _mode = mode;
}
void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) {
@@ -755,10 +756,15 @@ void GraphicsWidget::drawWidget() {
_agfx.convertToInPlace(requiredFormat);
}
- const int x = _x + (_w - _agfx.w) / 2;
- const int y = _y + (_h - _agfx.h) / 2;
+ if (_mode == GUI::ThemeEngine::kAutoScaleNone) {
+ const int x = _x + (_w - _agfx.w) / 2;
+ const int y = _y + (_h - _agfx.h) / 2;
+
+ g_gui.theme()->drawASurface(Common::Rect(x, y, x + _agfx.w, y + _agfx.h), _agfx, _mode);
- g_gui.theme()->drawASurface(Common::Rect(x, y, x + _agfx.w, y + _agfx.h), _agfx, _state, _alpha, _transparency);
+ } else {
+ g_gui.theme()->drawASurface(Common::Rect(_x, _y, _x + _w, _y + _h), _agfx, _mode);
+ }
}
}