diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 05:16:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 05:17:30 +0300 |
commit | 9ba948a4859da3308033fa6dc54f74433d7e6a21 (patch) | |
tree | 0bd6e95eb59d9af03aa32d925c68e1cbebecc246 /source/blender/blenlib/intern/lasso_2d.c | |
parent | 337eb8c1de4c57c34520b467d79779153335eecb (diff) |
Cleanup: style, use braces for blenlib
Diffstat (limited to 'source/blender/blenlib/intern/lasso_2d.c')
-rw-r--r-- | source/blender/blenlib/intern/lasso_2d.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/lasso_2d.c b/source/blender/blenlib/intern/lasso_2d.c index 37d4d6e1d1f..a8eb9f09041 100644 --- a/source/blender/blenlib/intern/lasso_2d.c +++ b/source/blender/blenlib/intern/lasso_2d.c @@ -36,10 +36,10 @@ void BLI_lasso_boundbox(rcti *rect, const int mcords[][2], const unsigned int mo rect->ymin = rect->ymax = mcords[0][1]; for (a = 1; a < moves; a++) { - if (mcords[a][0] < rect->xmin) rect->xmin = mcords[a][0]; - else if (mcords[a][0] > rect->xmax) rect->xmax = mcords[a][0]; - if (mcords[a][1] < rect->ymin) rect->ymin = mcords[a][1]; - else if (mcords[a][1] > rect->ymax) rect->ymax = mcords[a][1]; + if (mcords[a][0] < rect->xmin) { rect->xmin = mcords[a][0]; } + else if (mcords[a][0] > rect->xmax) { rect->xmax = mcords[a][0]; } + if (mcords[a][1] < rect->ymin) { rect->ymin = mcords[a][1]; } + else if (mcords[a][1] > rect->ymax) { rect->ymax = mcords[a][1]; } } } @@ -70,14 +70,22 @@ bool BLI_lasso_is_edge_inside(const int mcords[][2], const unsigned int moves, const int v1[2] = {x0, y0}, v2[2] = {x1, y1}; /* check points in lasso */ - if (BLI_lasso_is_point_inside(mcords, moves, v1[0], v1[1], error_value)) return true; - if (BLI_lasso_is_point_inside(mcords, moves, v2[0], v2[1], error_value)) return true; + if (BLI_lasso_is_point_inside(mcords, moves, v1[0], v1[1], error_value)) { + return true; + } + if (BLI_lasso_is_point_inside(mcords, moves, v2[0], v2[1], error_value)) { + return true; + } /* no points in lasso, so we have to intersect with lasso edge */ - if (isect_seg_seg_v2_int(mcords[0], mcords[moves - 1], v1, v2) > 0) return true; + if (isect_seg_seg_v2_int(mcords[0], mcords[moves - 1], v1, v2) > 0) { + return true; + } for (unsigned int a = 0; a < moves - 1; a++) { - if (isect_seg_seg_v2_int(mcords[a], mcords[a + 1], v1, v2) > 0) return true; + if (isect_seg_seg_v2_int(mcords[a], mcords[a + 1], v1, v2) > 0) { + return true; + } } return false; |