diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-21 19:03:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-21 19:03:30 +0400 |
commit | 038e5b2255fedbb1538699eec48f9c20240fbb59 (patch) | |
tree | 7c2be5a654518e5c6bb5c8a7283294f89059af47 /source/blender/editors | |
parent | 84c0aee254ff74e8610a4acf6e5adf237285438a (diff) |
hue correct node: draw hsv backdrop with full alpha.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 91 |
1 files changed, 46 insertions, 45 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 12c88a42888..67fec49b2a2 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1310,7 +1310,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o fx = rect->xmin + zoomx * (-offsx); if (fx > rect->xmin) fx -= dx * (floorf(fx - rect->xmin)); while (fx < rect->xmax) { - glVertex2f(fx, rect->ymin); + glVertex2f(fx, rect->ymin); glVertex2f(fx, rect->ymax); fx += dx; } @@ -1319,7 +1319,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o fy = rect->ymin + zoomy * (-offsy); if (fy > rect->ymin) fy -= dy * (floorf(fy - rect->ymin)); while (fy < rect->ymax) { - glVertex2f(rect->xmin, fy); + glVertex2f(rect->xmin, fy); glVertex2f(rect->xmax, fy); fy += dy; } @@ -1363,53 +1363,54 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect offsy = cumap->curr.ymin - but->aspect / zoomy; /* backdrop */ - if (cumap->flag & CUMA_DO_CLIP) { - gl_shaded_color((unsigned char *)wcol->inner, -20); - glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax); - glColor3ubv((unsigned char *)wcol->inner); - glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx), - rect->ymin + zoomy * (cumap->clipr.ymin - offsy), - rect->xmin + zoomx * (cumap->clipr.xmax - offsx), - rect->ymin + zoomy * (cumap->clipr.ymax - offsy)); + if (but->a1 == UI_GRAD_H) { + /* magic trigger for curve backgrounds */ + rcti grid; + float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */ + + grid.xmin = rect->xmin + zoomx * (-offsx); + grid.xmax = rect->xmax + zoomx * (-offsx); + grid.ymin = rect->ymin + zoomy * (-offsy); + grid.ymax = rect->ymax + zoomy * (-offsy); + + ui_draw_gradient(&grid, col, UI_GRAD_H, 1.0f); + + /* grid, hsv uses different grid */ + gl_shaded_color((unsigned char *)wcol->inner, -16); + /* TODO, grid lines does not line up with colors, need to look into this */ + ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f / 2.0f); } else { - glColor3ubv((unsigned char *)wcol->inner); - glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax); - } - - /* grid, every 0.25 step */ - gl_shaded_color((unsigned char *)wcol->inner, -16); - ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f); - /* grid, every 1.0 step */ - gl_shaded_color((unsigned char *)wcol->inner, -24); - ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f); - /* axes */ - gl_shaded_color((unsigned char *)wcol->inner, -50); - glBegin(GL_LINES); - glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy)); - glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy)); - glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymin); - glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymax); - glEnd(); - - /* magic trigger for curve backgrounds */ - if (but->a1 != -1) { - if (but->a1 == UI_GRAD_H) { - rcti grid; - float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */ - - grid.xmin = rect->xmin + zoomx * (-offsx); - grid.xmax = rect->xmax + zoomx * (-offsx); - grid.ymin = rect->ymin + zoomy * (-offsy); - grid.ymax = rect->ymax + zoomy * (-offsy); - - glEnable(GL_BLEND); - ui_draw_gradient(&grid, col, UI_GRAD_H, 0.5f); - glDisable(GL_BLEND); + if (cumap->flag & CUMA_DO_CLIP) { + gl_shaded_color((unsigned char *)wcol->inner, -20); + glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax); + glColor3ubv((unsigned char *)wcol->inner); + glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx), + rect->ymin + zoomy * (cumap->clipr.ymin - offsy), + rect->xmin + zoomx * (cumap->clipr.xmax - offsx), + rect->ymin + zoomy * (cumap->clipr.ymax - offsy)); + } + else { + glColor3ubv((unsigned char *)wcol->inner); + glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax); } + + /* grid, every 0.25 step */ + gl_shaded_color((unsigned char *)wcol->inner, -16); + ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f); + /* grid, every 1.0 step */ + gl_shaded_color((unsigned char *)wcol->inner, -24); + ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f); + /* axes */ + gl_shaded_color((unsigned char *)wcol->inner, -50); + glBegin(GL_LINES); + glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy)); + glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy)); + glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymin); + glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymax); + glEnd(); } - - + /* cfra option */ /* XXX 2.48 */ #if 0 |