diff options
Diffstat (limited to 'source/blender/blenlib/intern/rct.c')
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 127855161c0..91fcb5a5b83 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -296,6 +296,19 @@ void BLI_rctf_translate(rctf *rect, float x, float y) rect->ymax += y; } +void BLI_rcti_recenter(rcti *rect, int x, int y) +{ + const int dx = x - BLI_rcti_cent_x(rect); + const int dy = y - BLI_rcti_cent_y(rect); + BLI_rcti_translate(rect, dx, dy); +} +void BLI_rctf_recenter(rctf *rect, float x, float y) +{ + const float dx = x - BLI_rctf_cent_x(rect); + const float dy = y - BLI_rctf_cent_y(rect); + BLI_rctf_translate(rect, dx, dy); +} + /* change width & height around the central location */ void BLI_rcti_resize(rcti *rect, int x, int y) { |