Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-01-25 10:31:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-01-25 10:34:29 +0300
commit0cb264a282626d1f363d1898695f44285e1e0027 (patch)
treef35b894c87fd338e71584b5b21d84337e0a73c19 /source/blender/editors
parent17ac860cefe66cbb2abae3448d4a949a6fccc520 (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')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c61
-rw-r--r--source/blender/editors/animation/time_scrub_ui.c36
-rw-r--r--source/blender/editors/include/UI_interface.h43
-rw-r--r--source/blender/editors/interface/interface_draw.c217
-rw-r--r--source/blender/editors/interface/interface_icons_event.c10
-rw-r--r--source/blender/editors/interface/interface_panel.c68
-rw-r--r--source/blender/editors/interface/interface_style.c17
-rw-r--r--source/blender/editors/screen/area.c21
-rw-r--r--source/blender/editors/space_file/file_draw.c10
-rw-r--r--source/blender/editors/space_info/textview.c17
-rw-r--r--source/blender/editors/space_nla/nla_draw.c26
-rw-r--r--source/blender/editors/space_node/drawnode.c4
-rw-r--r--source/blender/editors/space_node/node_draw.c56
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c39
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c21
-rw-r--r--source/blender/editors/space_text/text_draw.c26
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c21
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c24
18 files changed, 470 insertions, 247 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 8f6d0045c9c..64fa93773b9 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -133,7 +133,16 @@ static void acf_generic_root_backdrop(bAnimContext *ac,
UI_draw_roundbox_corner_set((expanded) ? UI_CNR_TOP_LEFT :
(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
UI_draw_roundbox_3fv_alpha(
- true, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, color, 1.0f);
+ &(const rctf){
+ .xmin = offset,
+ .xmax = v2d->cur.xmax + EXTRA_SCROLL_PAD,
+ .ymin = yminc,
+ .ymax = ymaxc,
+ },
+ true,
+ 8,
+ color,
+ 1.0f);
}
/* get backdrop color for data expanders under top-level Scene/Object */
@@ -464,7 +473,16 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi
*/
UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
UI_draw_roundbox_3fv_alpha(
- true, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, color, 1.0f);
+ &(const rctf){
+ .xmin = 0,
+ .xmax = v2d->cur.xmax + EXTRA_SCROLL_PAD,
+ .ymin = yminc - 2,
+ .ymax = ymaxc,
+ },
+ true,
+ 8,
+ color,
+ 1.0f);
}
/* name for summary entries */
@@ -875,7 +893,16 @@ static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
UI_draw_roundbox_3fv_alpha(
- true, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, color, 1.0f);
+ &(const rctf){
+ .xmin = offset,
+ .xmax = v2d->cur.xmax + EXTRA_SCROLL_PAD,
+ .ymin = yminc,
+ .ymax = ymaxc,
+ },
+ true,
+ 8,
+ color,
+ 1.0f);
}
/* name for group entries */
@@ -1149,7 +1176,16 @@ static void acf_nla_controls_backdrop(bAnimContext *ac,
/* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
UI_draw_roundbox_3fv_alpha(
- true, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 5, color, 1.0f);
+ &(const rctf){
+ .xmin = offset,
+ .xmax = v2d->cur.xmax + EXTRA_SCROLL_PAD,
+ .ymin = yminc,
+ .ymax = ymaxc,
+ },
+ true,
+ 5,
+ color,
+ 1.0f);
}
/* name for nla controls expander entries */
@@ -3936,13 +3972,16 @@ static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float y
/* draw slightly shifted up vertically to look like it has more separation from other channels,
* but we then need to slightly shorten it so that it doesn't look like it overlaps
*/
- UI_draw_roundbox_4fv(true,
- offset,
- yminc + NLACHANNEL_SKIP,
- (float)v2d->cur.xmax,
- ymaxc + NLACHANNEL_SKIP - 1,
- 8,
- color);
+ UI_draw_roundbox_4fv(
+ &(const rctf){
+ .xmin = offset,
+ .xmax = (float)v2d->cur.xmax,
+ .ymin = yminc + NLACHANNEL_SKIP,
+ .ymax = ymaxc + NLACHANNEL_SKIP - 1,
+ },
+ true,
+ 8,
+ color);
}
/* name for nla action entries */
diff --git a/source/blender/editors/animation/time_scrub_ui.c b/source/blender/editors/animation/time_scrub_ui.c
index 98b4d93fbf1..f5240d67cca 100644
--- a/source/blender/editors/animation/time_scrub_ui.c
+++ b/source/blender/editors/animation/time_scrub_ui.c
@@ -124,23 +124,29 @@ static void draw_current_frame(const Scene *scene,
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_3fv_alpha(true,
- frame_x - box_width / 2 + U.pixelsize / 2,
- scrub_region_rect->ymin + box_padding,
- frame_x + box_width / 2 + U.pixelsize / 2,
- scrub_region_rect->ymax - box_padding,
- 4 * UI_DPI_FAC,
- bg_color,
- 1.0f);
+ UI_draw_roundbox_3fv_alpha(
+ &(const rctf){
+ .xmin = frame_x - box_width / 2 + U.pixelsize / 2,
+ .xmax = frame_x + box_width / 2 + U.pixelsize / 2,
+ .ymin = scrub_region_rect->ymin + box_padding,
+ .ymax = scrub_region_rect->ymax - box_padding,
+ },
+ true,
+ 4 * UI_DPI_FAC,
+ bg_color,
+ 1.0f);
UI_GetThemeColorShade4fv(TH_CFRAME, 5, bg_color);
- UI_draw_roundbox_aa(false,
- frame_x - box_width / 2 + U.pixelsize / 2,
- scrub_region_rect->ymin + box_padding,
- frame_x + box_width / 2 + U.pixelsize / 2,
- scrub_region_rect->ymax - box_padding,
- 4 * UI_DPI_FAC,
- bg_color);
+ UI_draw_roundbox_aa(
+ &(const rctf){
+ .xmin = frame_x - box_width / 2 + U.pixelsize / 2,
+ .xmax = frame_x + box_width / 2 + U.pixelsize / 2,
+ .ymin = scrub_region_rect->ymin + box_padding,
+ .ymax = scrub_region_rect->ymax - box_padding,
+ },
+ true,
+ 4 * UI_DPI_FAC,
+ bg_color);
uchar text_color[4];
UI_GetThemeColor4ubv(TH_HEADER_TEXT_HI, text_color);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 015237ba954..f3c94fb7a28 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -56,6 +56,7 @@ struct bNode;
struct bNodeSocket;
struct bNodeTree;
struct bScreen;
+struct rctf;
struct rcti;
struct uiButSearch;
struct uiFontStyle;
@@ -414,39 +415,22 @@ void UI_draw_anti_tria(
void UI_draw_anti_fan(float tri_array[][2], unsigned int length, const float color[4]);
void UI_draw_roundbox_corner_set(int type);
-void UI_draw_roundbox_aa(
- bool filled, float minx, float miny, float maxx, float maxy, float rad, const float color[4]);
-void UI_draw_roundbox_4fv(
- bool filled, float minx, float miny, float maxx, float maxy, float rad, const float col[4]);
-void UI_draw_roundbox_3ub_alpha(bool filled,
- float minx,
- float miny,
- float maxx,
- float maxy,
+void UI_draw_roundbox_aa(const struct rctf *rect, bool filled, float rad, const float color[4]);
+void UI_draw_roundbox_4fv(const struct rctf *rect, bool filled, float rad, const float col[4]);
+void UI_draw_roundbox_3ub_alpha(const struct rctf *rect,
+ bool filled,
float rad,
const unsigned char col[3],
unsigned char alpha);
-void UI_draw_roundbox_3fv_alpha(bool filled,
- float minx,
- float miny,
- float maxx,
- float maxy,
- float rad,
- const float col[3],
- float alpha);
-void UI_draw_roundbox_shade_x(bool filled,
- float minx,
- float miny,
- float maxx,
- float maxy,
+void UI_draw_roundbox_3fv_alpha(
+ const struct rctf *rect, bool filled, float rad, const float col[3], float alpha);
+void UI_draw_roundbox_shade_x(const struct rctf *rect,
+ bool filled,
float rad,
float shadetop,
float shadedown,
const float col[4]);
-void UI_draw_roundbox_4fv_ex(float minx,
- float miny,
- float maxx,
- float maxy,
+void UI_draw_roundbox_4fv_ex(const struct rctf *rect,
const float inner1[4],
const float inner2[4],
float shade_dir,
@@ -458,14 +442,11 @@ void UI_draw_roundbox_4fv_ex(float minx,
int UI_draw_roundbox_corner_get(void);
#endif
-void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
+void UI_draw_box_shadow(const struct rctf *rect, unsigned char alpha);
void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4]);
void UI_draw_safe_areas(uint pos,
- float x1,
- float x2,
- float y1,
- float y2,
+ const struct rctf *rect,
const float title_aspect[2],
const float action_aspect[2]);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 9880dfcb536..0bae57f14d3 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -81,10 +81,7 @@ int UI_draw_roundbox_corner_get(void)
}
#endif
-void UI_draw_roundbox_4fv_ex(float minx,
- float miny,
- float maxx,
- float maxy,
+void UI_draw_roundbox_4fv_ex(const rctf *rect,
const float inner1[4],
const float inner2[4],
float shade_dir,
@@ -95,14 +92,11 @@ void UI_draw_roundbox_4fv_ex(float minx,
/* WATCH: This is assuming the ModelViewProjectionMatrix is area pixel space.
* If it has been scaled, then it's no longer valid. */
uiWidgetBaseParameters widget_params = {
- .recti.xmin = minx + outline_width,
- .recti.ymin = miny + outline_width,
- .recti.xmax = maxx - outline_width,
- .recti.ymax = maxy - outline_width,
- .rect.xmin = minx,
- .rect.ymin = miny,
- .rect.xmax = maxx,
- .rect.ymax = maxy,
+ .recti.xmin = rect->xmin + outline_width,
+ .recti.ymin = rect->ymin + outline_width,
+ .recti.xmax = rect->xmax - outline_width,
+ .recti.ymax = rect->ymax - outline_width,
+ .rect = *rect,
.radi = rad,
.rad = rad,
.round_corners[0] = (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 1.0f : 0.0f,
@@ -132,14 +126,8 @@ void UI_draw_roundbox_4fv_ex(float minx,
GPU_blend(GPU_BLEND_NONE);
}
-void UI_draw_roundbox_3ub_alpha(bool filled,
- float minx,
- float miny,
- float maxx,
- float maxy,
- float rad,
- const uchar col[3],
- uchar alpha)
+void UI_draw_roundbox_3ub_alpha(
+ const rctf *rect, bool filled, float rad, const uchar col[3], uchar alpha)
{
float colv[4] = {
((float)col[0]) / 255,
@@ -147,26 +135,17 @@ void UI_draw_roundbox_3ub_alpha(bool filled,
((float)col[2]) / 255,
((float)alpha) / 255,
};
- UI_draw_roundbox_4fv_ex(
- minx, miny, maxx, maxy, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
+ UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
}
-void UI_draw_roundbox_3fv_alpha(bool filled,
- float minx,
- float miny,
- float maxx,
- float maxy,
- float rad,
- const float col[3],
- float alpha)
+void UI_draw_roundbox_3fv_alpha(
+ const rctf *rect, bool filled, float rad, const float col[3], float alpha)
{
float colv[4] = {col[0], col[1], col[2], alpha};
- UI_draw_roundbox_4fv_ex(
- minx, miny, maxx, maxy, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
+ UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
}
-void UI_draw_roundbox_aa(
- bool filled, float minx, float miny, float maxx, float maxy, float rad, const float color[4])
+void UI_draw_roundbox_aa(const rctf *rect, bool filled, float rad, const float color[4])
{
/* XXX this is to emulate previous behavior of semitransparent fills but that's was a side effect
* of the previous AA method. Better fix the callers. */
@@ -175,29 +154,19 @@ void UI_draw_roundbox_aa(
colv[3] *= 0.65f;
}
- UI_draw_roundbox_4fv_ex(
- minx, miny, maxx, maxy, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
+ UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
}
-void UI_draw_roundbox_4fv(
- bool filled, float minx, float miny, float maxx, float maxy, float rad, const float col[4])
+void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
{
/* Exactly the same as UI_draw_roundbox_aa but does not do the legacy transparency. */
- UI_draw_roundbox_4fv_ex(
- minx, miny, maxx, maxy, (filled) ? col : NULL, NULL, 1.0f, col, U.pixelsize, rad);
+ UI_draw_roundbox_4fv_ex(rect, (filled) ? col : NULL, NULL, 1.0f, col, U.pixelsize, rad);
}
/* linear horizontal shade within button or in outline */
/* view2d scrollers use it */
-void UI_draw_roundbox_shade_x(bool filled,
- float minx,
- float miny,
- float maxx,
- float maxy,
- float rad,
- float shadetop,
- float shadedown,
- const float col[4])
+void UI_draw_roundbox_shade_x(
+ const rctf *rect, bool filled, float rad, float shadetop, float shadedown, const float col[4])
{
float inner1[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float inner2[4] = {0.0f, 0.0f, 0.0f, 0.0f};
@@ -220,7 +189,7 @@ void UI_draw_roundbox_shade_x(bool filled,
outline[2] = clamp_f(col[2] + shadetop + shadedown, 0.0f, 1.0f);
outline[3] = clamp_f(col[3] + shadetop + shadedown, 0.0f, 1.0f);
- UI_draw_roundbox_4fv_ex(minx, miny, maxx, maxy, inner1, inner2, 1.0f, outline, U.pixelsize, rad);
+ UI_draw_roundbox_4fv_ex(rect, inner1, inner2, 1.0f, outline, U.pixelsize, rad);
}
void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4])
@@ -402,15 +371,12 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region),
* \param x1, x2, y1, y2: The offsets for the view, not the zones.
*/
void UI_draw_safe_areas(uint pos,
- float x1,
- float x2,
- float y1,
- float y2,
+ const rctf *rect,
const float title_aspect[2],
const float action_aspect[2])
{
- const float size_x_half = (x2 - x1) * 0.5f;
- const float size_y_half = (y2 - y1) * 0.5f;
+ const float size_x_half = (rect->xmax - rect->xmin) * 0.5f;
+ const float size_y_half = (rect->ymax - rect->ymin) * 0.5f;
const float *safe_areas[] = {title_aspect, action_aspect};
const int safe_len = ARRAY_SIZE(safe_areas);
@@ -420,10 +386,10 @@ void UI_draw_safe_areas(uint pos,
const float margin_x = safe_areas[i][0] * size_x_half;
const float margin_y = safe_areas[i][1] * size_y_half;
- const float minx = x1 + margin_x;
- const float miny = y1 + margin_y;
- const float maxx = x2 - margin_x;
- const float maxy = y2 - margin_y;
+ const float minx = rect->xmin + margin_x;
+ const float miny = rect->ymin + margin_y;
+ const float maxx = rect->xmax - margin_x;
+ const float maxy = rect->ymax - margin_y;
imm_draw_box_wire_2d(pos, minx, miny, maxx, maxy);
}
@@ -438,7 +404,15 @@ static void draw_scope_end(const rctf *rect)
UI_draw_roundbox_corner_set(UI_CNR_ALL);
const float color[4] = {0.0f, 0.0f, 0.0f, 0.5f};
UI_draw_roundbox_4fv(
- false, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f, color);
+ &(const rctf){
+ .xmin = rect->xmin - 1,
+ .xmax = rect->xmax + 1,
+ .ymin = rect->ymin,
+ .ymax = rect->ymax + 1,
+ },
+ false,
+ 3.0f,
+ color);
}
static void histogram_draw_one(float r,
@@ -531,7 +505,15 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region),
UI_GetThemeColor4fv(TH_PREVIEW_BACK, color);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(
- true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
+ &(const rctf){
+ .xmin = rect.xmin - 1,
+ .xmax = rect.xmax + 1,
+ .ymin = rect.ymin - 1,
+ .ymax = rect.ymax + 1,
+ },
+ true,
+ 3.0f,
+ color);
/* need scissor test, histogram can draw outside of boundary */
int scissor[4];
@@ -673,7 +655,15 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
UI_GetThemeColor4fv(TH_PREVIEW_BACK, color);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(
- true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
+ &(const rctf){
+ .xmin = rect.xmin - 1,
+ .xmax = rect.xmax + 1,
+ .ymin = rect.ymin - 1,
+ .ymax = rect.ymax + 1,
+ },
+ true,
+ 3.0f,
+ color);
/* need scissor test, waveform can draw outside of boundary */
GPU_scissor_get(scissor);
@@ -1002,7 +992,15 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region),
UI_GetThemeColor4fv(TH_PREVIEW_BACK, color);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(
- true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
+ &(const rctf){
+ .xmin = rect.xmin - 1,
+ .xmax = rect.xmax + 1,
+ .ymin = rect.ymin - 1,
+ .ymax = rect.ymax + 1,
+ },
+ true,
+ 3.0f,
+ color);
/* need scissor test, hvectorscope can draw outside of boundary */
int scissor[4];
@@ -1377,7 +1375,16 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec
/* backdrop */
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_3ub_alpha(
- true, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f, wcol->inner, 255);
+ &(const rctf){
+ .xmin = rect->xmin,
+ .xmax = rect->xmax,
+ .ymin = rect->ymin,
+ .ymax = rect->ymax,
+ },
+ true,
+ 5.0f,
+ wcol->inner,
+ 255);
GPU_face_culling(GPU_CULL_BACK);
@@ -2068,7 +2075,15 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
const float color[4] = {0.7f, 0.3f, 0.3f, 0.3f};
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(
- true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
+ &(const rctf){
+ .xmin = rect.xmin - 1,
+ .xmax = rect.xmax + 1,
+ .ymin = rect.ymin,
+ .ymax = rect.ymax + 1,
+ },
+ true,
+ 3.0f,
+ color);
ok = true;
}
@@ -2117,7 +2132,15 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
const float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(
- true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
+ &(const rctf){
+ .xmin = rect.xmin - 1,
+ .xmax = rect.xmax + 1,
+ .ymin = rect.ymin,
+ .ymax = rect.ymax + 1,
+ },
+ true,
+ 3.0f,
+ color);
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
@@ -2180,7 +2203,15 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
const float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(
- true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
+ &(const rctf){
+ .xmin = rect.xmin - 1,
+ .xmax = rect.xmax + 1,
+ .ymin = rect.ymin,
+ .ymax = rect.ymax + 1,
+ },
+ true,
+ 3.0f,
+ color);
}
/* Restore scissor test. */
@@ -2197,14 +2228,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
* would replace / modify the following 3 functions - merwin
*/
-static void ui_shadowbox(uint pos,
- uint color,
- float minx,
- float miny,
- float maxx,
- float maxy,
- float shadsize,
- uchar alpha)
+static void ui_shadowbox(const rctf *rect, uint pos, uint color, float shadsize, uchar alpha)
{
/**
* <pre>
@@ -2219,16 +2243,16 @@ static void ui_shadowbox(uint pos,
* v8______v6_-
* </pre>
*/
- const float v1[2] = {maxx, maxy - 0.3f * shadsize};
- const float v2[2] = {maxx + shadsize, maxy - 0.75f * shadsize};
- const float v3[2] = {maxx, miny};
- const float v4[2] = {maxx + shadsize, miny};
+ const float v1[2] = {rect->xmax, rect->ymax - 0.3f * shadsize};
+ const float v2[2] = {rect->xmax + shadsize, rect->ymax - 0.75f * shadsize};
+ const float v3[2] = {rect->xmax, rect->ymin};
+ const float v4[2] = {rect->xmax + shadsize, rect->ymin};
- const float v5[2] = {maxx + 0.7f * shadsize, miny - 0.7f * shadsize};
+ const float v5[2] = {rect->xmax + 0.7f * shadsize, rect->ymin - 0.7f * shadsize};
- const float v6[2] = {maxx, miny - shadsize};
- const float v7[2] = {minx + 0.3f * shadsize, miny};
- const float v8[2] = {minx + 0.5f * shadsize, miny - shadsize};
+ const float v6[2] = {rect->xmax, rect->ymin - shadsize};
+ const float v7[2] = {rect->xmin + 0.3f * shadsize, rect->ymin};
+ const float v8[2] = {rect->xmin + 0.5f * shadsize, rect->ymin - shadsize};
/* right quad */
immAttr4ub(color, 0, 0, 0, alpha);
@@ -2267,7 +2291,7 @@ static void ui_shadowbox(uint pos,
immVertex2fv(pos, v3);
}
-void UI_draw_box_shadow(uchar alpha, float minx, float miny, float maxx, float maxy)
+void UI_draw_box_shadow(const rctf *rect, uchar alpha)
{
GPU_blend(GPU_BLEND_ALPHA);
@@ -2281,9 +2305,9 @@ void UI_draw_box_shadow(uchar alpha, float minx, float miny, float maxx, float m
immBegin(GPU_PRIM_TRIS, 54);
/* accumulated outline boxes to make shade not linear, is more pleasant */
- ui_shadowbox(pos, color, minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8);
- ui_shadowbox(pos, color, minx, miny, maxx, maxy, 7.0, (40 * alpha) >> 8);
- ui_shadowbox(pos, color, minx, miny, maxx, maxy, 5.0, (80 * alpha) >> 8);
+ ui_shadowbox(rect, pos, color, 11.0, (20 * alpha) >> 8);
+ ui_shadowbox(rect, pos, color, 7.0, (40 * alpha) >> 8);
+ ui_shadowbox(rect, pos, color, 5.0, (80 * alpha) >> 8);
immEnd();
@@ -2358,13 +2382,16 @@ void ui_draw_dropshadow(
/* outline emphasis */
const float color[4] = {0.0f, 0.0f, 0.0f, 0.4f};
- UI_draw_roundbox_4fv(false,
- rct->xmin - 0.5f,
- rct->ymin - 0.5f,
- rct->xmax + 0.5f,
- rct->ymax + 0.5f,
- radius + 0.5f,
- color);
+ UI_draw_roundbox_4fv(
+ &(const rctf){
+ .xmin = rct->xmin - 0.5f,
+ .xmax = rct->xmax + 0.5f,
+ .ymin = rct->ymin - 0.5f,
+ .ymax = rct->ymax + 0.5f,
+ },
+ false,
+ radius + 0.5f,
+ color);
GPU_blend(GPU_BLEND_NONE);
}
diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c
index 223fcbfd45b..3962ff6a702 100644
--- a/source/blender/editors/interface/interface_icons_event.c
+++ b/source/blender/editors/interface/interface_icons_event.c
@@ -118,7 +118,15 @@ void icon_draw_rect_input(float x,
UI_GetThemeColor4fv(TH_TEXT, color);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_aa(
- false, (int)x - U.pixelsize, (int)y, (int)(x + w), (int)(y + h), 3.0f * U.pixelsize, color);
+ &(const rctf){
+ .xmin = (int)x - U.pixelsize,
+ .xmax = (int)(x + w),
+ .ymin = (int)y,
+ .ymax = (int)(y + h),
+ },
+ false,
+ 3.0f * U.pixelsize,
+ color);
const enum {
UNIX,
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 12862363c5b..ac29a1c7f9e 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1122,13 +1122,16 @@ static void panel_draw_highlight_border(const Panel *panel,
/* Abuse the property search theme color for now. */
float color[4];
UI_GetThemeColor4fv(TH_MATCH, color);
- UI_draw_roundbox_aa(false,
- rect->xmin,
- UI_panel_is_closed(panel) ? header_rect->ymin : rect->ymin,
- rect->xmax,
- header_rect->ymax,
- radius,
- color);
+ UI_draw_roundbox_aa(
+ &(const rctf){
+ .xmin = rect->xmin,
+ .xmax = rect->xmax,
+ .ymin = UI_panel_is_closed(panel) ? header_rect->ymin : rect->ymin,
+ .ymax = header_rect->ymax,
+ },
+ false,
+ radius,
+ color);
}
static void panel_draw_aligned_widgets(const uiStyle *style,
@@ -1254,13 +1257,16 @@ static void panel_draw_aligned_backdrop(const Panel *panel,
float color[4];
UI_GetThemeColor4fv(TH_PANEL_SUB_BACK, color);
/* Change the width a little bit to line up with sides. */
- UI_draw_roundbox_aa(true,
- rect->xmin + U.pixelsize,
- rect->ymin + U.pixelsize,
- rect->xmax - U.pixelsize,
- rect->ymax,
- box_wcol->roundness * U.widget_unit,
- color);
+ UI_draw_roundbox_aa(
+ &(const rctf){
+ .xmin = rect->xmin + U.pixelsize,
+ .xmax = rect->xmax - U.pixelsize,
+ .ymin = rect->ymin + U.pixelsize,
+ .ymax = rect->ymax,
+ },
+ true,
+ box_wcol->roundness * U.widget_unit,
+ color);
}
else {
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1545,20 +1551,26 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
{
/* Draw filled rectangle and outline for tab. */
UI_draw_roundbox_corner_set(roundboxtype);
- UI_draw_roundbox_4fv(true,
- rct->xmin,
- rct->ymin,
- rct->xmax,
- rct->ymax,
- tab_curve_radius,
- is_active ? theme_col_tab_active : theme_col_tab_inactive);
- UI_draw_roundbox_4fv(false,
- rct->xmin,
- rct->ymin,
- rct->xmax,
- rct->ymax,
- tab_curve_radius,
- theme_col_tab_outline);
+ UI_draw_roundbox_4fv(
+ &(const rctf){
+ .xmin = rct->xmin,
+ .xmax = rct->xmax,
+ .ymin = rct->ymin,
+ .ymax = rct->ymax,
+ },
+ true,
+ tab_curve_radius,
+ is_active ? theme_col_tab_active : theme_col_tab_inactive);
+ UI_draw_roundbox_4fv(
+ &(const rctf){
+ .xmin = rct->xmin,
+ .xmax = rct->xmax,
+ .ymin = rct->ymin,
+ .ymax = rct->ymax,
+ },
+ false,
+ tab_curve_radius,
+ theme_col_tab_outline);
/* Disguise the outline on one side to join the tab to the panel. */
pos = GPU_vertformat_attr_add(
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index a37fb0dfde1..eaefc2c3736 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -341,13 +341,16 @@ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs,
const float color[4] = {col_bg[0], col_bg[1], col_bg[2], 0.5f};
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_aa(true,
- x - margin,
- (y + decent) - margin,
- x + width + margin,
- (y + decent) + height + margin,
- margin,
- color);
+ UI_draw_roundbox_aa(
+ &(const rctf){
+ .xmin = x - margin,
+ .xmax = x + width + margin,
+ .ymin = (y + decent) - margin,
+ .ymax = (y + decent) + height + margin,
+ },
+ true,
+ margin,
+ color);
}
BLF_position(fs->uifont_id, x, y, 0.0f);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index a11dab0291a..2c71345699f 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -291,7 +291,15 @@ static void region_draw_azone_tab_arrow(ScrArea *area, ARegion *region, AZone *a
float alpha = WM_region_use_viewport(area, region) ? 0.6f : 0.4f;
const float color[4] = {0.05f, 0.05f, 0.05f, alpha};
UI_draw_roundbox_aa(
- true, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, color);
+ &(const rctf){
+ .xmin = (float)az->x1,
+ .xmax = (float)az->x2,
+ .ymin = (float)az->y1,
+ .ymax = (float)az->y2,
+ },
+ true,
+ 4.0f,
+ color);
draw_azone_arrow((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, az->edge);
}
@@ -375,7 +383,16 @@ static void region_draw_status_text(ScrArea *area, ARegion *region)
float color[4] = {0.0f, 0.0f, 0.0f, 0.5f};
UI_GetThemeColor3fv(TH_BACK, color);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_aa(true, x1, y1, x2, y2, 4.0f, color);
+ UI_draw_roundbox_aa(
+ &(const rctf){
+ .xmin = x1,
+ .xmax = x2,
+ .ymin = y1,
+ .ymax = y2,
+ },
+ true,
+ 4.0f,
+ color);
UI_FontThemeColor(fontid, TH_TEXT);
}
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 8e9093151ba..a12c9633798 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -131,7 +131,15 @@ static void draw_tile(int sx, int sy, int width, int height, int colorid, int sh
UI_GetThemeColorShade4fv(colorid, shade, color);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_aa(
- true, (float)sx, (float)(sy - height), (float)(sx + width), (float)sy, 5.0f, color);
+ &(const rctf){
+ .xmin = (float)sx,
+ .xmax = (float)(sx + width),
+ .ymin = (float)(sy - height),
+ .ymax = (float)sy,
+ },
+ true,
+ 5.0f,
+ color);
}
static void file_draw_icon(uiBlock *block,
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index a489216afd1..ef5d9c0aab0 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -225,13 +225,16 @@ static bool textview_draw_string(TextViewDrawState *tds,
rgba_uchar_to_float(col, icon_bg);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_aa(true,
- hpadding,
- line_top - bg_size - vpadding,
- bg_size + hpadding,
- line_top - vpadding,
- 4 * UI_DPI_FAC,
- col);
+ UI_draw_roundbox_aa(
+ &(const rctf){
+ .xmin = hpadding,
+ .xmax = bg_size + hpadding,
+ .ymin = line_top - bg_size - vpadding,
+ .ymax = line_top - vpadding,
+ },
+ true,
+ 4 * UI_DPI_FAC,
+ col);
}
if (icon) {
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 6fe980cf657..eea81e425c2 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -493,7 +493,18 @@ static void nla_draw_strip(SpaceNla *snla,
/* strip is in normal track */
UI_draw_roundbox_corner_set(UI_CNR_ALL); /* all corners rounded */
- UI_draw_roundbox_shade_x(true, strip->start, yminc, strip->end, ymaxc, 0.0, 0.5, 0.1, color);
+ UI_draw_roundbox_shade_x(
+ &(const rctf){
+ .xmin = strip->start,
+ .xmax = strip->end,
+ .ymin = yminc,
+ .ymax = ymaxc,
+ },
+ true,
+ 0.0,
+ 0.5,
+ 0.1,
+ color);
/* restore current vertex format & program (roundbox trashes it) */
shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -547,7 +558,18 @@ static void nla_draw_strip(SpaceNla *snla,
}
else {
/* non-muted - draw solid, rounded outline */
- UI_draw_roundbox_shade_x(false, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1, color);
+ UI_draw_roundbox_shade_x(
+ &(const rctf){
+ .xmin = strip->start,
+ .xmax = strip->end,
+ .ymin = yminc,
+ .ymax = ymaxc,
+ },
+ false,
+ 0.0,
+ 0.0,
+ 0.1,
+ color);
/* restore current vertex format & program (roundbox trashes it) */
shdr_pos = nla_draw_use_dashed_outlines(color, muted);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 130ea430ecd..055e3803e25 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -440,7 +440,7 @@ static void node_draw_frame(const bContext *C,
const rctf *rct = &node->totr;
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_aa(true, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD, color);
+ UI_draw_roundbox_aa(rct, true, BASIS_RAD, color);
/* outline active and selected emphasis */
if (node->flag & SELECT) {
@@ -451,7 +451,7 @@ static void node_draw_frame(const bContext *C,
UI_GetThemeColorShadeAlpha4fv(TH_SELECT, 0, -40, color);
}
- UI_draw_roundbox_aa(false, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD, color);
+ UI_draw_roundbox_aa(rct, false, BASIS_RAD, color);
}
/* label */
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 */
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 15590222423..d424bb2319a 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2695,13 +2695,16 @@ static void outliner_draw_iconrow_number(const uiFontStyle *fstyle,
float offset_x = (float)offsx + UI_UNIT_X * 0.35f;
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_aa(true,
- offset_x + ufac,
- (float)ys - UI_UNIT_Y * 0.2f + ufac,
- offset_x + UI_UNIT_X - ufac,
- (float)ys - UI_UNIT_Y * 0.2f + UI_UNIT_Y - ufac,
- (float)UI_UNIT_Y / 2.0f - ufac,
- color);
+ UI_draw_roundbox_aa(
+ &(const rctf){
+ .xmin = offset_x + ufac,
+ .xmax = offset_x + UI_UNIT_X - ufac,
+ .ymin = (float)ys - UI_UNIT_Y * 0.2f + ufac,
+ .ymax = (float)ys - UI_UNIT_Y * 0.2f + UI_UNIT_Y - ufac,
+ },
+ true,
+ (float)UI_UNIT_Y / 2.0f - ufac,
+ color);
/* Now the numbers. */
uchar text_col[4];
@@ -2751,8 +2754,26 @@ static void outliner_draw_active_indicator(const float minx,
const float radius = UI_UNIT_Y / 4.0f;
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_aa(true, minx, miny + ufac, maxx, maxy - ufac, radius, icon_color);
- UI_draw_roundbox_aa(false, minx, miny + ufac, maxx, maxy - ufac, radius, icon_border);
+ UI_draw_roundbox_aa(
+ &(const rctf){
+ .xmin = minx,
+ .xmax = maxx,
+ .ymin = miny + ufac,
+ .ymax = maxy - ufac,
+ },
+ true,
+ radius,
+ icon_color);
+ UI_draw_roundbox_aa(
+ &(const rctf){
+ .xmin = minx,
+ .xmax = maxx,
+ .ymin = miny + ufac,
+ .ymax = maxy - ufac,
+ },
+ false,
+ radius,
+ icon_border);
GPU_blend(GPU_BLEND_ALPHA); /* Roundbox disables. */
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 72c3e43185b..201df1ceed6 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1447,15 +1447,24 @@ static void sequencer_draw_borders_overlay(const SpaceSeq *sseq,
if (sseq->flag & SEQ_SHOW_SAFE_MARGINS) {
immUniformThemeColorBlend(TH_VIEW_OVERLAY, TH_BACK, 0.25f);
- 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 (sseq->flag & SEQ_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_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);
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();
}