From d8e45fc438a546bd7e1f8c66e345aafb33bb2a56 Mon Sep 17 00:00:00 2001 From: richiesams Date: Sun, 11 Aug 2013 16:42:40 -0500 Subject: ZVISION: Only allocate memory for the scaled buffer if we're actually going to scale the video --- engines/zvision/video.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'engines/zvision') diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index 2a320cb790..0836eef496 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -106,7 +106,10 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d uint16 finalWidth = origWidth * scale; uint16 finalHeight = origHeight * scale; - byte *scaledVideoFrameBuffer = new byte[finalWidth * finalHeight * bytesPerPixel]; + byte *scaledVideoFrameBuffer; + if (scale != 1) { + scaledVideoFrameBuffer = new byte[finalWidth * finalHeight * bytesPerPixel]; + } uint16 x = ((_width - finalWidth) / 2) + destRect.left; uint16 y = ((_height - finalHeight) / 2) + destRect.top; @@ -158,7 +161,9 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d _clock.start(); - delete[] scaledVideoFrameBuffer; + if (scale != 1) { + delete[] scaledVideoFrameBuffer; + } // Reset the pixel format to the original state initGraphics(_width, _height, true, &_pixelFormat); -- cgit v1.2.3