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_view3d/view3d_draw.c | 21 +++++++++++++------ .../space_view3d/view3d_gizmo_navigate_type.c | 24 ++++++++++++++++++++-- 2 files changed, 37 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/space_view3d') diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 5e61d9d6250..eee8549572f 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -723,15 +723,24 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, } if (ca->flag & CAM_SHOW_SAFE_MARGINS) { - UI_draw_safe_areas( - shdr_pos, x1, x2, y1, y2, scene->safe_areas.title, scene->safe_areas.action); + UI_draw_safe_areas(shdr_pos, + &(const rctf){ + .xmin = x1, + .xmax = x2, + .ymin = y1, + .ymax = y2, + }, + scene->safe_areas.title, + scene->safe_areas.action); if (ca->flag & CAM_SHOW_SAFE_CENTER) { UI_draw_safe_areas(shdr_pos, - x1, - x2, - y1, - y2, + &(const rctf){ + .xmin = x1, + .xmax = x2, + .ymin = y1, + .ymax = y2, + }, scene->safe_areas.title_center, scene->safe_areas.action_center); } diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index 07264f75d19..4ac16e8fbe8 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -162,7 +162,16 @@ static void gizmo_axis_draw(const bContext *C, wmGizmo *gz) const float rad = WIDGET_RADIUS; GPU_matrix_push(); GPU_matrix_scale_1f(1.0f / rad); - UI_draw_roundbox_4fv(true, -rad, -rad, rad, rad, rad, gz->color_hi); + UI_draw_roundbox_4fv( + &(const rctf){ + .xmin = -rad, + .xmax = rad, + .ymin = -rad, + .ymax = rad, + }, + true, + rad, + gz->color_hi); GPU_matrix_pop(); } @@ -248,7 +257,18 @@ static void gizmo_axis_draw(const bContext *C, wmGizmo *gz) float scale = ((depth + 1) * 0.08f) + 0.92f; const float rad = WIDGET_RADIUS * AXIS_HANDLE_SIZE * scale; UI_draw_roundbox_4fv_ex( - -rad, -rad, rad, rad, inner_color, NULL, 0.0f, outline_color, AXIS_RING_WIDTH, rad); + &(const rctf){ + .xmin = -rad, + .xmax = rad, + .ymin = -rad, + .ymax = rad, + }, + inner_color, + NULL, + 0.0f, + outline_color, + AXIS_RING_WIDTH, + rad); GPU_matrix_pop(); } -- cgit v1.2.3