From 0cb264a282626d1f363d1898695f44285e1e0027 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 25 Jan 2021 18:31:11 +1100 Subject: 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. --- source/blender/editors/space_text/text_draw.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/space_text/text_draw.c') diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 849766851aa..b38f92402b3 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1010,13 +1010,16 @@ static void draw_textscroll(const SpaceText *st, rcti *scroll, rcti *back) BLI_rcti_size_y(&st->runtime.scroll_region_select)); UI_GetThemeColor3fv(TH_HILITE, col); col[3] = 0.18f; - UI_draw_roundbox_aa(true, - st->runtime.scroll_region_select.xmin + 1, - st->runtime.scroll_region_select.ymin, - st->runtime.scroll_region_select.xmax - 1, - st->runtime.scroll_region_select.ymax, - rad, - col); + UI_draw_roundbox_aa( + &(const rctf){ + .xmin = st->runtime.scroll_region_select.xmin + 1, + .xmax = st->runtime.scroll_region_select.xmax - 1, + .ymin = st->runtime.scroll_region_select.ymin, + .ymax = st->runtime.scroll_region_select.ymax, + }, + true, + rad, + col); } /*********************** draw documentation *******************************/ @@ -1180,7 +1183,14 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc } /* not needed but stands out nicer */ - UI_draw_box_shadow(220, x, y - boxh, x + boxw, y); + UI_draw_box_shadow( + &(const rctf){ + .xmin = x, + .xmax = x + boxw, + .ymin = y - boxh, + .ymax = y, + }, + 220); uint pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); -- cgit v1.2.3