aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/saveload-dialog.cpp7
-rw-r--r--gui/widget.cpp13
-rw-r--r--gui/widget.h1
3 files changed, 20 insertions, 1 deletions
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index 1a6083bf9e..12b34e49fb 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -622,7 +622,12 @@ void LoadChooserThumbnailed::updateSaves() {
SaveStateDescriptor desc = _metaEngine->querySaveMetaInfos(_target.c_str(), saveSlot);
SlotButton &curButton = _buttons[curNum];
curButton.setVisible(true);
- curButton.button->setGfx(desc.getThumbnail());
+ const Graphics::Surface *thumbnail = desc.getThumbnail();
+ if (thumbnail) {
+ curButton.button->setGfx(desc.getThumbnail());
+ } else {
+ curButton.button->setGfx(kThumbnailWidth, kThumbnailHeight2, 0, 0, 0);
+ }
curButton.description->setLabel(Common::String::format("%d. %s", saveSlot, desc.getDescription().c_str()));
Common::String tooltip(_("Name: "));
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 1b68e36ea8..3c26f1135b 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -414,6 +414,19 @@ void PicButtonWidget::setGfx(const Graphics::Surface *gfx) {
_gfx->copyFrom(*gfx);
}
+void PicButtonWidget::setGfx(int w, int h, int r, int g, int b) {
+ if (w == -1)
+ w = _w;
+ if (h == -1)
+ h = _h;
+
+ const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat();
+
+ _gfx->free();
+ _gfx->create(w, h, requiredFormat);
+ _gfx->fillRect(Common::Rect(0, 0, w, h), _gfx->format.RGBToColor(r, g, b));
+}
+
void PicButtonWidget::drawWidget() {
g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags());
diff --git a/gui/widget.h b/gui/widget.h
index d80b2ad7e2..bcc9a3f6d3 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -222,6 +222,7 @@ public:
~PicButtonWidget();
void setGfx(const Graphics::Surface *gfx);
+ void setGfx(int w, int h, int r, int g, int b);
void useAlpha(int alpha) { _alpha = alpha; }
void useThemeTransparency(bool enable) { _transparency = enable; }