diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 82104eb7ae0..e63724980e9 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -373,8 +373,8 @@ const char *ThemeEngine::findModeConfigName(GraphicsMode mode) { bool ThemeEngine::init() { // reset everything and reload the graphics _initOk = false; - setGraphicsMode(_graphicsMode); _overlayFormat = _system->getOverlayFormat(); + setGraphicsMode(_graphicsMode); if (_screen.pixels && _backBuffer.pixels) { _initOk = true; @@ -499,10 +499,10 @@ void ThemeEngine::setGraphicsMode(GraphicsMode mode) { uint32 height = _system->getOverlayHeight(); _backBuffer.free(); - _backBuffer.create(width, height, _bytesPerPixel); + _backBuffer.create(width, height, _overlayFormat); _screen.free(); - _screen.create(width, height, _bytesPerPixel); + _screen.create(width, height, _overlayFormat); delete _vectorRenderer; _vectorRenderer = Graphics::createRenderer(mode); diff --git a/gui/widget.cpp b/gui/widget.cpp index 61f4a0e2491..7a694860d62 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -573,11 +573,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) {