Commit: f2858fbb9a7bd90c63cfdf619c6d21f2f2b57418
Author: Charlie Jolly
Date:   Fri Nov 2 18:56:45 2018 +0000
Branches: blender2.8
https://developer.blender.org/rBf2858fbb9a7bd90c63cfdf619c6d21f2f2b57418

UI: Draw curve map with solid color

Differential Revision: https://developer.blender.org/D3891

===================================================================

M       source/blender/editors/interface/interface_draw.c

===================================================================

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];

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to