diff options
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r-- | gui/widget.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp index f0e91718eb..d3c8d3402d 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -347,7 +347,7 @@ void PicButtonWidget::setGfx(const Graphics::Surface *gfx) { void PicButtonWidget::drawWidget() { g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags()); - if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels) { + if (sizeof(OverlayColor) == _gfx.format.bytesPerPixel && _gfx.pixels) { const int x = _x + (_w - _gfx.w) / 2; const int y = _y + (_h - _gfx.h) / 2; @@ -575,11 +575,12 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { if (h == -1) h = _h; + Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat(); + _gfx.free(); - _gfx.create(w, h, sizeof(OverlayColor)); + _gfx.create(w, h, overlayFormat); OverlayColor *dst = (OverlayColor *)_gfx.pixels; - Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat(); OverlayColor fillCol = overlayFormat.RGBToColor(r, g, b); while (h--) { for (int i = 0; i < w; ++i) { @@ -589,7 +590,7 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { } void GraphicsWidget::drawWidget() { - if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels) { + if (sizeof(OverlayColor) == _gfx.format.bytesPerPixel && _gfx.pixels) { const int x = _x + (_w - _gfx.w) / 2; const int y = _y + (_h - _gfx.h) / 2; |