diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-25 10:31:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-25 10:34:29 +0300 |
commit | 0cb264a282626d1f363d1898695f44285e1e0027 (patch) | |
tree | f35b894c87fd338e71584b5b21d84337e0a73c19 /source/blender/editors/space_node/node_draw.c | |
parent | 17ac860cefe66cbb2abae3448d4a949a6fccc520 (diff) |
Cleanup: pass 'rctf' rectangle to 2D box drawing functions
Passing 4x arguments for the rectangle,
mixed in with round-box radius & color wasn't very readable.
Instead, pass a `rctf` as the first argument to UI box drawing functions.
Diffstat (limited to 'source/blender/editors/space_node/node_draw.c')
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 6ce65cd35cb..037587809b0 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1155,7 +1155,15 @@ static void node_draw_basis(const bContext *C, rctf *rct = &node->totr; UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); UI_draw_roundbox_aa( - true, rct->xmin, rct->ymax - NODE_DY, rct->xmax, rct->ymax, BASIS_RAD, color); + &(const rctf){ + .xmin = rct->xmin, + .xmax = rct->xmax, + .ymin = rct->ymax - NODE_DY, + .ymax = rct->ymax, + }, + true, + BASIS_RAD, + color); /* show/hide icons */ float iconofs = rct->xmax - 0.35f * U.widget_unit; @@ -1306,7 +1314,15 @@ static void node_draw_basis(const bContext *C, UI_draw_roundbox_corner_set(UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT); UI_draw_roundbox_aa( - true, rct->xmin, rct->ymin, rct->xmax, rct->ymax - NODE_DY, BASIS_RAD, color); + &(const rctf){ + .xmin = rct->xmin, + .xmax = rct->xmax, + .ymin = rct->ymin, + .ymax = rct->ymax - NODE_DY, + }, + true, + BASIS_RAD, + color); /* outline active and selected emphasis */ if (node->flag & SELECT) { @@ -1314,7 +1330,16 @@ static void node_draw_basis(const bContext *C, (node->flag & NODE_ACTIVE) ? TH_ACTIVE : TH_SELECT, 0, -40, color); UI_draw_roundbox_corner_set(UI_CNR_ALL); - UI_draw_roundbox_aa(false, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD, color); + UI_draw_roundbox_aa( + &(const rctf){ + .xmin = rct->xmin, + .xmax = rct->xmax, + .ymin = rct->ymin, + .ymax = rct->ymax, + }, + false, + BASIS_RAD, + color); } /* disable lines */ @@ -1369,14 +1394,14 @@ static void node_draw_hidden(const bContext *C, UI_GetThemeColor4fv(color_id, color); } - UI_draw_roundbox_aa(true, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad, color); + UI_draw_roundbox_aa(rct, true, hiddenrad, color); /* outline active and selected emphasis */ if (node->flag & SELECT) { UI_GetThemeColorShadeAlpha4fv( (node->flag & NODE_ACTIVE) ? TH_ACTIVE : TH_SELECT, 0, -40, color); - UI_draw_roundbox_aa(false, rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad, color); + UI_draw_roundbox_aa(rct, false, hiddenrad, color); } /* custom color inline */ @@ -1384,14 +1409,17 @@ static void node_draw_hidden(const bContext *C, GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); - UI_draw_roundbox_3fv_alpha(false, - rct->xmin + 1, - rct->ymin + 1, - rct->xmax - 1, - rct->ymax - 1, - hiddenrad, - node->color, - 1.0f); + UI_draw_roundbox_3fv_alpha( + &(const rctf){ + .xmin = rct->xmin + 1, + .xmax = rct->xmax - 1, + .ymin = rct->ymin + 1, + .ymax = rct->ymax - 1, + }, + false, + hiddenrad, + node->color, + 1.0f); GPU_line_smooth(false); GPU_blend(GPU_BLEND_NONE); @@ -1690,7 +1718,7 @@ static void draw_group_overlay(const bContext *C, ARegion *region) UI_GetThemeColorShadeAlpha4fv(TH_NODE_GROUP, 0, 0, color); UI_draw_roundbox_corner_set(UI_CNR_NONE); - UI_draw_roundbox_4fv(true, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 0, color); + UI_draw_roundbox_4fv(&rect, true, 0, color); GPU_blend(GPU_BLEND_NONE); /* set the block bounds to clip mouse events from underlying nodes */ |