diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-08-04 10:11:26 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-08-04 10:11:26 +0300 |
commit | e6daa161ddb98e5dac6df0ed5f88e2f8c0d13522 (patch) | |
tree | 63c42b69668aeb4f7fff7e1005f731b01b6db8d2 /source/blender/editors/space_clip/clip_draw.c | |
parent | 0db4dab0c356ca30a1cd31af594f6d2febcec143 (diff) |
Tracking: Remove limit of 50 points of the track history
Was quite stupid reason for this: static size of array.
Now we allocate needed amount of points in heap if requested path length is
getting too big.
Diffstat (limited to 'source/blender/editors/space_clip/clip_draw.c')
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 695d04d3850..3ca25b26bdf 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -365,9 +365,11 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackingTrack *track) { +#define MAX_STATIC_PATH 64 int count = sc->path_length; int i, a, b, curindex = -1; - float path[102][2]; + float path_static[(MAX_STATIC_PATH + 1) * 2][2]; + float (*path)[2]; int tiny = sc->flag & SC_SHOW_TINY_MARKER, framenr, start_frame; MovieTrackingMarker *marker; @@ -380,6 +382,13 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if (marker->framenr != framenr || marker->flag & MARKER_DISABLED) return; + if (count < MAX_STATIC_PATH) { + path = path_static; + } + else { + path = MEM_mallocN(sizeof(*path) * (count + 1) * 2, "path"); + } + a = count; i = framenr - 1; while (i >= framenr - count) { @@ -470,6 +479,10 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin glVertex2f(path[i][0], path[i][1]); } glEnd(); + + if (path != path_static) { + MEM_freeN(path); + } } static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, |