diff options
-rw-r--r-- | engines/zvision/render_manager.cpp | 11 | ||||
-rw-r--r-- | engines/zvision/render_manager.h | 8 |
2 files changed, 19 insertions, 0 deletions
diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/render_manager.cpp index c0554dc20a..8ac07632d6 100644 --- a/engines/zvision/render_manager.cpp +++ b/engines/zvision/render_manager.cpp @@ -351,6 +351,17 @@ const Common::Point RenderManager::imageSpaceToWorkingWindowSpace(const Common:: return newPoint; } +bool RenderManager::clipRectToWorkingWindow(Common::Rect &rect) { + if (!_workingWindow.contains(rect)) { + return false; + } + + // We can't clip against the actual working window rect because it's in screen space + // But rect is in working window space + rect.clip(_workingWidth, _workingHeight); + return true; +} + RenderTable *RenderManager::getRenderTable() { return &_renderTable; } diff --git a/engines/zvision/render_manager.h b/engines/zvision/render_manager.h index 0294d6a19f..cbf69b9df2 100644 --- a/engines/zvision/render_manager.h +++ b/engines/zvision/render_manager.h @@ -182,6 +182,14 @@ public: */ const Common::Point imageSpaceToWorkingWindowSpace(const Common::Point &point); + /** + * Clip a rectangle to the working window. If it returns false, the original rect + * is not inside the working window. + * + * @param rect The rectangle to clip against the working window + * @return Is rect at least partially inside the working window (true) or completely outside (false) + */ + bool clipRectToWorkingWindow(Common::Rect &rect); RenderTable *getRenderTable(); uint32 getCurrentBackgroundOffset(); |