diff options
Diffstat (limited to 'source/blender/editors')
8 files changed, 44 insertions, 47 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 20add65d02f..d0ec40bbb70 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -703,7 +703,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) widget_draw_vertex_buffer(pos, 0, GL_TRIANGLE_FAN, wtb->inner_v, NULL, wtb->totvert); /* 1/2 solid color */ - immUniformColor4ub(wcol->inner[0], wcol->inner[1], wcol->inner[2], 255); + immUniformColor3ubv((unsigned char *)wcol->inner); for (a = 0; a < wtb->totvert; a++) { inner_v_half[a][0] = MIN2(wtb->inner_v[a][0], x_mid); @@ -3165,7 +3165,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor4f(bw, bw, bw, 1.0f); + immUniformColor3f(bw, bw, bw); immBegin(PRIM_TRIANGLES, 3); immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.9f * height); immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.5f * height); diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 6d6d649b12a..1cf97af7a35 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -239,16 +239,14 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) case ANIMTYPE_SCENE: case ANIMTYPE_OBJECT: { - if (sel) immUniformColor4ub(col1b[0], col1b[1], col1b[2], 0x45); - else immUniformColor4ub(col1b[0], col1b[1], col1b[2], 0x22); + immUniformColor3ubvAlpha(col1b, sel ? 0x45 : 0x22); break; } case ANIMTYPE_FILLACTD: case ANIMTYPE_DSSKEY: case ANIMTYPE_DSWOR: { - if (sel) immUniformColor4ub(col2b[0], col2b[1], col2b[2], 0x45); - else immUniformColor4ub(col2b[0], col2b[1], col2b[2], 0x22); + immUniformColor3ubvAlpha(col2b, sel ? 0x45 : 0x22); break; } case ANIMTYPE_GROUP: @@ -256,17 +254,14 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) bActionGroup *agrp = ale->data; if (show_group_colors && agrp->customCol) { if (sel) { - char *cp = agrp->cs.select; - immUniformColor4ub(cp[0], cp[1], cp[2], 0x45); + immUniformColor3ubvAlpha((unsigned char *)agrp->cs.select, 0x45); } else { - char *cp = agrp->cs.solid; - immUniformColor4ub(cp[0], cp[1], cp[2], 0x1D); + immUniformColor3ubvAlpha((unsigned char *)agrp->cs.solid, 0x1D); } } else { - if (sel) immUniformColor4ub(col1a[0], col1a[1], col1a[2], 0x22); - else immUniformColor4ub(col2a[0], col2a[1], col2a[2], 0x22); + immUniformColor3ubvAlpha(sel ? col1a : col2a, 0x22); } break; } @@ -274,22 +269,16 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) { FCurve *fcu = ale->data; if (show_group_colors && fcu->grp && fcu->grp->customCol) { - unsigned char *cp = (unsigned char *)fcu->grp->cs.active; - - if (sel) immUniformColor4ub(cp[0], cp[1], cp[2], 0x65); - else immUniformColor4ub(cp[0], cp[1], cp[2], 0x0B); + immUniformColor3ubvAlpha((unsigned char *)fcu->grp->cs.active, sel ? 0x65 : 0x0B); } else { - if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x22); - else immUniformColor4ub(col2[0], col2[1], col2[2], 0x22); + immUniformColor3ubvAlpha(sel ? col1 : col2, 0x22); } break; } default: { - if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x22); - else immUniformColor4ub(col2[0], col2[1], col2[2], 0x22); - break; + immUniformColor3ubvAlpha(sel ? col1 : col2, 0x22); } } @@ -301,25 +290,21 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) } else if (ac->datatype == ANIMCONT_GPENCIL) { /* frames less than one get less saturated background */ - if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x22); - else immUniformColor4ub(col2[0], col2[1], col2[2], 0x22); + immUniformColor3ubvAlpha(sel ? col1 : col2, 0x22); immRectf(pos, 0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac)); /* frames one and higher get a saturated background */ - if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x44); - else immUniformColor4ub(col2[0], col2[1], col2[2], 0x44); + immUniformColor3ubvAlpha(sel ? col1 : col2, 0x44); immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac)); } else if (ac->datatype == ANIMCONT_MASK) { /* TODO --- this is a copy of gpencil */ /* frames less than one get less saturated background */ - if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x22); - else immUniformColor4ub(col2[0], col2[1], col2[2], 0x22); + immUniformColor3ubvAlpha(sel ? col1 : col2, 0x22); immRectf(pos, 0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac)); /* frames one and higher get a saturated background */ - if (sel) immUniformColor4ub(col1[0], col1[1], col1[2], 0x44); - else immUniformColor4ub(col2[0], col2[1], col2[2], 0x44); + immUniformColor3ubvAlpha(sel ? col1 : col2, 0x44); immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac)); } } diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 37ce5d8075b..a732cc77aa9 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -952,7 +952,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) * - this is set by the function which creates these * - draw with a fixed opacity of 2 */ - immUniformColor4f(fcu->color[0], fcu->color[1], fcu->color[2], 0.5f); + immUniformColor3fvAlpha(fcu->color, 0.5f); /* simply draw the stored samples */ draw_fcurve_curve_samples(ac, NULL, fcu, &ar->v2d, pos); @@ -1036,7 +1036,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid /* set whatever color the curve has set * - unselected curves draw less opaque to help distinguish the selected ones */ - immUniformColor4f(fcu->color[0], fcu->color[1], fcu->color[2], fcurve_display_alpha(fcu)); + immUniformColor3fvAlpha(fcu->color, fcurve_display_alpha(fcu)); } /* draw F-Curve */ diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index f66234ab22c..cdd9906271c 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -355,7 +355,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d immRecti(pos, color_rect_half.xmin, color_rect_half.ymin, color_quater_x, color_quater_y); glEnable(GL_BLEND); - immUniformColor4f(UNPACK3(finalcol), fp ? fp[3] : (cp[3] / 255.0f)); + immUniformColor3fvAlpha(finalcol, fp ? fp[3] : (cp[3] / 255.0f)); immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); glDisable(GL_BLEND); } diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 576e3eb2d60..1898ee41c40 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -286,7 +286,7 @@ static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float col /* helper call for drawing influence/time control curves for a given NLA-strip */ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, unsigned int pos) { - immUniformColor4f(0.7f, 0.7f, 0.7f, 1.0f); + immUniformColor3f(0.7f, 0.7f, 0.7f); const float yheight = ymaxc - yminc; @@ -674,7 +674,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) /* draw 'embossed' lines above and below the strip for effect */ /* white base-lines */ glLineWidth(2.0f); - immUniformColor4f(1.0f, 1.0f, 1.0f, 0.3); + immUniformColor4f(1.0f, 1.0f, 1.0f, 0.3f); immBegin(PRIM_LINES, 4); immVertex2f(pos, v2d->cur.xmin, yminc + NLACHANNEL_SKIP); immVertex2f(pos, v2d->cur.xmax, yminc + NLACHANNEL_SKIP); 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; diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 51cce607a1c..e4fe3a6b145 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -258,7 +258,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s return; } - immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5); + immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); glEnable(GL_BLEND); @@ -641,7 +641,7 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u immUniformColor4ubv(col); immRectf(pos, (float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); - immUniformColor4ub(col[0], col[1], col[2], col[3] + 50); + immUniformColor3ubvAlpha(col, col[3] + 50); imm_draw_line_box(pos, (float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1); /* outline */ } @@ -649,7 +649,7 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u immUniformColor4ubv(col); immRectf(pos, x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); - immUniformColor4ub(col[0], col[1], col[2], col[3] + 50); + immUniformColor3ubvAlpha(col, col[3] + 50); imm_draw_line_box(pos, x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); /* outline */ } @@ -1310,7 +1310,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq unsigned int texCoord = VertexFormat_add_attrib(imm_format, "texCoord", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); - immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f); + immUniformColor3f(1.0f, 1.0f, 1.0f); immUniform1i("image", GL_TEXTURE0); immBegin(PRIM_TRIANGLE_FAN, 4); @@ -1720,7 +1720,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor3f(0.2, 0.2, 0.2); + immUniformColor3f(0.2f, 0.2f, 0.2f); immBegin(PRIM_LINES, 2); immVertex2f(pos, cfra_over, v2d->cur.ymin); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index e163f88d356..199272f99ed 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1146,7 +1146,7 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z, unsigned pos) glCullFace(GL_BACK); glBlendFunc(GL_ONE, GL_ONE); - immUniformColor4f(0.2f, 0.2f, 0.2f, 1.0f); + immUniformColor3f(0.2f, 0.2f, 0.2f); draw_spot_cone(la, x, z, pos); @@ -1190,7 +1190,7 @@ static void draw_transp_sun_volume(Lamp *la, unsigned pos) glCullFace(GL_BACK); glBlendFunc(GL_ONE, GL_ONE); - immUniformColor4f(0.2f, 0.2f, 0.2f, 1.0f); + immUniformColor4f(0.2f, 0.2f, 0.2f); imm_draw_box(box, true, pos); |