From 1428cb8950e5bdcfad9d15d0fb2e32ff1dbc0bae Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Tue, 7 Jan 2014 18:39:16 +0700 Subject: ZVISION: Refactoring of renderManager. --- engines/zvision/render_table.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'engines/zvision/render_table.cpp') diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 5a0bae7c22..210c4fc1fb 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -123,6 +123,28 @@ void RenderTable::mutateImage(uint16 *sourceBuffer, uint16 *destBuffer, uint32 d } } +void RenderTable::mutateImage(Graphics::Surface *dstBuf, Graphics::Surface *srcBuf) { + uint32 destOffset = 0; + + uint16 *sourceBuffer = (uint16 *)srcBuf->getPixels(); + uint16 *destBuffer = (uint16 *)dstBuf->getPixels(); + + for (int16 y = 0; y < srcBuf->h; ++y) { + uint32 sourceOffset = y * _numColumns; + + for (int16 x = 0; x < srcBuf->w; ++x) { + uint32 index = sourceOffset + x; + + // RenderTable only stores offsets from the original coordinates + uint32 sourceYIndex = y + _internalBuffer[index].y; + uint32 sourceXIndex = x + _internalBuffer[index].x; + + destBuffer[destOffset] = sourceBuffer[sourceYIndex * _numColumns + sourceXIndex]; + destOffset++; + } + } +} + void RenderTable::generateRenderTable() { switch (_renderState) { case ZVision::RenderTable::PANORAMA: -- cgit v1.2.3