From 39c53260a2e6875dcc0cf5152329bdbaaa601db7 Mon Sep 17 00:00:00 2001 From: Miro Kropacek Date: Sun, 2 Apr 2023 22:27:58 +0200 Subject: [PATCH] ASYLUM: Fix rendering if width != pitch in 8bpp The reason why the engine needs linearly allocated surface is Cursor::update() which passes cursor surfaces directly to CursorMan::replaceCursor(). --- engines/asylum/system/graphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/asylum/system/graphics.cpp b/engines/asylum/system/graphics.cpp index d3f7955833d..71f5bb9fcb5 100644 --- a/engines/asylum/system/graphics.cpp +++ b/engines/asylum/system/graphics.cpp @@ -57,7 +57,7 @@ bool GraphicResource::load(ResourceId id) { void GraphicResource::clear() { for (uint32 i = 0; i < _frames.size(); i++) { - _frames[i].surface.free(); + delete[] (byte*)_frames[i].surface.getPixels(); } _frames.clear(); @@ -141,7 +141,7 @@ void GraphicResource::init(byte *data, int32 size) { uint16 width = READ_LE_UINT16(dataPtr); dataPtr += 2; - _frames[i].surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); + _frames[i].surface.init(width, height, width, new byte[width * height], Graphics::PixelFormat::createFormatCLUT8()); memcpy(_frames[i].surface.getPixels(), dataPtr, (size_t)(width * height)); }