aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision
diff options
context:
space:
mode:
authorRichieSams2013-09-08 15:13:01 -0500
committerRichieSams2013-09-09 11:16:40 -0500
commita415964c6da8f36fcf649f7e0f9fb94791cd02ff (patch)
tree175df90b636ea653927998ef4fb633dc3ed2b5c1 /engines/zvision
parent511cb7447e6ebd9a0c54c3e767eb8ea754fd5398 (diff)
downloadscummvm-rg350-a415964c6da8f36fcf649f7e0f9fb94791cd02ff.tar.gz
scummvm-rg350-a415964c6da8f36fcf649f7e0f9fb94791cd02ff.tar.bz2
scummvm-rg350-a415964c6da8f36fcf649f7e0f9fb94791cd02ff.zip
ZVISION: Create method for clipping a rect to the working window
Diffstat (limited to 'engines/zvision')
-rw-r--r--engines/zvision/render_manager.cpp11
-rw-r--r--engines/zvision/render_manager.h8
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();