From b3f0eb8a9db27d3b0659eeb7ce53c69849342439 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 17 Apr 2011 16:31:49 +0200 Subject: SWORD25: Prefer Surface::create taking a PixelFormat over the one taking a byte depth. I am not 100% sure whether the surfaces all use the same format as the screen, but a quick test showed that it still works fine. In case this is wrong please set them up with the correct format. --- engines/sword25/gfx/graphicengine.cpp | 6 ++++-- engines/sword25/gfx/image/renderedimage.cpp | 2 +- engines/sword25/gfx/screenshot.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'engines/sword25/gfx') diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 502d2d3b2a..8bdf2a4a6e 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -112,8 +112,10 @@ bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCoun _screenRect.right = _width; _screenRect.bottom = _height; - _backSurface.create(width, height, 4); - _frameBuffer.create(width, height, 4); + const Graphics::PixelFormat format = g_system->getScreenFormat(); + + _backSurface.create(width, height, format); + _frameBuffer.create(width, height, format); // Standardmäßig ist Vsync an. setVsync(true); diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index b740c0ec68..560663896f 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -409,7 +409,7 @@ void RenderedImage::copyDirectly(int posX, int posY) { */ Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int xSize, int ySize) { Graphics::Surface *s = new Graphics::Surface(); - s->create(xSize, ySize, srcImage.bytesPerPixel); + s->create(xSize, ySize, srcImage.format); int *horizUsage = scaleLine(xSize, srcImage.w); int *vertUsage = scaleLine(ySize, srcImage.h); diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp index 35e94976eb..e06ccb8051 100644 --- a/engines/sword25/gfx/screenshot.cpp +++ b/engines/sword25/gfx/screenshot.cpp @@ -134,7 +134,7 @@ Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data) // Buffer for the output thumbnail Graphics::Surface thumbnail; - thumbnail.create(200, 125, 4); + thumbnail.create(200, 125, g_system->getScreenFormat()); // Über das Zielbild iterieren und einen Pixel zur Zeit berechnen. uint x, y; -- cgit v1.2.3