summaryrefslogtreecommitdiff
path: root/src/T2DLL/UPoint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/UPoint.cpp')
-rw-r--r--src/T2DLL/UPoint.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/T2DLL/UPoint.cpp b/src/T2DLL/UPoint.cpp
index 0c93ea5..79aeea5 100644
--- a/src/T2DLL/UPoint.cpp
+++ b/src/T2DLL/UPoint.cpp
@@ -1,7 +1,15 @@
#include "UPoint.h"
-/*static*/ void UPoint::MappingInRect(Point&, const RECT&) {
+/*static*/ void UPoint::MappingInRect(Point& ioPt, const RECT& inRect) {
+ ioPt.h = (ioPt.h < inRect.right) ? ioPt.h : inRect.right;
+ ioPt.h = (ioPt.h >= inRect.left) ? ioPt.h : inRect.left;
+ ioPt.v = (ioPt.v < inRect.bottom) ? ioPt.v : inRect.bottom;
+ ioPt.v = (ioPt.v >= inRect.top) ? ioPt.v : inRect.top;
}
-/*static*/ void UPoint::MappingInRect(POINT&, const RECT&) {
+/*static*/ void UPoint::MappingInRect(POINT& ioPt, const RECT& inRect) {
+ ioPt.x = (ioPt.x < inRect.right) ? ioPt.x : inRect.right;
+ ioPt.x = (ioPt.x >= inRect.left) ? ioPt.x : inRect.left;
+ ioPt.y = (ioPt.y < inRect.bottom) ? ioPt.y : inRect.bottom;
+ ioPt.y = (ioPt.y >= inRect.top) ? ioPt.y : inRect.top;
}