Cleanup: remove alpha_check variable from DNA

Just pass as an argument.
This commit is contained in:
Campbell Barton 2018-09-12 15:48:00 +10:00
parent a1651ddc98
commit a8c924423e
2 changed files with 12 additions and 5 deletions

@ -680,7 +680,9 @@ static void widgetbase_outline(uiWidgetBase *wtb)
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
} }
static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) static void widgetbase_draw_ex(
uiWidgetBase *wtb, uiWidgetColors *wcol,
const bool show_alpha_checkers)
{ {
int j, a; int j, a;
@ -690,7 +692,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
if (wtb->draw_inner) { if (wtb->draw_inner) {
BLI_assert(wtb->totvert != 0); BLI_assert(wtb->totvert != 0);
if (wcol->shaded == 0) { if (wcol->shaded == 0) {
if (wcol->alpha_check) { if (show_alpha_checkers) {
float inner_v_half[WIDGET_SIZE_MAX][2]; float inner_v_half[WIDGET_SIZE_MAX][2];
float x_mid = 0.0f; /* used for dumb clamping of values */ float x_mid = 0.0f; /* used for dumb clamping of values */
@ -841,6 +843,11 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
{
widgetbase_draw_ex(wtb, wcol, false);
}
/* *********************** text/icon ************************************** */ /* *********************** text/icon ************************************** */
#define UI_TEXT_CLIP_MARGIN (0.25f * U.widget_unit / but->block->aspect) #define UI_TEXT_CLIP_MARGIN (0.25f * U.widget_unit / but->block->aspect)
@ -3100,9 +3107,9 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
ui_block_cm_to_display_space_v3(but->block, col); ui_block_cm_to_display_space_v3(but->block, col);
rgba_float_to_uchar((unsigned char *)wcol->inner, col); rgba_float_to_uchar((unsigned char *)wcol->inner, col);
const bool show_alpha_checkers = (wcol->inner[3] < 255);
wcol->shaded = 0; wcol->shaded = 0;
wcol->alpha_check = (wcol->inner[3] < 255);
if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) { if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) {
/* Now we reduce alpha of the inner color (i.e. the color shown) /* Now we reduce alpha of the inner color (i.e. the color shown)
@ -3113,7 +3120,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
wcol->inner[3] /= 2; wcol->inner[3] /= 2;
} }
widgetbase_draw(&wtb, wcol); widgetbase_draw_ex(&wtb, wcol, show_alpha_checkers);
if (but->a1 == UI_PALETTE_COLOR && ((Palette *)but->rnapoin.id.data)->active_color == (int)but->a2) { if (but->a1 == UI_PALETTE_COLOR && ((Palette *)but->rnapoin.id.data)->active_color == (int)but->a2) {
float width = rect->xmax - rect->xmin; float width = rect->xmax - rect->xmin;

@ -130,7 +130,7 @@ typedef struct uiWidgetColors {
char text_sel[4]; char text_sel[4];
short shaded; short shaded;
short shadetop, shadedown; short shadetop, shadedown;
short alpha_check; char _pad0[2];
} uiWidgetColors; } uiWidgetColors;
typedef struct uiWidgetStateColors { typedef struct uiWidgetStateColors {