diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-08-05 08:30:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-08-05 08:30:59 +0400 |
commit | 199ac30459ba0b7c5b30e2267ef5f40652ac4f60 (patch) | |
tree | d155ae5464e2657009c70e1b2ac62c5a9bdb6f17 /source/blender/src/drawipo.c | |
parent | e4a9ad6d62350ace60b1325a93deff2454772bb1 (diff) |
dont draw IPO points outside the ipo view, avoid extra looping also.
Diffstat (limited to 'source/blender/src/drawipo.c')
-rw-r--r-- | source/blender/src/drawipo.c | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index 2689bb9ae66..86d3eb3d5d3 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -1117,20 +1117,31 @@ static void draw_ipovertices(int sel) * on TNT2 / Linux with NVidia's drivers * (at least up to ver. 4349) */ - bglBegin(GL_POINTS); + a= ei->icu->totvert; + + /* Dont bother looping through the points if the last point is to the left of teh xmin */ + bezt= ei->icu->bezt+(a-1); + if ((ei->icu->ipo!=IPO_BEZ || !(ei->flag & IPO_EDIT)) && bezt->vec[1][0] < G.v2d->cur.xmin) + continue; bezt= ei->icu->bezt; - a= ei->icu->totvert; - while(a--) { + bglBegin(GL_POINTS); + + while(a--) { + /* IPO_DISPBITS is used for displaying layer ipo types as well as modes */ if(ei->disptype==IPO_DISPBITS) { ok= 0; + + if (bezt->vec[1][0] > G.v2d->cur.xmax) + break; + if(ei->flag & IPO_EDIT) { if( (bezt->f2 & 1) == sel ) ok= 1; } else ok= 1; - if(ok) { + if(ok && bezt->vec[1][0] > G.v2d->cur.xmin) { val= bezt->vec[1][1]; b= 0; v1[0]= bezt->vec[1][0]; @@ -1144,27 +1155,39 @@ static void draw_ipovertices(int sel) } } } - else { - + else { /* normal non bit curves */ if(ei->flag & IPO_EDIT) { if(ei->icu->ipo==IPO_BEZ) { - if( (bezt->f1 & 1) == sel ) + /* Draw the editmode hendels for a bezier curve */ + if( (bezt->f1 & 1) == sel && bezt->vec[0][0] > G.v2d->cur.xmin) bglVertex3fv(bezt->vec[0]); - if( (bezt->f3 & 1) == sel ) + + if( (bezt->f3 & 1) == sel && bezt->vec[0][0] > G.v2d->cur.xmin) bglVertex3fv(bezt->vec[2]); - } - if( (bezt->f2 & 1) == sel ) + + } else if (bezt->vec[1][0] > G.v2d->cur.xmax) + /* dont draw beyond the bounds for non bezier curves in editmode */ + break; + + if( (bezt->f2 & 1) == sel && bezt->vec[0][0] > G.v2d->cur.xmin) bglVertex3fv(bezt->vec[1]); } else { - bglVertex3fv(bezt->vec[1]); + /* Since were not drawing any spline handels out of editmode + we can break if were beyond the xmax */ + if (bezt->vec[1][0] > G.v2d->cur.xmax) + break; + + /* draw only if in bounds */ + if (bezt->vec[1][0] > G.v2d->cur.xmin) + bglVertex3fv(bezt->vec[1]); + } } bezt++; } - bglEnd(); } } |