diff options
Diffstat (limited to 'source/blender/blenlib/intern/rct.c')
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 959d8be466f..5466acdba9f 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -36,11 +36,6 @@ */ #include "DNA_vec_types.h" -#include "BLI_blenlib.h" - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif int BLI_rcti_is_empty(rcti * rect) { @@ -147,6 +142,27 @@ void BLI_translate_rctf(rctf *rect, float x, float y) rect->ymax += y; } +/* change width & height around the central location */ +void BLI_resize_rcti(rcti *rect, int x, int y) +{ + rect->xmin= rect->xmax= (rect->xmax + rect->xmin) / 2; + rect->ymin= rect->ymax= (rect->ymax + rect->ymin) / 2; + rect->xmin -= x / 2; + rect->ymin -= y / 2; + rect->xmax= rect->xmin + x; + rect->ymax= rect->ymin + y; +} + +void BLI_resize_rctf(rctf *rect, float x, float y) +{ + rect->xmin= rect->xmax= (rect->xmax + rect->xmin) * 0.5f; + rect->ymin= rect->ymax= (rect->ymax + rect->ymin) * 0.5f; + rect->xmin -= x * 0.5f; + rect->ymin -= y * 0.5f; + rect->xmax= rect->xmin + x; + rect->ymax= rect->ymin + y; +} + int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest) { float xmin, xmax; |