diff options
author | dscho <dscho> | 2005-01-18 22:58:59 +0000 |
---|---|---|
committer | dscho <dscho> | 2005-01-18 22:58:59 +0000 |
commit | dd923e866021418379ee88b8a927597f616fbc84 (patch) | |
tree | 7dd7e239f8334dabac332a030cb00c212dbdda94 /libvncserver/rfbregion.c | |
parent | 9cc78e546033fe8cbc576a9fe1084338ceb47928 (diff) | |
download | libtdevnc-dd923e866021418379ee88b8a927597f616fbc84.tar.gz libtdevnc-dd923e866021418379ee88b8a927597f616fbc84.zip |
add convenience function to clip using x2,y2 instead of w,h
Diffstat (limited to 'libvncserver/rfbregion.c')
-rwxr-xr-x | libvncserver/rfbregion.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libvncserver/rfbregion.c b/libvncserver/rfbregion.c index e8d11f0..fdac51e 100755 --- a/libvncserver/rfbregion.c +++ b/libvncserver/rfbregion.c @@ -803,6 +803,28 @@ sraClipRect(int *x, int *y, int *w, int *h, return (*w>0) && (*h>0); } +rfbBool +sraClipRect2(int *x, int *y, int *x2, int *y2, + int cx, int cy, int cx2, int cy2) { + if (*x < cx) + *x = cx; + if (*y < cy) + *y = cy; + if (*x >= cx2) + *x = cx2-1; + if (*y >= cy2) + *y = cy2-1; + if (*x2 <= cx) + *x2 = cx+1; + if (*y2 <= cy) + *y2 = cy+1; + if (*x2 > cx2) + *x2 = cx2; + if (*y2 > cy2) + *y2 = cy2; + return (*x2>*x) && (*y2>*y); +} + /* test */ #ifdef SRA_TEST |