diff options
author | Mike Erwin <significant.bit@gmail.com> | 2017-04-16 20:44:34 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2017-04-16 20:44:34 +0300 |
commit | af61b5eb0c1bef93e8df1434b174944e2b40445d (patch) | |
tree | dad7dbe831385f038af54037fb21b9655248288a /source/blender/editors/space_outliner | |
parent | ae071305404e61f696f3da46b00bf93aa6a4a5a5 (diff) |
cleanup use of immUniformColor
- use best function for the job
- don't specify alpha if 100%
- 'f' for floating point literals
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index bf620686c74..82fdee675b9 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1527,14 +1527,14 @@ static void outliner_draw_tree_element_floating( unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); int coord_y = te_insert->ys; int coord_x = te_insert->xs; - unsigned char col[4]; + float col[4]; if (te_insert == te_floating) { /* don't draw anything */ return; } - UI_GetThemeColorShade4ubv(TH_BACK, -40, col); + UI_GetThemeColorShade4fv(TH_BACK, -40, col); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); glEnable(GL_BLEND); @@ -1542,7 +1542,7 @@ static void outliner_draw_tree_element_floating( if (te_floating->drag_data->insert_type == TE_INSERT_BEFORE) { coord_y += UI_UNIT_Y; } - immUniformColor4ubv(col); + immUniformColor4fv(col); glLineWidth(line_width); immBegin(PRIM_LINE_STRIP, 2); @@ -1552,7 +1552,7 @@ static void outliner_draw_tree_element_floating( } else { BLI_assert(te_floating->drag_data->insert_type == TE_INSERT_INTO); - immUniformColor4ub(UNPACK3(col), col[3] * 0.5f); + immUniformColor3fvAlpha(col, col[3] * 0.5f); immBegin(PRIM_TRIANGLE_STRIP, 4); immVertex2f(pos, coord_x, coord_y + UI_UNIT_Y); @@ -1578,13 +1578,20 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo return; } + const unsigned char grayed_alpha = col[3] / 2; + y1 = y2 = *starty; /* for vertical lines between objects */ for (te = lb->first; te; te = te->next) { bool draw_childs_grayed_out = draw_grayed_out || (te->drag_data != NULL); y2 = *starty; tselem = TREESTORE(te); - immUniformColor4ub(UNPACK3(col), col[3] * (draw_childs_grayed_out ? 0.5f : 1.0f)); + if (draw_childs_grayed_out) { + immUniformColor3ubvAlpha(col, grayed_alpha); + } + else { + immUniformColor4ubv(col); + } /* horizontal line? */ if (tselem->type == 0 && (te->idcode == ID_OB || te->idcode == ID_SCE)) @@ -1597,7 +1604,12 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, SpaceOops *soo col, draw_childs_grayed_out, starty); } - immUniformColor4ub(UNPACK3(col), col[3] * (draw_grayed_out ? 0.5f : 1.0f)); + if (draw_grayed_out) { + immUniformColor3ubvAlpha(col, grayed_alpha); + } + else { + immUniformColor4ubv(col); + } /* vertical line */ te = lb->last; |