From dc5d474160bcba1eb04fad4474f6294d74f4a6fe Mon Sep 17 00:00:00 2001 From: Martin Gerhardy Date: Sun, 18 Jul 2021 14:18:40 +0200 Subject: [PATCH] MACVENTURE: re-use the read stream to reduce heap allocations --- engines/macventure/gui.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index c7e60e16364..ef8fd829762 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -418,32 +418,29 @@ void Gui::loadBorder(Graphics::MacWindow *target, MVWindowType type, bool active if (stream) { target->loadBorder(*stream, activeFlag, offsets); - delete stream; } if (canHaveTitle) { - stream = _engine->getBorderFile(type, active); if (stream) { + stream->seek(0); target->loadBorder(*stream, activeFlag | Graphics::kWindowBorderTitle, offsets); - delete stream; } } if (canHaveScrollbar) { - stream = _engine->getBorderFile(type, active); if (stream) { + stream->seek(0); target->loadBorder(*stream, activeFlag | Graphics::kWindowBorderScrollbar, offsets); - delete stream; } } if (canHaveTitle && canHaveScrollbar) { - stream = _engine->getBorderFile(type, active); if (stream) { + stream->seek(0); target->loadBorder(*stream, activeFlag | Graphics::kWindowBorderTitle | Graphics::kWindowBorderScrollbar, offsets); - delete stream; } } + delete stream; } void Gui::loadGraphics() {