diff options
author | RichieSams | 2013-09-08 03:17:50 -0500 |
---|---|---|
committer | RichieSams | 2013-09-09 11:16:37 -0500 |
commit | 106522661c70e4ff270016f5419cccca5c86820c (patch) | |
tree | f46c84ce4ade56fc6e585d03553a2d292dee3022 /engines/zvision | |
parent | 6e806e51ad38a43fc82fc269ed12151b79ea01bd (diff) | |
download | scummvm-rg350-106522661c70e4ff270016f5419cccca5c86820c.tar.gz scummvm-rg350-106522661c70e4ff270016f5419cccca5c86820c.tar.bz2 scummvm-rg350-106522661c70e4ff270016f5419cccca5c86820c.zip |
ZVISION: Create method for rendering to the working window with binary alpha
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/render_manager.cpp | 20 | ||||
-rw-r--r-- | engines/zvision/render_manager.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index 3793ea8cf9..3f19cae6fe 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -291,6 +291,26 @@ void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, i _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); } +void RenderManager::copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor) { + uint32 destOffset = 0; + uint32 sourceOffset = 0; + uint16 *workingWindowBufferPtr = (uint16 *)_workingWindowBuffer.getBasePtr(destX, destY); + + for (int32 y = 0; y < height; y++) { + for (int32 x = 0; x < width; x++) { + uint16 color = buffer[sourceOffset + x]; + if (color != alphaColor) { + workingWindowBufferPtr[destOffset + x] = color; + } + } + + destOffset += _workingWidth; + sourceOffset += imageWidth; + } + + _workingWindowDirtyRect.extend(Common::Rect(destX, destY, destX + width, destY + height)); +} + const Common::Point RenderManager::screenSpaceToImageSpace(const Common::Point &point) { // Convert from screen space to working window space Common::Point newPoint(point - Common::Point(_workingWindow.left, _workingWindow.top)); diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 9881676583..41a11bd113 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -109,6 +109,7 @@ public: void renderBackbufferToScreen(); void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height); + void copyRectToWorkingWindow(const uint16 *buffer, int32 destX, int32 destY, int32 imageWidth, int32 width, int32 height, int16 alphaColor); /** * Fills the entire workingWindow with the specified color |