GUI: Prefer Surface::create taking a PixelFormat over the one taking a byte depth.

This commit is contained in:
Johannes Schickel 2011-04-17 16:34:58 +02:00
parent 23479d07f3
commit 2329a00873
2 changed files with 6 additions and 5 deletions

View File

@ -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);

View File

@ -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) {