diff options
Diffstat (limited to 'source/blender/editors/space_clip/clip_draw.c')
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 222 |
1 files changed, 111 insertions, 111 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 2e16a9095f0..a9b23d5b939 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -32,7 +32,7 @@ #include "DNA_gpencil_types.h" #include "DNA_movieclip_types.h" #include "DNA_scene_types.h" -#include "DNA_object_types.h" /* SELECT */ +#include "DNA_object_types.h" /* SELECT */ #include "DNA_mask_types.h" #include "MEM_guardedalloc.h" @@ -69,7 +69,7 @@ #include "BLF_api.h" -#include "clip_intern.h" // own include +#include "clip_intern.h" // own include /*********************** main area drawing *************************/ @@ -277,10 +277,10 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, glScalef(zoomx, zoomy, 1.0f); glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f); - glTexCoord2f(1.0f, 0.0f); glVertex2f(width, 0.0f); - glTexCoord2f(1.0f, 1.0f); glVertex2f(width, height); - glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, height); + glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f); + glTexCoord2f(1.0f, 0.0f); glVertex2f(width, 0.0f); + glTexCoord2f(1.0f, 1.0f); glVertex2f(width, height); + glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f, height); glEnd(); glPopMatrix(); @@ -320,10 +320,10 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf, glMultMatrixf(sc->stabmat); glBegin(GL_LINE_LOOP); - glVertex2f(0.0f, 0.0f); - glVertex2f(width, 0.0f); - glVertex2f(width, height); - glVertex2f(0.0f, height); + glVertex2f(0.0f, 0.0f); + glVertex2f(width, 0.0f); + glVertex2f(width, height); + glVertex2f(0.0f, height); glEnd(); glPopMatrix(); @@ -399,17 +399,17 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if (TRACK_VIEW_SELECTED(sc, track)) { glPointSize(5.0f); glBegin(GL_POINTS); - for (i = a; i < b; i++) { - if (i != curindex) - glVertex2f(path[i][0], path[i][1]); - } + for (i = a; i < b; i++) { + if (i != curindex) + glVertex2f(path[i][0], path[i][1]); + } glEnd(); } glLineWidth(3.0f); glBegin(GL_LINE_STRIP); - for (i = a; i < b; i++) - glVertex2f(path[i][0], path[i][1]); + for (i = a; i < b; i++) + glVertex2f(path[i][0], path[i][1]); glEnd(); glLineWidth(1.0f); } @@ -419,25 +419,25 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if (TRACK_VIEW_SELECTED(sc, track)) { glPointSize(3.0f); glBegin(GL_POINTS); - for (i = a; i < b; i++) { - if (i == count + 1) - UI_ThemeColor(TH_PATH_AFTER); + for (i = a; i < b; i++) { + if (i == count + 1) + UI_ThemeColor(TH_PATH_AFTER); - if (i != curindex) - glVertex2f(path[i][0], path[i][1]); - } + if (i != curindex) + glVertex2f(path[i][0], path[i][1]); + } glEnd(); } UI_ThemeColor(TH_PATH_BEFORE); glBegin(GL_LINE_STRIP); - for (i = a; i < b; i++) { - if (i == count + 1) - UI_ThemeColor(TH_PATH_AFTER); + for (i = a; i < b; i++) { + if (i == count + 1) + UI_ThemeColor(TH_PATH_AFTER); - glVertex2f(path[i][0], path[i][1]); - } + glVertex2f(path[i][0], path[i][1]); + } glEnd(); glPointSize(1.0f); } @@ -470,24 +470,24 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT if (tiny) glPointSize(3.0f); else glPointSize(4.0f); glBegin(GL_POINTS); - glVertex2f(pos[0], pos[1]); + glVertex2f(pos[0], pos[1]); glEnd(); glPointSize(1.0f); } else { if (!tiny) glLineWidth(3.0f); glBegin(GL_LINES); - glVertex2f(pos[0] + px[0]*2, pos[1]); - glVertex2f(pos[0] + px[0]*8, pos[1]); + glVertex2f(pos[0] + px[0] * 2, pos[1]); + glVertex2f(pos[0] + px[0] * 8, pos[1]); - glVertex2f(pos[0] - px[0]*2, pos[1]); - glVertex2f(pos[0] - px[0]*8, pos[1]); + glVertex2f(pos[0] - px[0] * 2, pos[1]); + glVertex2f(pos[0] - px[0] * 8, pos[1]); - glVertex2f(pos[0], pos[1] - px[1]*2); - glVertex2f(pos[0], pos[1] - px[1]*8); + glVertex2f(pos[0], pos[1] - px[1] * 2); + glVertex2f(pos[0], pos[1] - px[1] * 8); - glVertex2f(pos[0], pos[1] + px[1]*2); - glVertex2f(pos[0], pos[1] + px[1]*8); + glVertex2f(pos[0], pos[1] + px[1] * 2); + glVertex2f(pos[0], pos[1] + px[1] * 8); glEnd(); if (!tiny) glLineWidth(1.0f); } @@ -502,10 +502,10 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT if (sc->flag & SC_SHOW_MARKER_PATTERN) { glBegin(GL_LINE_LOOP); - glVertex2fv(marker->pattern_corners[0]); - glVertex2fv(marker->pattern_corners[1]); - glVertex2fv(marker->pattern_corners[2]); - glVertex2fv(marker->pattern_corners[3]); + glVertex2fv(marker->pattern_corners[0]); + glVertex2fv(marker->pattern_corners[1]); + glVertex2fv(marker->pattern_corners[2]); + glVertex2fv(marker->pattern_corners[3]); glEnd(); } @@ -513,10 +513,10 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0); if (sc->flag & SC_SHOW_MARKER_SEARCH && show_search) { glBegin(GL_LINE_LOOP); - glVertex2f(marker->search_min[0], marker->search_min[1]); - glVertex2f(marker->search_max[0], marker->search_min[1]); - glVertex2f(marker->search_max[0], marker->search_max[1]); - glVertex2f(marker->search_min[0], marker->search_max[1]); + glVertex2f(marker->search_min[0], marker->search_min[1]); + glVertex2f(marker->search_max[0], marker->search_min[1]); + glVertex2f(marker->search_max[0], marker->search_max[1]); + glVertex2f(marker->search_min[0], marker->search_max[1]); glEnd(); } glPopMatrix(); @@ -546,7 +546,7 @@ static void track_colors(MovieTrackingTrack *track, int act, float col[3], float } static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, - float marker_pos[2], int width, int height, int act, int sel) + float marker_pos[2], int width, int height, int act, int sel) { int tiny = sc->flag & SC_SHOW_TINY_MARKER; int show_search = 0; @@ -588,7 +588,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glPointSize(2.0f); glBegin(GL_POINTS); - glVertex2f(pos[0], pos[1]); + glVertex2f(pos[0], pos[1]); glEnd(); if (!tiny) @@ -596,17 +596,17 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } else { glBegin(GL_LINES); - glVertex2f(pos[0] + px[0]*3, pos[1]); - glVertex2f(pos[0] + px[0]*7, pos[1]); + glVertex2f(pos[0] + px[0] * 3, pos[1]); + glVertex2f(pos[0] + px[0] * 7, pos[1]); - glVertex2f(pos[0] - px[0]*3, pos[1]); - glVertex2f(pos[0] - px[0]*7, pos[1]); + glVertex2f(pos[0] - px[0] * 3, pos[1]); + glVertex2f(pos[0] - px[0] * 7, pos[1]); - glVertex2f(pos[0], pos[1] - px[1]*3); - glVertex2f(pos[0], pos[1] - px[1]*7); + glVertex2f(pos[0], pos[1] - px[1] * 3); + glVertex2f(pos[0], pos[1] - px[1] * 7); - glVertex2f(pos[0], pos[1] + px[1]*3); - glVertex2f(pos[0], pos[1] + px[1]*7); + glVertex2f(pos[0], pos[1] + px[1] * 3); + glVertex2f(pos[0], pos[1] + px[1] * 7); glEnd(); glColor3f(0.0f, 0.0f, 0.0f); @@ -616,8 +616,8 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glLogicOp(GL_NOR); glBegin(GL_LINES); - glVertex2fv(pos); - glVertex2fv(marker_pos); + glVertex2fv(pos); + glVertex2fv(marker_pos); glEnd(); glDisable(GL_COLOR_LOGIC_OP); @@ -656,16 +656,16 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } glBegin(GL_LINE_LOOP); - glVertex2fv(marker->pattern_corners[0]); - glVertex2fv(marker->pattern_corners[1]); - glVertex2fv(marker->pattern_corners[2]); - glVertex2fv(marker->pattern_corners[3]); + glVertex2fv(marker->pattern_corners[0]); + glVertex2fv(marker->pattern_corners[1]); + glVertex2fv(marker->pattern_corners[2]); + glVertex2fv(marker->pattern_corners[3]); glEnd(); } /* search */ show_search = TRACK_VIEW_SELECTED(sc, track) && - ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0); + ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0); if ((track->search_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_SEARCH) && show_search) { if (track->flag & TRACK_LOCKED) { if (act) @@ -689,10 +689,10 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } glBegin(GL_LINE_LOOP); - glVertex2f(marker->search_min[0], marker->search_min[1]); - glVertex2f(marker->search_max[0], marker->search_min[1]); - glVertex2f(marker->search_max[0], marker->search_max[1]); - glVertex2f(marker->search_min[0], marker->search_max[1]); + glVertex2f(marker->search_min[0], marker->search_min[1]); + glVertex2f(marker->search_max[0], marker->search_min[1]); + glVertex2f(marker->search_max[0], marker->search_max[1]); + glVertex2f(marker->search_min[0], marker->search_max[1]); glEnd(); } @@ -733,10 +733,10 @@ static void draw_marker_slide_square(float x, float y, float dx, float dy, int o } glBegin(GL_QUADS); - glVertex3f(x - tdx, y + tdy, 0.0f); - glVertex3f(x + tdx, y + tdy, 0.0f); - glVertex3f(x + tdx, y - tdy, 0.0f); - glVertex3f(x - tdx, y - tdy, 0.0f); + glVertex3f(x - tdx, y + tdy, 0.0f); + glVertex3f(x + tdx, y + tdy, 0.0f); + glVertex3f(x + tdx, y - tdy, 0.0f); + glVertex3f(x - tdx, y - tdy, 0.0f); glEnd(); } @@ -753,9 +753,9 @@ static void draw_marker_slide_triangle(float x, float y, float dx, float dy, int } glBegin(GL_TRIANGLES); - glVertex3f(x, y, 0.0f); - glVertex3f(x - tdx, y, 0.0f); - glVertex3f(x, y + tdy, 0.0f); + glVertex3f(x, y, 0.0f); + glVertex3f(x - tdx, y, 0.0f); + glVertex3f(x, y + tdy, 0.0f); glEnd(); } @@ -874,7 +874,7 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } if ((sc->flag & SC_SHOW_MARKER_SEARCH) && - ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0)) + ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0)) { dx = marker->search_min[0]; dy = marker->search_min[1]; @@ -893,8 +893,8 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra mul_m4_v3(sc->stabmat, pos); - pos[0] = pos[0]*zoomx; - pos[1] = pos[1]*zoomy - fontsize; + pos[0] = pos[0] * zoomx; + pos[1] = pos[1] * zoomy - fontsize; if (marker->flag & MARKER_DISABLED) strcpy(state, "disabled"); @@ -934,8 +934,8 @@ static void view2d_to_region_float(View2D *v2d, float x, float y, float *regionx y = -v2d->cur.ymin / (v2d->cur.ymax - v2d->cur.ymin); /* convert proportional distances to screen coordinates */ - *regionx = v2d->mask.xmin + x*(v2d->mask.xmax - v2d->mask.xmin); - *regiony = v2d->mask.ymin + y*(v2d->mask.ymax - v2d->mask.ymin); + *regionx = v2d->mask.xmin + x * (v2d->mask.xmax - v2d->mask.xmin); + *regiony = v2d->mask.ymin + y * (v2d->mask.ymax - v2d->mask.ymin); } static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, @@ -987,7 +987,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, /* undistort */ if (count) { - marker_pos = MEM_callocN(2*sizeof(float)*count, "draw_tracking_tracks marker_pos"); + marker_pos = MEM_callocN(2 * sizeof(float) * count, "draw_tracking_tracks marker_pos"); track = tracksbase->first; fp = marker_pos; @@ -1121,10 +1121,10 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, glColor3f(1.0f, 0.0f, 0.0f); glBegin(GL_POINTS); - if (undistort) - glVertex3f(pos[0] / width, pos[1] / (height * aspy), 0); - else - glVertex3f(npos[0] / width, npos[1] / (height * aspy), 0); + if (undistort) + glVertex3f(pos[0] / width, pos[1] / (height * aspy), 0); + else + glVertex3f(npos[0] / width, npos[1] / (height * aspy), 0); glEnd(); } } @@ -1260,7 +1260,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, BKE_tracking_apply_intrinsics(tracking, pos, grid[i][j]); grid[i][j][0] /= width; - grid[i][j][1] /= height*aspy; + grid[i][j][1] /= height * aspy; pos[0] += dx; } @@ -1273,17 +1273,17 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, for (i = 0; i <= n; i++) { glBegin(GL_LINE_STRIP); - for (j = 0; j <= n; j++) { - glVertex2fv(grid[i][j]); - } + for (j = 0; j <= n; j++) { + glVertex2fv(grid[i][j]); + } glEnd(); } for (j = 0; j <= n; j++) { glBegin(GL_LINE_STRIP); - for (i = 0; i <= n; i++) { - glVertex2fv(grid[i][j]); - } + for (i = 0; i <= n; i++) { + glVertex2fv(grid[i][j]); + } glEnd(); } } @@ -1328,40 +1328,40 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, if (stroke->flag & GP_STROKE_2DSPACE) { if (stroke->totpoints > 1) { glBegin(GL_LINE_STRIP); - for (i = 0; i < stroke->totpoints - 1; i++) { - float npos[2], dpos[2], len; - int steps; + for (i = 0; i < stroke->totpoints - 1; i++) { + float npos[2], dpos[2], len; + int steps; - pos[0] = (stroke->points[i].x + offsx) * width; - pos[1] = (stroke->points[i].y + offsy) * height * aspy; + pos[0] = (stroke->points[i].x + offsx) * width; + pos[1] = (stroke->points[i].y + offsy) * height * aspy; - npos[0] = (stroke->points[i + 1].x + offsx) * width; - npos[1] = (stroke->points[i + 1].y + offsy) * height * aspy; + npos[0] = (stroke->points[i + 1].x + offsx) * width; + npos[1] = (stroke->points[i + 1].y + offsy) * height * aspy; - len = len_v2v2(pos, npos); - steps = ceil(len / 5.0f); + len = len_v2v2(pos, npos); + steps = ceil(len / 5.0f); - /* we want to distort only long straight lines */ - if (stroke->totpoints == 2) { - BKE_tracking_invert_intrinsics(tracking, pos, pos); - BKE_tracking_invert_intrinsics(tracking, npos, npos); - } + /* we want to distort only long straight lines */ + if (stroke->totpoints == 2) { + BKE_tracking_invert_intrinsics(tracking, pos, pos); + BKE_tracking_invert_intrinsics(tracking, npos, npos); + } - sub_v2_v2v2(dpos, npos, pos); - mul_v2_fl(dpos, 1.0f / steps); + sub_v2_v2v2(dpos, npos, pos); + mul_v2_fl(dpos, 1.0f / steps); - for (j = 0; j <= steps; j++) { - BKE_tracking_apply_intrinsics(tracking, pos, tpos); - glVertex2f(tpos[0] / width, tpos[1] / (height*aspy)); + for (j = 0; j <= steps; j++) { + BKE_tracking_apply_intrinsics(tracking, pos, tpos); + glVertex2f(tpos[0] / width, tpos[1] / (height * aspy)); - add_v2_v2(pos, dpos); - } + add_v2_v2(pos, dpos); } + } glEnd(); } else if (stroke->totpoints == 1) { glBegin(GL_POINTS); - glVertex2f(stroke->points[0].x + offsx, stroke->points[0].y + offsy); + glVertex2f(stroke->points[0].x + offsx, stroke->points[0].y + offsy); glEnd(); } } |