diff options
author | Matt Ebb <matt@mke3.net> | 2008-02-04 03:14:06 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2008-02-04 03:14:06 +0300 |
commit | 7739d9b628d745b153286267c3a0607ed169cf9f (patch) | |
tree | 5321891f9907320efcabe63b41bf5394ebb4ba8f /source/blender/src/interface_draw.c | |
parent | 5d55228adb707a2e7287a070e4213cc630f58b3b (diff) |
* Change to the 'active line' drawing in colourbands. The wide strip was always ugly, inaccurate and jumped around. Now it uses a finely dashed line.
Diffstat (limited to 'source/blender/src/interface_draw.c')
-rw-r--r-- | source/blender/src/interface_draw.c | 66 |
1 files changed, 41 insertions, 25 deletions
diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c index 9ca260edefa..0cbcff3875a 100644 --- a/source/blender/src/interface_draw.c +++ b/source/blender/src/interface_draw.c @@ -1970,7 +1970,7 @@ static void ui_draw_but_COLORBAND(uiBut *but) ColorBand *coba= (ColorBand *)but->poin; CBData *cbd; float x1, y1, sizex, sizey; - float dx, v3[2], v1[2], v2[2]; + float dx, v3[2], v1[2], v2[2], v1a[2], v2a[2]; int a; if(coba==NULL) return; @@ -2038,39 +2038,55 @@ static void ui_draw_but_COLORBAND(uiBut *but) /* help lines */ v1[0]= v2[0]=v3[0]= x1; v1[1]= y1; + v1a[1]= y1+0.25*sizey; v2[1]= y1+0.5*sizey; + v2a[1]= y1+0.75*sizey; v3[1]= y1+sizey; + cbd= coba->data; glBegin(GL_LINES); for(a=0; a<coba->tot; a++, cbd++) { - v1[0]=v2[0]=v3[0]= x1+ cbd->pos*sizex; - - glColor3ub(0, 0, 0); - glVertex2fv(v1); - glVertex2fv(v2); - - if(a==coba->cur) { - glVertex2f(v1[0]-1, v1[1]); - glVertex2f(v2[0]-1, v2[1]); - glVertex2f(v1[0]+1, v1[1]); - glVertex2f(v2[0]+1, v2[1]); - } - - glColor3ub(255, 255, 255); - glVertex2fv(v2); - glVertex2fv(v3); + v1[0]=v2[0]=v3[0]=v1a[0]=v2a[0]= x1+ cbd->pos*sizex; if(a==coba->cur) { - if(cbd->pos>0.01) { - glVertex2f(v2[0]-1, v2[1]); - glVertex2f(v3[0]-1, v3[1]); - } - if(cbd->pos<0.99) { - glVertex2f(v2[0]+1, v2[1]); - glVertex2f(v3[0]+1, v3[1]); - } + glColor3ub(0, 0, 0); + glVertex2fv(v1); + glVertex2fv(v3); + glEnd(); + + setlinestyle(2); + glBegin(GL_LINES); + glColor3ub(255, 255, 255); + glVertex2fv(v1); + glVertex2fv(v3); + glEnd(); + setlinestyle(0); + glBegin(GL_LINES); + + /* glColor3ub(0, 0, 0); + glVertex2fv(v1); + glVertex2fv(v1a); + glColor3ub(255, 255, 255); + glVertex2fv(v1a); + glVertex2fv(v2); + glColor3ub(0, 0, 0); + glVertex2fv(v2); + glVertex2fv(v2a); + glColor3ub(255, 255, 255); + glVertex2fv(v2a); + glVertex2fv(v3); + */ } + else { + glColor3ub(0, 0, 0); + glVertex2fv(v1); + glVertex2fv(v2); + + glColor3ub(255, 255, 255); + glVertex2fv(v2); + glVertex2fv(v3); + } } glEnd(); } |