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>2020-10-27 05:50:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-27 06:07:34 +0300
commit66800a1deb2dc9e6cd13690a5246fbbea45c16b0 (patch)
tree946efe3dfd8e2fb98764c87ef502a1a1caf44e97 /source/blender/blenlib/intern
parentedf4378c442a24c8f35959a52a1d3e9894e0b6a0 (diff)
BLI_rect: add resize_x/y functions
Without this, it's inconvenient to resize a single axis and doesn't read very well.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/rct.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index f952b62cb61..bec5f0ab3ba 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -623,6 +623,18 @@ void BLI_rctf_recenter(rctf *rect, float x, float y)
}
/* change width & height around the central location */
+void BLI_rcti_resize_x(rcti *rect, int x)
+{
+ rect->xmin = BLI_rcti_cent_x(rect) - (x / 2);
+ rect->xmax = rect->xmin + x;
+}
+
+void BLI_rcti_resize_y(rcti *rect, int y)
+{
+ rect->ymin = BLI_rcti_cent_y(rect) - (y / 2);
+ rect->ymax = rect->ymin + y;
+}
+
void BLI_rcti_resize(rcti *rect, int x, int y)
{
rect->xmin = BLI_rcti_cent_x(rect) - (x / 2);
@@ -639,6 +651,18 @@ void BLI_rcti_pad(rcti *rect, int pad_x, int pad_y)
rect->ymax += pad_y;
}
+void BLI_rctf_resize_x(rctf *rect, float x)
+{
+ rect->xmin = BLI_rctf_cent_x(rect) - (x * 0.5f);
+ rect->xmax = rect->xmin + x;
+}
+
+void BLI_rctf_resize_y(rctf *rect, float y)
+{
+ rect->ymin = BLI_rctf_cent_y(rect) - (y * 0.5f);
+ rect->ymax = rect->ymin + y;
+}
+
void BLI_rctf_resize(rctf *rect, float x, float y)
{
rect->xmin = BLI_rctf_cent_x(rect) - (x * 0.5f);