Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-09-09 19:41:07 +0300
committerJacques Lucke <jacques@blender.org>2020-09-09 19:41:07 +0300
commit63916f5941b443dfc8566682bb75374e5abd553f (patch)
treefb0704701f1d4d9acbddf4a6fbc62c819d8d4c36 /source/blender/editors/space_clip
parent0cff2c944f9c2cd3ac873fe826c4399fc2f32159 (diff)
Cleanup: reduce variable scope
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c3
-rw-r--r--source/blender/editors/space_clip/clip_draw.c17
-rw-r--r--source/blender/editors/space_clip/clip_editor.c9
-rw-r--r--source/blender/editors/space_clip/clip_ops.c11
-rw-r--r--source/blender/editors/space_clip/clip_utils.c7
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c11
-rw-r--r--source/blender/editors/space_clip/tracking_select.c9
7 files changed, 25 insertions, 42 deletions
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index 2e7ee3498b5..f3bac697044 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -384,7 +384,6 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
}
else if (event == B_MARKER_OFFSET) {
float offset[2], delta[2];
- int i;
offset[0] = cb->track_offset[0] / width;
offset[1] = cb->track_offset[1] / height;
@@ -392,7 +391,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
sub_v2_v2v2(delta, offset, cb->track->offset);
copy_v2_v2(cb->track->offset, offset);
- for (i = 0; i < cb->track->markersnr; i++) {
+ for (int i = 0; i < cb->track->markersnr; i++) {
sub_v2_v2(cb->track->markers[i].pos, delta);
}
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index e12e4eb2231..4759075555b 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -871,16 +871,11 @@ static void draw_marker_areas(SpaceClip *sc,
static float get_shortest_pattern_side(MovieTrackingMarker *marker)
{
- int i, next;
float len_sq = FLT_MAX;
- for (i = 0; i < 4; i++) {
- float cur_len;
-
- next = (i + 1) % 4;
-
- cur_len = len_squared_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]);
-
+ for (int i = 0; i < 4; i++) {
+ int next = (i + 1) % 4;
+ float cur_len = len_squared_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]);
len_sq = min_ff(cur_len, len_sq);
}
@@ -983,7 +978,6 @@ static void draw_marker_slide_zones(SpaceClip *sc,
}
if ((sc->flag & SC_SHOW_MARKER_PATTERN) && ((track->pat_flag & SELECT) == sel || outline)) {
- int i;
float pat_min[2], pat_max[2];
/* float dx = 12.0f / width, dy = 12.0f / height;*/ /* XXX UNUSED */
float tilt_ctrl[2];
@@ -993,7 +987,7 @@ static void draw_marker_slide_zones(SpaceClip *sc,
}
/* pattern's corners sliding squares */
- for (i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
draw_marker_slide_square(marker->pattern_corners[i][0],
marker->pattern_corners[i][1],
patdx / 1.5f,
@@ -1381,8 +1375,7 @@ static void draw_plane_marker_ex(SpaceClip *sc,
immUniformColor3fv(selected_color);
}
- int i;
- for (i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
draw_marker_slide_square(plane_marker->corners[i][0],
plane_marker->corners[i][1],
3.0f * px[0],
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 83096b4eded..b2c80faec0b 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -940,11 +940,10 @@ static void start_prefetch_threads(MovieClip *clip,
short *do_update,
float *progress)
{
- PrefetchQueue queue;
- TaskPool *task_pool;
- int i, tot_thread = BLI_task_scheduler_num_threads();
+ int tot_thread = BLI_task_scheduler_num_threads();
/* initialize queue */
+ PrefetchQueue queue;
BLI_spin_init(&queue.spin);
queue.current_frame = current_frame;
@@ -959,8 +958,8 @@ static void start_prefetch_threads(MovieClip *clip,
queue.do_update = do_update;
queue.progress = progress;
- task_pool = BLI_task_pool_create(&queue, TASK_PRIORITY_LOW);
- for (i = 0; i < tot_thread; i++) {
+ TaskPool *task_pool = BLI_task_pool_create(&queue, TASK_PRIORITY_LOW);
+ for (int i = 0; i < tot_thread; i++) {
BLI_task_pool_push(task_pool, prefetch_task_func, clip, false, NULL);
}
BLI_task_pool_work_and_wait(task_pool);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 8532d8420f9..013731a50d6 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -1412,17 +1412,16 @@ static void do_sequence_proxy(void *pjv,
ProxyJob *pj = pjv;
MovieClip *clip = pj->clip;
Scene *scene = pj->scene;
- TaskPool *task_pool;
int sfra = SFRA, efra = EFRA;
ProxyThread *handles;
- int i, tot_thread = BLI_task_scheduler_num_threads();
+ int tot_thread = BLI_task_scheduler_num_threads();
int width, height;
- ProxyQueue queue;
if (build_undistort_count) {
BKE_movieclip_get_size(clip, NULL, &width, &height);
}
+ ProxyQueue queue;
BLI_spin_init(&queue.spin);
queue.cfra = sfra;
@@ -1432,9 +1431,9 @@ static void do_sequence_proxy(void *pjv,
queue.do_update = do_update;
queue.progress = progress;
- task_pool = BLI_task_pool_create(&queue, TASK_PRIORITY_LOW);
+ TaskPool *task_pool = BLI_task_pool_create(&queue, TASK_PRIORITY_LOW);
handles = MEM_callocN(sizeof(ProxyThread) * tot_thread, "proxy threaded handles");
- for (i = 0; i < tot_thread; i++) {
+ for (int i = 0; i < tot_thread; i++) {
ProxyThread *handle = &handles[i];
handle->clip = clip;
@@ -1456,7 +1455,7 @@ static void do_sequence_proxy(void *pjv,
BLI_task_pool_free(task_pool);
if (build_undistort_count) {
- for (i = 0; i < tot_thread; i++) {
+ for (int i = 0; i < tot_thread; i++) {
ProxyThread *handle = &handles[i];
BKE_tracking_distortion_free(handle->distortion);
}
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index bcbf843f51c..cbf43bb7ff0 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -297,11 +297,8 @@ void clip_graph_tracking_iterate(SpaceClip *sc,
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
- MovieTrackingTrack *track;
-
- for (track = tracksbase->first; track; track = track->next) {
- int i;
+ LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
if (!include_hidden && (track->flag & TRACK_HIDDEN) != 0) {
continue;
}
@@ -310,7 +307,7 @@ void clip_graph_tracking_iterate(SpaceClip *sc,
continue;
}
- for (i = 0; i < track->markersnr; i++) {
+ for (int i = 0; i < track->markersnr; i++) {
MovieTrackingMarker *marker = &track->markers[i];
if (marker->flag & MARKER_DISABLED) {
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 177a0bc2bcf..05fa7a6b587 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -511,7 +511,6 @@ static int mouse_to_tilt_distance_squared(const MovieTrackingMarker *marker,
static bool slide_check_corners(float (*corners)[2])
{
- int i, next, prev;
float cross = 0.0f;
const float p[2] = {0.0f, 0.0f};
@@ -519,16 +518,16 @@ static bool slide_check_corners(float (*corners)[2])
return false;
}
- for (i = 0; i < 4; i++) {
- float v1[2], v2[2], cur_cross;
+ for (int i = 0; i < 4; i++) {
+ float v1[2], v2[2];
- next = (i + 1) % 4;
- prev = (4 + i - 1) % 4;
+ int next = (i + 1) % 4;
+ int prev = (4 + i - 1) % 4;
sub_v2_v2v2(v1, corners[i], corners[prev]);
sub_v2_v2v2(v2, corners[next], corners[i]);
- cur_cross = cross_v2v2(v1, v2);
+ float cur_cross = cross_v2v2(v1, v2);
if (fabsf(cur_cross) > FLT_EPSILON) {
if (cross == 0.0f) {
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index 80d0dd773b2..08b95bd46c5 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -546,9 +546,8 @@ static int box_select_exec(bContext *C, wmOperator *op)
for (plane_track = plane_tracks_base->first; plane_track; plane_track = plane_track->next) {
if ((plane_track->flag & PLANE_TRACK_HIDDEN) == 0) {
MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_get(plane_track, framenr);
- int i;
- for (i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (BLI_rctf_isect_pt_v(&rectf, plane_marker->corners[i])) {
if (select) {
plane_track->flag |= SELECT;
@@ -651,9 +650,8 @@ static int do_lasso_select_marker(bContext *C,
for (plane_track = plane_tracks_base->first; plane_track; plane_track = plane_track->next) {
if ((plane_track->flag & PLANE_TRACK_HIDDEN) == 0) {
MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_get(plane_track, framenr);
- int i;
- for (i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
float screen_co[2];
/* marker in screen coords */
@@ -812,9 +810,8 @@ static int circle_select_exec(bContext *C, wmOperator *op)
for (plane_track = plane_tracks_base->first; plane_track; plane_track = plane_track->next) {
if ((plane_track->flag & PLANE_TRACK_HIDDEN) == 0) {
MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_get(plane_track, framenr);
- int i;
- for (i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (point_inside_ellipse(plane_marker->corners[i], offset, ellipse)) {
if (select) {
plane_track->flag |= SELECT;