Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-20 19:29:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-20 19:29:02 +0400
commit26f073b327ac31d683e1719ce8371b6e28bf01d6 (patch)
treefecb4fdc3f279436ab3814e60266633ba02de50a /source/blender/blenlib/intern/rct.c
parent831eaf2d7feb63ee6df55a2b00e1d76f793c0a5c (diff)
macros for rectangle center and size
Diffstat (limited to 'source/blender/blenlib/intern/rct.c')
-rw-r--r--source/blender/blenlib/intern/rct.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 9c65c26c72b..61408610520 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -252,8 +252,8 @@ void BLI_rctf_translate(rctf *rect, float x, float y)
/* change width & height around the central location */
void BLI_rcti_resize(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 = rect->xmax = BLI_RCT_CENTER_X(rect);
+ rect->ymin = rect->ymax = BLI_RCT_CENTER_Y(rect);
rect->xmin -= x / 2;
rect->ymin -= y / 2;
rect->xmax = rect->xmin + x;
@@ -262,8 +262,8 @@ void BLI_rcti_resize(rcti *rect, int x, int y)
void BLI_rctf_resize(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 = rect->xmax = BLI_RCT_CENTER_X(rect);
+ rect->ymin = rect->ymax = BLI_RCT_CENTER_Y(rect);
rect->xmin -= x * 0.5f;
rect->ymin -= y * 0.5f;
rect->xmax = rect->xmin + x;