[Bf-blender-cvs] [1ac3c861fd8] master: Cleanup: remove unused UI_draw_roundbox_shade_y function

Campbell Barton noreply at git.blender.org
Mon Jan 25 08:00:14 CET 2021


Commit: 1ac3c861fd8977f47e7f471b02a838346c486c73
Author: Campbell Barton
Date:   Mon Jan 25 17:57:59 2021 +1100
Branches: master
https://developer.blender.org/rB1ac3c861fd8977f47e7f471b02a838346c486c73

Cleanup: remove unused UI_draw_roundbox_shade_y function

Marked unused 2017 f69678482c849d873b9686cd6068946205db7c2b)

Remove since this remains unused,
split from D10189 to allow reverting if we ever need it back.

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_draw.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 2dc20973b1b..455db025735 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -456,15 +456,6 @@ void UI_draw_roundbox_4fv_ex(float minx,
 
 #if 0 /* unused */
 int UI_draw_roundbox_corner_get(void);
-void UI_draw_roundbox_shade_y(bool filled,
-                              float minx,
-                              float miny,
-                              float maxx,
-                              float maxy,
-                              float rad,
-                              float shadeleft,
-                              float shaderight,
-                              const float col[4]);
 #endif
 
 void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 6a55421f013..1fcfa806661 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -540,137 +540,6 @@ void UI_draw_roundbox_shade_x(bool filled,
   GPU_blend(GPU_BLEND_NONE);
 }
 
-#if 0  /* unused */
-/* linear vertical shade within button or in outline */
-/* view2d scrollers use it */
-void UI_draw_roundbox_shade_y(bool filled,
-                              float minx,
-                              float miny,
-                              float maxx,
-                              float maxy,
-                              float rad,
-                              float shadeleft,
-                              float shaderight,
-                              const float col[4])
-{
-  float vec[7][2] = {
-      {0.195, 0.02},
-      {0.383, 0.067},
-      {0.55, 0.169},
-      {0.707, 0.293},
-      {0.831, 0.45},
-      {0.924, 0.617},
-      {0.98, 0.805},
-  };
-  const float div = maxx - minx;
-  const float idiv = 1.0f / div;
-  float colLeft[3], colRight[3];
-  int vert_count = 0;
-  int a;
-
-  /* mult */
-  for (a = 0; a < 7; a++) {
-    mul_v2_fl(vec[a], rad);
-  }
-
-  GPUVertFormat *format = immVertexFormat();
-  uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
-  uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
-
-  immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
-
-  /* 'shade' defines strength of shading */
-  colLeft[0] = min_ff(1.0f, col[0] + shadeleft);
-  colLeft[1] = min_ff(1.0f, col[1] + shadeleft);
-  colLeft[2] = min_ff(1.0f, col[2] + shadeleft);
-  colRight[0] = max_ff(0.0f, col[0] + shaderight);
-  colRight[1] = max_ff(0.0f, col[1] + shaderight);
-  colRight[2] = max_ff(0.0f, col[2] + shaderight);
-
-  vert_count += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 9 : 1;
-  vert_count += (roundboxtype & UI_CNR_TOP_RIGHT) ? 9 : 1;
-  vert_count += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1;
-  vert_count += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1;
-
-  immBegin(filled ? GPU_PRIM_TRI_FAN : GPU_PRIM_LINE_LOOP, vert_count);
-
-  /* start with corner right-bottom */
-  if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
-    round_box_shade_col(color, colLeft, colRight, 0.0);
-    immVertex2f(pos, maxx - rad, miny);
-
-    for (a = 0; a < 7; a++) {
-      round_box_shade_col(color, colLeft, colRight, vec[a][0] * idiv);
-      immVertex2f(pos, maxx - rad + vec[a][0], miny + vec[a][1]);
-    }
-
-    round_box_shade_col(color, colLeft, colRight, rad * idiv);
-    immVertex2f(pos, maxx, miny + rad);
-  }
-  else {
-    round_box_shade_col(color, colLeft, colRight, 0.0);
-    immVertex2f(pos, maxx, miny);
-  }
-
-  /* corner right-top */
-  if (roundboxtype & UI_CNR_TOP_RIGHT) {
-    round_box_shade_col(color, colLeft, colRight, 0.0);
-    immVertex2f(pos, maxx, maxy - rad);
-
-    for (a = 0; a < 7; a++) {
-
-      round_box_shade_col(color, colLeft, colRight, (div - rad - vec[a][0]) * idiv);
-      immVertex2f(pos, maxx - vec[a][1], maxy - rad + vec[a][0]);
-    }
-    round_box_shade_col(color, colLeft, colRight, (div - rad) * idiv);
-    immVertex2f(pos, maxx - rad, maxy);
-  }
-  else {
-    round_box_shade_col(color, colLeft, colRight, 0.0);
-    immVertex2f(pos, maxx, maxy);
-  }
-
-  /* corner left-top */
-  if (roundboxtype & UI_CNR_TOP_LEFT) {
-    round_box_shade_col(color, colLeft, colRight, (div - rad) * idiv);
-    immVertex2f(pos, minx + rad, maxy);
-
-    for (a = 0; a < 7; a++) {
-      round_box_shade_col(color, colLeft, colRight, (div - rad + vec[a][0]) * idiv);
-      immVertex2f(pos, minx + rad - vec[a][0], maxy - vec[a][1]);
-    }
-
-    round_box_shade_col(color, colLeft, colRight, 1.0);
-    immVertex2f(pos, minx, maxy - rad);
-  }
-  else {
-    round_box_shade_col(color, colLeft, colRight, 1.0);
-    immVertex2f(pos, minx, maxy);
-  }
-
-  /* corner left-bottom */
-  if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
-    round_box_shade_col(color, colLeft, colRight, 1.0);
-    immVertex2f(pos, minx, miny + rad);
-
-    for (a = 0; a < 7; a++) {
-      round_box_shade_col(color, colLeft, colRight, (vec[a][0]) * idiv);
-      immVertex2f(pos, minx + vec[a][1], miny + rad - vec[a][0]);
-    }
-
-    round_box_shade_col(color, colLeft, colRight, 1.0);
-    immVertex2f(pos, minx + rad, miny);
-  }
-  else {
-    round_box_shade_col(color, colLeft, colRight, 1.0);
-    immVertex2f(pos, minx, miny);
-  }
-
-  immEnd();
-  immUnbindProgram();
-}
-#endif /* unused */
-
 void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4])
 {
   const int ofs_y = 4 * U.pixelsize;



More information about the Bf-blender-cvs mailing list