SDL: Do not set Surface::pixels directly anymore.

This commit is contained in:
Johannes Schickel 2013-08-03 04:07:44 +02:00
parent d5298006f3
commit 9a80fa88e0

View File

@ -1308,15 +1308,13 @@ Graphics::Surface *SurfaceSdlGraphicsManager::lockScreen() {
if (SDL_LockSurface(_screen) == -1) if (SDL_LockSurface(_screen) == -1)
error("SDL_LockSurface failed: %s", SDL_GetError()); error("SDL_LockSurface failed: %s", SDL_GetError());
_framebuffer.pixels = _screen->pixels; _framebuffer.init(_screen->w, _screen->h, _screen->pitch, _screen->pixels,
_framebuffer.w = _screen->w;
_framebuffer.h = _screen->h;
_framebuffer.pitch = _screen->pitch;
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR
_framebuffer.format = _screenFormat; _screenFormat
#else #else
_framebuffer.format = Graphics::PixelFormat::createFormatCLUT8(); Graphics::PixelFormat::createFormatCLUT8()
#endif #endif
);
return &_framebuffer; return &_framebuffer;
} }
@ -2062,15 +2060,12 @@ void SurfaceSdlGraphicsManager::displayMessageOnOSD(const char *msg) {
error("displayMessageOnOSD: SDL_LockSurface failed: %s", SDL_GetError()); error("displayMessageOnOSD: SDL_LockSurface failed: %s", SDL_GetError());
Graphics::Surface dst; Graphics::Surface dst;
dst.pixels = _osdSurface->pixels; dst.init(_osdSurface->w, _osdSurface->h, _osdSurface->pitch, _osdSurface->pixels,
dst.w = _osdSurface->w; Graphics::PixelFormat(_osdSurface->format->BytesPerPixel,
dst.h = _osdSurface->h; 8 - _osdSurface->format->Rloss, 8 - _osdSurface->format->Gloss,
dst.pitch = _osdSurface->pitch; 8 - _osdSurface->format->Bloss, 8 - _osdSurface->format->Aloss,
dst.format = Graphics::PixelFormat(_osdSurface->format->BytesPerPixel, _osdSurface->format->Rshift, _osdSurface->format->Gshift,
8 - _osdSurface->format->Rloss, 8 - _osdSurface->format->Gloss, _osdSurface->format->Bshift, _osdSurface->format->Ashift));
8 - _osdSurface->format->Bloss, 8 - _osdSurface->format->Aloss,
_osdSurface->format->Rshift, _osdSurface->format->Gshift,
_osdSurface->format->Bshift, _osdSurface->format->Ashift);
// The font we are going to use: // The font we are going to use:
const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont); const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont);