diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-07-01 11:22:55 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-07-01 11:22:55 +0400 |
commit | f004893e492cbe29c308c726ab06ae7342d7c6c7 (patch) | |
tree | bc91545d7b5d4fc7e61e020c10e162d7603f53f6 | |
parent | 3f55de56139ae4c8dfeeb3da7b36a8a1a9055493 (diff) |
Fix T40895: Curves panel, zooming out a lot crashes Blender
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 793a92d4dec..ed7cfe7da99 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -476,11 +476,12 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu) static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid) { ChannelDriver *driver; - float samplefreq, ctime; + float samplefreq; float stime, etime; float unitFac; float dx, dy; short mapping_flag = ANIM_get_normalization_flags(ac); + int i, n; /* when opening a blend file on a different sized screen or while dragging the toolbar this can happen * best just bail out in this case */ @@ -524,10 +525,12 @@ static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d * the displayed values appear correctly in the viewport */ glBegin(GL_LINE_STRIP); - - for (ctime = stime; ctime <= etime; ctime += samplefreq) + + for (i = 0, n = (etime - stime) / samplefreq + 0.5f; i < n; ++i) { + float ctime = stime + i * samplefreq; glVertex2f(ctime, evaluate_fcurve(fcu, ctime) * unitFac); - + } + glEnd(); /* restore driver */ |