[Bf-blender-cvs] [fd7352e5a29] master: Cleanup: use term pad instead of padding

Campbell Barton noreply at git.blender.org
Tue May 21 14:45:24 CEST 2019


Commit: fd7352e5a29c8ecfcbacb56e36fefc4428cb9771
Author: Campbell Barton
Date:   Tue May 21 22:27:09 2019 +1000
Branches: master
https://developer.blender.org/rBfd7352e5a29c8ecfcbacb56e36fefc4428cb9771

Cleanup: use term pad instead of padding

- Use min/max instead of bottom/top
  (in keeping with the rest of the BLI_rect API).
- Swap args (was passing in max, min).

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

M	source/blender/blenlib/BLI_rect.h
M	source/blender/blenlib/intern/rct.c
M	source/blender/editors/space_graph/graph_edit.c

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

diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 85cee866c68..e3cd70f7413 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -62,10 +62,10 @@ void BLI_rcti_resize(struct rcti *rect, int x, int y);
 void BLI_rctf_resize(struct rctf *rect, float x, float y);
 void BLI_rcti_scale(rcti *rect, const float scale);
 void BLI_rctf_scale(rctf *rect, const float scale);
-void BLI_rctf_padding_y(struct rctf *rect,
-                        const float boundary_height,
-                        const float padding_top,
-                        const float padding_bottom);
+void BLI_rctf_pad_y(struct rctf *rect,
+                    const float boundary_size,
+                    const float pad_min,
+                    const float pad_max);
 void BLI_rctf_interp(struct rctf *rect,
                      const struct rctf *rect_a,
                      const struct rctf *rect_b,
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index bf0e92b39fb..99288abb38c 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -643,23 +643,23 @@ void BLI_rctf_scale(rctf *rect, const float scale)
   rect->ymax = cent_y + size_y_half;
 }
 
-void BLI_rctf_padding_y(rctf *rect,
-                        const float boundary_height,
-                        const float padding_top,
-                        const float padding_bottom)
+void BLI_rctf_pad_y(rctf *rect,
+                    const float boundary_size,
+                    const float pad_min,
+                    const float pad_max)
 {
-  BLI_assert(padding_top >= 0.0f);
-  BLI_assert(padding_bottom >= 0.0f);
-  BLI_assert(boundary_height > 0.0f);
+  BLI_assert(pad_max >= 0.0f);
+  BLI_assert(pad_min >= 0.0f);
+  BLI_assert(boundary_size > 0.0f);
 
-  float total_padding = padding_top + padding_bottom;
-  if (total_padding == 0.0f) {
+  float total_pad = pad_max + pad_min;
+  if (total_pad == 0.0f) {
     return;
   }
 
-  float total_extend = BLI_rctf_size_y(rect) * total_padding / (boundary_height - total_padding);
-  rect->ymax += total_extend * (padding_top / total_padding);
-  rect->ymin -= total_extend * (padding_bottom / total_padding);
+  float total_extend = BLI_rctf_size_y(rect) * total_pad / (boundary_size - total_pad);
+  rect->ymax += total_extend * (pad_max / total_pad);
+  rect->ymin -= total_extend * (pad_min / total_pad);
 }
 
 void BLI_rctf_interp(rctf *rect, const rctf *rect_a, const rctf *rect_b, const float fac)
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 90cba617129..b3fafa09256 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -287,12 +287,12 @@ static int graphkeys_viewall(bContext *C,
   BLI_rctf_scale(&cur_new, 1.1f);
 
   /* Take regions into account, that could block the view. */
-  float padding_top = UI_SCRUBBING_MARGIN_Y;
-  float padding_bottom = 0;
+  float pad_top = UI_SCRUBBING_MARGIN_Y;
+  float pad_bottom = 0;
   if (!BLI_listbase_is_empty(ED_context_get_markers(C))) {
-    padding_bottom = UI_MARKER_MARGIN_Y;
+    pad_bottom = UI_MARKER_MARGIN_Y;
   }
-  BLI_rctf_padding_y(&cur_new, ac.ar->sizey * UI_DPI_FAC, padding_top, padding_bottom);
+  BLI_rctf_pad_y(&cur_new, ac.ar->sizey * UI_DPI_FAC, pad_bottom, pad_top);
 
   UI_view2d_smooth_view(C, ac.ar, &cur_new, smooth_viewtx);
   return OPERATOR_FINISHED;



More information about the Bf-blender-cvs mailing list