diff options
Diffstat (limited to 'xrdp/funcs.c')
-rw-r--r-- | xrdp/funcs.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/xrdp/funcs.c b/xrdp/funcs.c index 4dcc7c06..dfa4abcd 100644 --- a/xrdp/funcs.c +++ b/xrdp/funcs.c @@ -62,15 +62,6 @@ int rect_intersect(struct xrdp_rect* in1, struct xrdp_rect* in2, } /*****************************************************************************/ -int color15(int r, int g, int b) -{ - r = r >> 3; - g = g >> 3; - b = b >> 3; - return (r << 10) | (g << 5) | b; -} - -/*****************************************************************************/ int color16(int r, int g, int b) { r = r >> 3; @@ -84,3 +75,33 @@ int color24(int r, int g, int b) { return r | (g << 8) | (b << 16); } + +/*****************************************************************************/ +/* adjust the bounds to fit in the bitmap */ +/* return false if there is nothing to draw else return true */ +int check_bounds(struct xrdp_bitmap* b, int* x, int* y, int* cx, int* cy) +{ + if (*x >= b->width) + return 0; + if (*y >= b->height) + return 0; + if (*x < 0) + { + *cx += *x; + *x = 0; + } + if (*y < 0) + { + *cy += *y; + *y = 0; + } + if (*cx <= 0) + return 0; + if (*cy <= 0) + return 0; + if (*x + *cx > b->width) + *cx = b->width - *x; + if (*y + *cy > b->height) + *cy = b->height - *y; + return 1; +} |