aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/indeo
diff options
context:
space:
mode:
authorColin Snover2017-08-24 16:41:07 -0500
committerColin Snover2017-08-24 20:34:55 -0500
commitd39a9272bf0334e5e98801ba06df89b4f59b79b8 (patch)
tree8b3ee2f3e4d4b86a0bab6fe6b6042e861dd09fab /image/codecs/indeo
parent7dd2c0342d9a650d6bdc4864c702921d3b3fb070 (diff)
downloadscummvm-rg350-d39a9272bf0334e5e98801ba06df89b4f59b79b8.tar.gz
scummvm-rg350-d39a9272bf0334e5e98801ba06df89b4f59b79b8.tar.bz2
scummvm-rg350-d39a9272bf0334e5e98801ba06df89b4f59b79b8.zip
IMAGE: Remove unnecessary extra heap allocation of Indeo surface
Diffstat (limited to 'image/codecs/indeo')
-rw-r--r--image/codecs/indeo/indeo.cpp12
-rw-r--r--image/codecs/indeo/indeo.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/image/codecs/indeo/indeo.cpp b/image/codecs/indeo/indeo.cpp
index f8cd8a1c64..27db365cf0 100644
--- a/image/codecs/indeo/indeo.cpp
+++ b/image/codecs/indeo/indeo.cpp
@@ -479,15 +479,13 @@ IndeoDecoderBase::IndeoDecoderBase(uint16 width, uint16 height, uint bitsPerPixe
break;
}
- _surface = new Graphics::Surface();
- _surface->create(width, height, _pixelFormat);
- _surface->fillRect(Common::Rect(0, 0, width, height), (bitsPerPixel == 32) ? 0xff : 0);
+ _surface.create(width, height, _pixelFormat);
+ _surface.fillRect(Common::Rect(0, 0, width, height), (bitsPerPixel == 32) ? 0xff : 0);
_ctx._bRefBuf = 3; // buffer 2 is used for scalability mode
}
IndeoDecoderBase::~IndeoDecoderBase() {
- _surface->free();
- delete _surface;
+ _surface.free();
IVIPlaneDesc::freeBuffers(_ctx._planes);
if (_ctx._mbVlc._custTab._table)
_ctx._mbVlc._custTab.freeVlc();
@@ -557,7 +555,7 @@ int IndeoDecoderBase::decodeIndeoFrame() {
if (!isNonNullFrame())
return 0;
- assert(_ctx._planes[0]._width <= _surface->w && _ctx._planes[0]._height <= _surface->h);
+ assert(_ctx._planes[0]._width <= _surface.w && _ctx._planes[0]._height <= _surface.h);
result = frame->setDimensions(_ctx._planes[0]._width, _ctx._planes[0]._height);
if (result < 0)
return result;
@@ -578,7 +576,7 @@ int IndeoDecoderBase::decodeIndeoFrame() {
outputPlane(&_ctx._planes[1], frame->_data[2], frame->_linesize[2]);
// Merge the planes into the final surface
- YUVToRGBMan.convert410(_surface, Graphics::YUVToRGBManager::kScaleITU,
+ YUVToRGBMan.convert410(&_surface, Graphics::YUVToRGBManager::kScaleITU,
frame->_data[0], frame->_data[1], frame->_data[2], frame->_width, frame->_height,
frame->_width, frame->_width);
diff --git a/image/codecs/indeo/indeo.h b/image/codecs/indeo/indeo.h
index 962d06817d..6c2a6b17a2 100644
--- a/image/codecs/indeo/indeo.h
+++ b/image/codecs/indeo/indeo.h
@@ -519,7 +519,7 @@ private:
protected:
IVI45DecContext _ctx;
Graphics::PixelFormat _pixelFormat;
- Graphics::Surface *_surface;
+ Graphics::Surface _surface;
/**
* Scan patterns shared between indeo4 and indeo5