diff options
| author | Johannes Schickel | 2012-06-29 16:15:46 +0200 |
|---|---|---|
| committer | Johannes Schickel | 2012-06-29 16:16:28 +0200 |
| commit | c1426f783d91976d221c059c37b606411445d438 (patch) | |
| tree | 8c56a15443b30d2ecbded0decf02202521eacd7e | |
| parent | e2056bdfd93ba247c819ec3fd2f0b487dde05709 (diff) | |
| download | scummvm-rg350-c1426f783d91976d221c059c37b606411445d438.tar.gz scummvm-rg350-c1426f783d91976d221c059c37b606411445d438.tar.bz2 scummvm-rg350-c1426f783d91976d221c059c37b606411445d438.zip | |
GUI: Use a black rect when no thumbnail is available in the thumbnail load chooser.
| -rw-r--r-- | gui/saveload-dialog.cpp | 7 | ||||
| -rw-r--r-- | gui/widget.cpp | 13 | ||||
| -rw-r--r-- | gui/widget.h | 1 |
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; } |
