diff options
author | Charlie Jolly <mistajolly@gmail.com> | 2018-11-02 21:56:45 +0300 |
---|---|---|
committer | Charlie Jolly <mistajolly@gmail.com> | 2018-11-03 20:42:40 +0300 |
commit | f2858fbb9a7bd90c63cfdf619c6d21f2f2b57418 (patch) | |
tree | 2c82307e63b5432f4471f4c65947769615427c3a /source/blender/editors/interface/interface_draw.c | |
parent | d2b4eaa13711b346df98e432bfd806be91dbac05 (diff) |
UI: Draw curve map with solid color
Differential Revision: https://developer.blender.org/D3891
Diffstat (limited to 'source/blender/editors/interface/interface_draw.c')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index fcff7378754..d696dbd0d88 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1765,43 +1765,54 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti } immEnd(); } + immUnbindProgram(); /* the curve */ - immUniformColor3ubv((unsigned char *)wcol->item); - GPU_line_smooth(true); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformColor3ubvAlpha((unsigned char *)wcol->item, 128); GPU_blend(true); - immBegin(GPU_PRIM_LINE_STRIP, (CM_TABLE + 1) + 2); + GPU_polygon_smooth(true); + immBegin(GPU_PRIM_TRI_STRIP, (CM_TABLE * 2 + 2) + 4); if (cuma->table == NULL) curvemapping_changed(cumap, false); CurveMapPoint *cmp = cuma->table; + float fx, fy; + /* first point */ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) { - immVertex2f(pos, rect->xmin, rect->ymin + zoomy * (cmp[0].y - offsy)); + fx = rect->xmin; + fy = rect->ymin + zoomy * (cmp[0].y - offsy); } else { - float fx = rect->xmin + zoomx * (cmp[0].x - offsx + cuma->ext_in[0]); - float fy = rect->ymin + zoomy * (cmp[0].y - offsy + cuma->ext_in[1]); - immVertex2f(pos, fx, fy); + fx = rect->xmin + zoomx * (cmp[0].x - offsx + cuma->ext_in[0]); + fy = rect->ymin + zoomy * (cmp[0].y - offsy + cuma->ext_in[1]); } + immVertex2f(pos, fx, rect->ymin); + immVertex2f(pos, fx, fy); + /* curve */ for (int a = 0; a <= CM_TABLE; a++) { - float fx = rect->xmin + zoomx * (cmp[a].x - offsx); - float fy = rect->ymin + zoomy * (cmp[a].y - offsy); + fx = rect->xmin + zoomx * (cmp[a].x - offsx); + fy = rect->ymin + zoomy * (cmp[a].y - offsy); + immVertex2f(pos, fx, rect->ymin); immVertex2f(pos, fx, fy); } /* last point */ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) { - immVertex2f(pos, rect->xmax, rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy)); + fx = rect->xmax; + fy = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy); } else { - float fx = rect->xmin + zoomx * (cmp[CM_TABLE].x - offsx - cuma->ext_out[0]); - float fy = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy - cuma->ext_out[1]); - immVertex2f(pos, fx, fy); + fx = rect->xmin + zoomx * (cmp[CM_TABLE].x - offsx - cuma->ext_out[0]); + fy = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy - cuma->ext_out[1]); } + immVertex2f(pos, fx, rect->ymin); + immVertex2f(pos, fx, fy); + immEnd(); - GPU_line_smooth(false); + GPU_polygon_smooth(false); GPU_blend(false); immUnbindProgram(); @@ -1812,7 +1823,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); cmp = cuma->curve; - GPU_point_size(3.0f); + GPU_point_size(4.0f); immBegin(GPU_PRIM_POINTS, cuma->totpoint); for (int a = 0; a < cuma->totpoint; a++) { float color[4]; |