diff options
author | Johannes Schickel | 2006-05-29 14:38:56 +0000 |
---|---|---|
committer | Johannes Schickel | 2006-05-29 14:38:56 +0000 |
commit | 0165c98e00b6b7e6d8cdd74f540c29f8ded34bd7 (patch) | |
tree | f05976bbf55ac1b7d821112d7ad670ad3afbe045 | |
parent | 2dd94dd247129026ca8d2b30e481052a389f4363 (diff) | |
download | scummvm-rg350-0165c98e00b6b7e6d8cdd74f540c29f8ded34bd7.tar.gz scummvm-rg350-0165c98e00b6b7e6d8cdd74f540c29f8ded34bd7.tar.bz2 scummvm-rg350-0165c98e00b6b7e6d8cdd74f540c29f8ded34bd7.zip |
- adds option to fill GraphicsWidgets with a special color
- updates builtin theme config for my next commit
- bumps theme config
svn-id: r22743
-rw-r--r-- | gui/theme-config.cpp | 3 | ||||
-rw-r--r-- | gui/widget.cpp | 19 | ||||
-rw-r--r-- | gui/widget.h | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index b97ba3bd75..5ea0713984 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -293,6 +293,9 @@ const char *Theme::_defaultConfigINI = "scummsaveload_thumbnail=(parent.w - (kThumbnailWidth + 18)) 22\n" "scummsaveload_thumbnail.hPad=4\n" "scummsaveload_thumbnail.vPad=4\n" +"scummsaveload_thumbnail.fillR=0\n" +"scummsaveload_thumbnail.fillG=0\n" +"scummsaveload_thumbnail.fillB=0\n" "scummsaveload_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight\n" "scummsaveload_choose=(prev.x2 + 10) prev.y prev.w prev.h\n" "scummsaveload_extinfo.visible=true\n" diff --git a/gui/widget.cpp b/gui/widget.cpp index 5ae42e6500..d715f6d075 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -350,6 +350,25 @@ void GraphicsWidget::setGfx(const Graphics::Surface *gfx) { memcpy(_gfx.pixels, gfx->pixels, gfx->h * gfx->pitch); } +void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { + if (w == -1) + w = _w; + if (h == -1) + h = _h; + + _gfx.free(); + _gfx.create(w, h, sizeof(OverlayColor)); + + OverlayColor *dst = (OverlayColor*)_gfx.pixels; + // TODO: get rid of g_system usage + OverlayColor fillCol = g_system->RGBToColor(r, g, b); + while (h--) { + for (int i = 0; i < w; ++i) { + *dst++ = fillCol; + } + } +} + void GraphicsWidget::drawWidget(bool hilite) { if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels) { g_gui.theme()->drawSurface(Common::Rect(_x, _y, _x+_w, _y+_h), _gfx, Theme::kStateEnabled, _alpha); diff --git a/gui/widget.h b/gui/widget.h index 9f366c46b7..883343511f 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -270,6 +270,7 @@ public: ~GraphicsWidget(); void setGfx(const Graphics::Surface *gfx); + void setGfx(int w, int h, int r, int g, int b); void useAlpha(int alpha) { _alpha = alpha; } |