diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-11 22:17:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-11 22:17:48 +0400 |
commit | a5127dba57490e0c0215e9cabfac1749585c53d1 (patch) | |
tree | 98911e5020e54806155e3a77db345f2b6882cb9f /source/blender/editors | |
parent | 2070cd5d4929b969046492e55da34736a9d6304c (diff) |
vector versions of BLI_in_rctf / BLI_in_rcti, (BLI_in_rctf_v, BLI_in_rcti_v)
use where possible.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_select.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 8 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_select.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 4 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 12 |
10 files changed, 29 insertions, 31 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 88627a6dabd..78ac729f16e 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -505,7 +505,7 @@ static short ok_bezier_region(KeyframeEditData *ked, BezTriple *bezt) if (ked->data) { short ok = 0; - #define KEY_CHECK_OK(_index) BLI_in_rctf(ked->data, bezt->vec[_index][0], bezt->vec[_index][1]) + #define KEY_CHECK_OK(_index) BLI_in_rctf_v(ked->data, bezt->vec[_index]) KEYFRAME_OK_CHECKS(KEY_CHECK_OK); #undef KEY_CHECK_OK diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 7f9a998e6d0..76485571096 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -978,7 +978,7 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel) short align = panel_aligned(sa, ar), dx = 0, dy = 0; /* first clip for window, no dragging outside */ - if (!BLI_in_rcti(&ar->winrct, event->x, event->y)) + if (!BLI_in_rcti_v(&ar->winrct, &event->x)) return; dx = (event->x - data->startx) & ~(PNL_GRID - 1); diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index e619277456e..a2a7a07d089 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -418,7 +418,7 @@ static int border_select_exec(bContext *C, wmOperator *op) /* TODO: handles? */ /* TODO: uw? */ - if (BLI_in_rctf(&rectf, point_deform->bezt.vec[1][0], point_deform->bezt.vec[1][1])) { + if (BLI_in_rctf_v(&rectf, point_deform->bezt.vec[1])) { BKE_mask_point_select_set(point, mode == GESTURE_MODAL_SELECT); BKE_mask_point_select_set_handle(point, mode == GESTURE_MODAL_SELECT); } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index a638aac9423..48532c83e4c 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1219,7 +1219,7 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event) ScrArea *sa; for (sa = win->screen->areabase.first; sa; sa = sa->next) - if ((az = is_in_area_actionzone(sa, event->x, event->y))) + if ((az = is_in_area_actionzone(sa, &event->x))) break; if (sa) { @@ -1262,12 +1262,12 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event) for (sa = scr->areabase.first; sa; sa = sa->next) { if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax) if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax) - if (NULL == is_in_area_actionzone(sa, event->x, event->y)) + if (NULL == is_in_area_actionzone(sa, &event->x)) break; } if (sa) { for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (BLI_in_rcti(&ar->winrct, event->x, event->y)) + if (BLI_in_rcti_v(&ar->winrct, &event->x)) scr->subwinactive = ar->swinid; } } @@ -1314,7 +1314,7 @@ int ED_screen_area_active(const bContext *C) ScrArea *sa = CTX_wm_area(C); if (win && sc && sa) { - AZone *az = is_in_area_actionzone(sa, win->eventstate->x, win->eventstate->y); + AZone *az = is_in_area_actionzone(sa, &win->eventstate->x); ARegion *ar; if (az && az->type == AZONE_REGION) diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index aa11c3eecdd..86d99777e98 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -54,7 +54,7 @@ void removenotused_scredges(bScreen *sc); int scredge_is_horizontal(ScrEdge *se); ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my); -struct AZone *is_in_area_actionzone(ScrArea *sa, int x, int y); +struct AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2]); /* screen_context.c */ int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 6be276dea14..547e7bc8e5a 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -524,15 +524,15 @@ static int actionzone_area_poll(bContext *C) return 0; } -AZone *is_in_area_actionzone(ScrArea *sa, int x, int y) +AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2]) { AZone *az = NULL; for (az = sa->actionzones.first; az; az = az->next) { - if (BLI_in_rcti(&az->rect, x, y)) { + if (BLI_in_rcti_v(&az->rect, xy)) { if (az->type == AZONE_AREA) { /* no triangle intersect but a hotspot circle based on corner */ - int radius = (x - az->x1) * (x - az->x1) + (y - az->y1) * (y - az->y1); + int radius = (xy[0] - az->x1) * (xy[0] - az->x1) + (xy[1] - az->y1) * (xy[1] - az->y1); if (radius <= AZONESPOT * AZONESPOT) break; @@ -577,7 +577,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type) static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event) { - AZone *az = is_in_area_actionzone(CTX_wm_area(C), event->x, event->y); + AZone *az = is_in_area_actionzone(CTX_wm_area(C), &event->x); sActionzoneData *sad; /* quick escape */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 70a2ff9e0bc..5e46a28a3b7 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1615,7 +1615,7 @@ static int line_clip_rect2f( if (fabsf(l1[0] - l2[0]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/ - if (BLI_in_rctf(rect, l1[0], l1[1])) { + if (BLI_in_rctf_v(rect, l1)) { copy_v2_v2(l1_clip, l1); copy_v2_v2(l2_clip, l2); return 1; @@ -1643,7 +1643,7 @@ static int line_clip_rect2f( } if (fabsf(l1[1] - l2[1]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/ - if (BLI_in_rctf(rect, l1[0], l1[1])) { + if (BLI_in_rctf_v(rect, l1)) { copy_v2_v2(l1_clip, l1); copy_v2_v2(l2_clip, l2); return 1; @@ -1667,12 +1667,12 @@ static int line_clip_rect2f( /* Done with vertical lines */ /* are either of the points inside the rectangle ? */ - if (BLI_in_rctf(rect, l1[0], l1[1])) { + if (BLI_in_rctf_v(rect, l1)) { copy_v2_v2(l1_clip, l1); ok1 = 1; } - if (BLI_in_rctf(rect, l2[0], l2[1])) { + if (BLI_in_rctf_v(rect, l2)) { copy_v2_v2(l2_clip, l2); ok2 = 1; } @@ -1820,7 +1820,7 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s * this is even less work then an intersection test */ #if 0 - if (BLI_in_rctf(bucket_bounds, cent[0], cent[1])) + if (BLI_in_rctf_v(bucket_bounds, cent)) return 1; #endif @@ -1987,9 +1987,9 @@ static void project_bucket_clip_face( float bucket_bounds_ss[4][2]; /* get the UV space bounding box */ - inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v1coSS[0], v1coSS[1]); - inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v2coSS[0], v2coSS[1]) << 1; - inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v3coSS[0], v3coSS[1]) << 2; + inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v1coSS); + inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v2coSS) << 1; + inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v3coSS) << 2; if (inside_bucket_flag == ISECT_ALL3) { /* all screenspace points are inside the bucket bounding box, this means we don't need to clip and can simply return the UVs */ @@ -2816,7 +2816,7 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke fidx = mf->v4 ? 3 : 2; do { v = ps->screenCoords[(*(&mf->v1 + fidx))]; - if (BLI_in_rctf(&bucket_bounds, v[0], v[1])) { + if (BLI_in_rctf_v(&bucket_bounds, v)) { return 1; } } while (fidx--); diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index 0ebb84b3953..0d933c1dff3 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -361,7 +361,7 @@ static int border_select_exec(bContext *C, wmOperator *op) MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr); if (MARKER_VISIBLE(sc, track, marker)) { - if (BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) { + if (BLI_in_rctf_v(&rectf, marker->pos)) { if (mode == GESTURE_MODAL_SELECT) BKE_tracking_track_flag_set(track, TRACK_AREA_ALL, SELECT); else diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index f12e7683668..43add69987b 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -758,7 +758,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select) bNode *node; rcti rect; - short node_cent[2]; + int node_cent[2]; float node_centf[2]; BLI_lasso_boundbox(&rect, mcords, moves); @@ -770,7 +770,7 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select) node_centf[1] = (node->totr.ymin + node->totr.ymax) / 2; ipoco_to_areaco_noclip(G.v2d, node_centf, node_cent); - if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) { + if (BLI_in_rcti_v(&rect, node_cent) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) { if (select) { node->flag |= SELECT; } diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 05bfc8d4a2e..7ef205b69f0 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -2479,7 +2479,7 @@ static int border_select_exec(bContext *C, wmOperator *op) tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); if (uvedit_face_visible_test(scene, ima, efa, tf)) { uv_poly_center(em, efa, cent); - if (BLI_in_rctf(&rectf, cent[0], cent[1])) { + if (BLI_in_rctf_v(&rectf, cent)) { BM_elem_flag_enable(efa, BM_ELEM_TAG); change = 1; } @@ -2504,15 +2504,13 @@ static int border_select_exec(bContext *C, wmOperator *op) if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) { /* UV_SYNC_SELECTION - can't do pinned selection */ - if (BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1])) { + if (BLI_in_rctf_v(&rectf, luv->uv)) { if (select) uvedit_uv_select_enable(em, scene, l, FALSE); else uvedit_uv_select_disable(em, scene, l); } } else if (pinned) { - if ((luv->flag & MLOOPUV_PINNED) && - BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1])) - { + if ((luv->flag & MLOOPUV_PINNED) && BLI_in_rctf_v(&rectf, luv->uv)) { if (select) uvedit_uv_select_enable(em, scene, l, FALSE); else uvedit_uv_select_disable(em, scene, l); } @@ -2685,7 +2683,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh float cent[2]; uv_poly_center(em, efa, cent); UI_view2d_view_to_region(&ar->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]); - if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) && + if (BLI_in_rcti_v(&rect, screen_uv) && BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED)) { uvedit_face_select_enable(scene, em, efa, FALSE); @@ -2702,7 +2700,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh if ((select) != (uvedit_uv_select_test(em, scene, l))) { MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); UI_view2d_view_to_region(&ar->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]); - if (BLI_in_rcti(&rect, screen_uv[0], screen_uv[1]) && + if (BLI_in_rcti_v(&rect, screen_uv) && BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED)) { if (select) { |