[Bf-blender-cvs] [7785a9c9d2a] blender-v2.91-release: BLI_rect: add a float version of the 'pad' function

Campbell Barton noreply at git.blender.org
Tue Nov 17 14:27:00 CET 2020


Commit: 7785a9c9d2a597a163ef085d94602a1b3aa94d70
Author: Campbell Barton
Date:   Tue Nov 17 23:47:44 2020 +1100
Branches: blender-v2.91-release
https://developer.blender.org/rB7785a9c9d2a597a163ef085d94602a1b3aa94d70

BLI_rect: add a float version of the 'pad' function

===================================================================

M	source/blender/blenlib/BLI_rect.h
M	source/blender/blenlib/intern/rct.c

===================================================================

diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 1d742e2c28a..fb52436587f 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -65,6 +65,7 @@ void BLI_rcti_resize(struct rcti *rect, int x, int y);
 void BLI_rcti_resize_x(struct rcti *rect, int x);
 void BLI_rcti_resize_y(struct rcti *rect, int y);
 void BLI_rcti_pad(struct rcti *rect, int pad_x, int pad_y);
+void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y);
 void BLI_rctf_resize(struct rctf *rect, float x, float y);
 void BLI_rctf_resize_x(struct rctf *rect, float x);
 void BLI_rctf_resize_y(struct rctf *rect, float y);
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index bec5f0ab3ba..66b7a821eca 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -651,6 +651,14 @@ void BLI_rcti_pad(rcti *rect, int pad_x, int pad_y)
   rect->ymax += pad_y;
 }
 
+void BLI_rctf_pad(rctf *rect, float pad_x, float pad_y)
+{
+  rect->xmin -= pad_x;
+  rect->ymin -= pad_y;
+  rect->xmax += pad_x;
+  rect->ymax += pad_y;
+}
+
 void BLI_rctf_resize_x(rctf *rect, float x)
 {
   rect->xmin = BLI_rctf_cent_x(rect) - (x * 0.5f);



More information about the Bf-blender-cvs mailing list