From 47881791be0538f9558b2ef091e1761187df250d Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 4 Sep 2020 19:26:12 +0200 Subject: UI Code Quality: Store curve-button gradient type in derived struct We want to move away from using `uiBut.a1`/`a2`, which is a hard to reason about design. Part of T74432. Also correct comment. --- source/blender/editors/interface/interface_draw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/interface/interface_draw.c') diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 13dd4ce3001..4d53018cd32 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1922,7 +1922,7 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, BLI_rcti_size_y(&scissor_new)); /* Do this first to not mess imm context */ - if (but->a1 == UI_GRAD_H) { + if (but_cumap->gradient_type == UI_GRAD_H) { /* magic trigger for curve backgrounds */ const float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */ @@ -1945,7 +1945,7 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, /* backdrop */ float color_backdrop[4] = {0, 0, 0, 1}; - if (but->a1 == UI_GRAD_H) { + if (but_cumap->gradient_type == UI_GRAD_H) { /* grid, hsv uses different grid */ GPU_blend(GPU_BLEND_ALPHA); ARRAY_SET_ITEMS(color_backdrop, 0, 0, 0, 48.0 / 255.0); @@ -2002,7 +2002,7 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, if (cumap->flag & CUMA_DRAW_SAMPLE) { immBegin(GPU_PRIM_LINES, 2); /* will draw one of the following 3 lines */ - if (but->a1 == UI_GRAD_H) { + if (but_cumap->gradient_type == UI_GRAD_H) { float tsample[3]; float hsv[3]; linearrgb_to_srgb_v3_v3(tsample, cumap->sample); -- cgit v1.2.3