diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-12 13:24:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-12 13:24:17 +0400 |
commit | 38f91db37c4789dfbca03676f2a92a2f85417d72 (patch) | |
tree | b60309037a40e0b8c9162b32d8fab0786305fa2d /source/blender/blenlib/intern/rct.c | |
parent | c8d29b19968cafe91937ea3c26afef819372c599 (diff) |
add bli rect min/max functions.
Diffstat (limited to 'source/blender/blenlib/intern/rct.c')
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 4ac30da2369..c1ef3e27291 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -211,6 +211,22 @@ void BLI_rctf_init_minmax(struct rctf *rect) rect->xmax = rect->ymax = FLT_MIN; } +void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2]) +{ + if (xy[0] < rect->xmin) rect->xmin = xy[0]; + if (xy[0] > rect->xmax) rect->xmax = xy[0]; + if (xy[1] < rect->ymin) rect->ymin = xy[1]; + if (xy[1] > rect->ymax) rect->ymax = xy[1]; +} + +void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2]) +{ + if (xy[0] < rect->xmin) rect->xmin = xy[0]; + if (xy[0] > rect->xmax) rect->xmax = xy[0]; + if (xy[1] < rect->ymin) rect->ymin = xy[1]; + if (xy[1] > rect->ymax) rect->ymax = xy[1]; +} + void BLI_translate_rcti(rcti *rect, int x, int y) { rect->xmin += x; |