diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-12 09:21:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-12 09:21:00 +0300 |
commit | 265b5238de738a821bed0c56fb0ef3abefae0d05 (patch) | |
tree | 2a885fe1c94ede6df4be31ac436387cb2a6ad115 /source | |
parent | 2597cd39982100efeeb13b597f3e432ef9346d85 (diff) | |
parent | a8c924423e2e7103aff60c21e901dc239b54c610 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 21 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 5 |
2 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index e81af2755b1..a8f5d5e7977 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1177,7 +1177,9 @@ static void draw_widgetbase_batch(GPUBatch *batch, uiWidgetBase *wtb) } } -static void widgetbase_draw(uiWidgetBase *wtb, const uiWidgetColors *wcol) +static void widgetbase_draw_ex( + uiWidgetBase *wtb, const uiWidgetColors *wcol, + bool show_alpha_checkers) { unsigned char inner_col1[4] = {0}; unsigned char inner_col2[4] = {0}; @@ -1185,7 +1187,9 @@ static void widgetbase_draw(uiWidgetBase *wtb, const uiWidgetColors *wcol) unsigned char outline_col[4] = {0}; unsigned char tria_col[4] = {0}; /* For color widget. */ - bool alpha_check = (wcol->alpha_check && (wcol->shaded == 0)); + if (wcol->shaded != 0) { + show_alpha_checkers = false; + } GPU_blend(true); @@ -1224,8 +1228,8 @@ static void widgetbase_draw(uiWidgetBase *wtb, const uiWidgetColors *wcol) } /* Draw everything in one drawcall */ - if (inner_col1[3] || inner_col2[3] || outline_col[3] || emboss_col[3] || tria_col[3] || alpha_check) { - widgetbase_set_uniform_colors_ubv(wtb, inner_col1, inner_col2, outline_col, emboss_col, tria_col, alpha_check); + if (inner_col1[3] || inner_col2[3] || outline_col[3] || emboss_col[3] || tria_col[3] || show_alpha_checkers) { + widgetbase_set_uniform_colors_ubv(wtb, inner_col1, inner_col2, outline_col, emboss_col, tria_col, show_alpha_checkers); GPUBatch *roundbox_batch = ui_batch_roundbox_widget_get(wtb->tria1.type); draw_widgetbase_batch(roundbox_batch, wtb); @@ -1234,6 +1238,11 @@ static void widgetbase_draw(uiWidgetBase *wtb, const uiWidgetColors *wcol) GPU_blend(false); } +static void widgetbase_draw(uiWidgetBase *wtb, const uiWidgetColors *wcol) +{ + widgetbase_draw_ex(wtb, wcol, false); +} + /* *********************** text/icon ************************************** */ #define UI_TEXT_CLIP_MARGIN (0.25f * U.widget_unit / but->block->aspect) @@ -3376,9 +3385,9 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat ui_block_cm_to_display_space_v3(but->block, col); rgba_float_to_uchar((unsigned char *)wcol->inner, col); + const bool show_alpha_checkers = (wcol->inner[3] < 255); wcol->shaded = 0; - wcol->alpha_check = (wcol->inner[3] < 255); if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) { /* Now we reduce alpha of the inner color (i.e. the color shown) @@ -3389,7 +3398,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat 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) { float width = rect->xmax - rect->xmin; float height = rect->ymax - rect->ymin; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 362a9232553..10ffabd033d 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -133,11 +133,10 @@ typedef struct uiWidgetColors { char item[4]; char text[4]; char text_sel[4]; - short shaded; + char shaded; + char _pad0[7]; short shadetop, shadedown; - short alpha_check; float roundness; - float pad; } uiWidgetColors; typedef struct uiWidgetStateColors { |