vector versions of BLI_in_rctf / BLI_in_rcti, (BLI_in_rctf_v, BLI_in_rcti_v)
authorCampbell Barton <ideasman42@gmail.com>
Wed, 11 Jul 2012 18:17:48 +0000 (18:17 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 11 Jul 2012 18:17:48 +0000 (18:17 +0000)
use where possible.

17 files changed:
source/blender/blenkernel/intern/displist.c
source/blender/blenlib/BLI_rect.h
source/blender/blenlib/BLI_scanfill.h
source/blender/blenlib/intern/rct.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/mask/mask_select.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_intern.h
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/space_clip/tracking_select.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/render/intern/source/shadbuf.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_gesture.c

index 6e5d6ffb0e924dbf5b27c9d5cb07851f21e0b74b..9b349598db1d09edb7b3e1bec5710a7af542929f 100644 (file)
@@ -499,16 +499,14 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
                                /* vert data */
                                f1 = dlnew->verts;
                                totvert = 0;
-                               sf_vert = sf_ctx.fillvertbase.first;
-                               while (sf_vert) {
+
+                               for (sf_vert = sf_ctx.fillvertbase.first; sf_vert; sf_vert = sf_vert->next) {
                                        copy_v3_v3(f1, sf_vert->co);
                                        f1 += 3;
 
                                        /* index number */
                                        sf_vert->tmp.l = totvert;
                                        totvert++;
-
-                                       sf_vert = sf_vert->next;
                                }
 
                                /* index data */
index 0cf32eeb276fd37cff7ce21855b72b9c5c1df6b0..4d0e54e344cfd96e72638083359028dc0beb9696 100644 (file)
@@ -48,26 +48,30 @@ extern "C" {
  *
  * \return True if \a rect is empty.
  */
-int  BLI_rcti_is_empty(struct rcti *rect);
-int  BLI_rctf_is_empty(struct rctf *rect);
+int  BLI_rcti_is_empty(const struct rcti *rect);
+int  BLI_rctf_is_empty(const struct rctf *rect);
 void BLI_init_rctf(struct rctf *rect, float xmin, float xmax, float ymin, float ymax);
 void BLI_init_rcti(struct rcti *rect, int xmin, int xmax, int ymin, int ymax);
 void BLI_translate_rctf(struct rctf *rect, float x, float y);
 void BLI_translate_rcti(struct rcti *rect, int x, int y);
 void BLI_resize_rcti(struct rcti *rect, int x, int y);
 void BLI_resize_rctf(struct rctf *rect, float x, float y);
-int  BLI_in_rcti(struct rcti *rect, int x, int y);
-int  BLI_in_rctf(struct rctf *rect, float x, float y);
-int BLI_segment_in_rcti(struct rcti *rect, int s1[2], int s2[2]);
-// int  BLI_segment_in_rctf(struct rcti *rect, int s1[2], int s2[2]); // NOT NEEDED YET
-int  BLI_isect_rctf(struct rctf *src1, struct rctf *src2, struct rctf *dest);
-int  BLI_isect_rcti(struct rcti *src1, struct rcti *src2, struct rcti *dest);
-void BLI_union_rctf(struct rctf *rcta, struct rctf *rctb);
-void BLI_union_rcti(struct rcti *rcti1, struct rcti *rcti2);
+int  BLI_in_rcti(const struct rcti *rect, const int x, const int y);
+int  BLI_in_rcti_v(const struct rcti *rect, const int xy[2]);
+int  BLI_in_rctf(const struct rctf *rect, const float x, const float y);
+int  BLI_in_rctf_v(const struct rctf *rect, const float xy[2]);
+int  BLI_segment_in_rcti(const struct rcti *rect, const int s1[2], const int s2[2]);
+#if 0 /* NOT NEEDED YET */
+int  BLI_segment_in_rctf(struct rcti *rect, int s1[2], int s2[2]);
+#endif
+int  BLI_isect_rctf(const struct rctf *src1, const struct rctf *src2, struct rctf *dest);
+int  BLI_isect_rcti(const struct rcti *src1, const struct rcti *src2, struct rcti *dest);
+void BLI_union_rctf(struct rctf *rctf1, const struct rctf *rctf2);
+void BLI_union_rcti(struct rcti *rcti1, const struct rcti *rcti2);
 void BLI_copy_rcti_rctf(struct rcti *tar, const struct rctf *src);
 
-void print_rctf(const char *str, struct rctf *rect);
-void print_rcti(const char *str, struct rcti *rect);
+void print_rctf(const char *str, const struct rctf *rect);
+void print_rcti(const char *str, const struct rcti *rect);
 
 #ifdef __cplusplus
 }
index ceef378358b8ac45928f86b2ba51a08ee97fd876..cb996119fffe75d88ba9dde8785e0edad0ec320e 100644 (file)
@@ -65,7 +65,8 @@ typedef struct ScanFillVert {
        union {
                struct ScanFillVert *v;
                void                *p;
-               intptr_t l;
+               intptr_t             l;
+               unsigned int         u;
        } tmp;
        float co[3]; /* vertex location */
        float xy[2]; /* 2D copy of vertex location (using dominant axis) */
index b36c3c717c03aea48ba4d1189cfd2e16b8ffab12..b4397ea4546b8b429f17e9d57a114137217d2143 100644 (file)
 #include "DNA_vec_types.h"
 #include "BLI_rect.h"
 
-int BLI_rcti_is_empty(rcti *rect)
+int BLI_rcti_is_empty(const rcti *rect)
 {
        return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
 }
 
-int BLI_rctf_is_empty(rctf *rect)
+int BLI_rctf_is_empty(const rctf *rect)
 {
        return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
 }
 
-int BLI_in_rcti(rcti *rect, int x, int y)
+int BLI_in_rcti(const rcti *rect, const int x, const int y)
 {
        if (x < rect->xmin) return 0;
        if (x > rect->xmax) return 0;
@@ -57,7 +57,16 @@ int BLI_in_rcti(rcti *rect, int x, int y)
        return 1;
 }
 
-int BLI_in_rctf(rctf *rect, float x, float y)
+int BLI_in_rcti_v(const rcti *rect, const int xy[2])
+{
+       if (xy[0] < rect->xmin) return 0;
+       if (xy[0] > rect->xmax) return 0;
+       if (xy[1] < rect->ymin) return 0;
+       if (xy[1] > rect->ymax) return 0;
+       return 1;
+}
+
+int BLI_in_rctf(const rctf *rect, const float x, const float y)
 {
        if (x < rect->xmin) return 0;
        if (x > rect->xmax) return 0;
@@ -66,6 +75,15 @@ int BLI_in_rctf(rctf *rect, float x, float y)
        return 1;
 }
 
+int BLI_in_rctf_v(const rctf *rect, const float xy[2])
+{
+       if (xy[0] < rect->xmin) return 0;
+       if (xy[0] > rect->xmax) return 0;
+       if (xy[1] < rect->ymin) return 0;
+       if (xy[1] > rect->ymax) return 0;
+       return 1;
+}
+
 /* based closely on 'isect_line_line_v2_int', but in modified so corner cases are treated as intersections */
 static int isect_segments(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
 {
@@ -80,7 +98,7 @@ static int isect_segments(const int v1[2], const int v2[2], const int v3[2], con
        }
 }
 
-int BLI_segment_in_rcti(rcti *rect, int s1[2], int s2[2])
+int BLI_segment_in_rcti(const rcti *rect, const int s1[2], const int s2[2])
 {
        /* first do outside-bounds check for both points of the segment */
        if (s1[0] < rect->xmin && s2[0] < rect->xmin) return 0;
@@ -89,7 +107,7 @@ int BLI_segment_in_rcti(rcti *rect, int s1[2], int s2[2])
        if (s1[1] > rect->ymax && s2[1] > rect->ymax) return 0;
 
        /* if either points intersect then we definetly intersect */
-       if (BLI_in_rcti(rect, s1[0], s1[1]) || BLI_in_rcti(rect, s2[0], s2[1])) {
+       if (BLI_in_rcti_v(rect, s1) || BLI_in_rcti_v(rect, s2)) {
                return 1;
        }
        else {
@@ -115,7 +133,7 @@ int BLI_segment_in_rcti(rcti *rect, int s1[2], int s2[2])
        }
 }
 
-void BLI_union_rctf(rctf *rct1, rctf *rct2)
+void BLI_union_rctf(rctf *rct1, const rctf *rct2)
 {
        if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
        if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
@@ -123,7 +141,7 @@ void BLI_union_rctf(rctf *rct1, rctf *rct2)
        if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
 }
 
-void BLI_union_rcti(rcti *rct1, rcti *rct2)
+void BLI_union_rcti(rcti *rct1, const rcti *rct2)
 {
        if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
        if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
@@ -207,7 +225,7 @@ void BLI_resize_rctf(rctf *rect, float x, float y)
        rect->ymax = rect->ymin + y;
 }
 
-int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
+int BLI_isect_rctf(const rctf *src1, const rctf *src2, rctf *dest)
 {
        float xmin, xmax;
        float ymin, ymax;
@@ -237,7 +255,7 @@ int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
        }
 }
 
-int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
+int BLI_isect_rcti(const rcti *src1, const rcti *src2, rcti *dest)
 {
        int xmin, xmax;
        int ymin, ymax;
@@ -269,19 +287,19 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
 
 void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
 {
-       tar->xmin = floor(src->xmin + 0.5f);
-       tar->xmax = floor((src->xmax - src->xmin) + 0.5f);
-       tar->ymin = floor(src->ymin + 0.5f);
-       tar->ymax = floor((src->ymax - src->ymin) + 0.5f);
+       tar->xmin = floorf(src->xmin + 0.5f);
+       tar->xmax = floorf((src->xmax - src->xmin) + 0.5f);
+       tar->ymin = floorf(src->ymin + 0.5f);
+       tar->ymax = floorf((src->ymax - src->ymin) + 0.5f);
 }
 
-void print_rctf(const char *str, rctf *rect)
+void print_rctf(const char *str, const rctf *rect)
 {
        printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str,
               rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
 }
 
-void print_rcti(const char *str, rcti *rect)
+void print_rcti(const char *str, const rcti *rect)
 {
        printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str,
               rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
index 88627a6dabdc6a785c97ba1f42aea789e65b9804..78ac729f16e2bba955a30c0fffdc1b70f9e9287d 100644 (file)
@@ -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
                
index 7f9a998e6d07f3b59ec60305f584f1c4a14c0c2f..76485571096e4ad0d0ef5df73a1c4b30728b4199 100644 (file)
@@ -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);
index e619277456e3966a517005d7bc20dacf529ee840..a2a7a07d089e3530f48bf67862b0717d9a3107d6 100644 (file)
@@ -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);
                                }
index a638aac94231223d71853b3699dc06b026208c8f..48532c83e4ce89d8064525379f0e1bb0e49e508b 100644 (file)
@@ -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)
index aa11c3eecdd76d697c30d63ec96dfdda2c073372..86d99777e98d7dd79ef7de1288d2c728945936a8 100644 (file)
@@ -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);
index 6be276dea14d9919b6cb353b47f460ace2bac46c..547e7bc8e5afc5b430554fe851a159a8d39156f5 100644 (file)
@@ -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 */
index 70a2ff9e0bc179c62ad1fa8b3e9373e10a78eca2..5e46a28a3b75ed9ec72707d9d323d54ae99ca845 100644 (file)
@@ -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--);
index 0ebb84b3953624d467c58564076c277ec0b3d90d..0d933c1dff3d671c9df9c9dcb04d16b3f87b3d9b 100644 (file)
@@ -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
index f12e76836686195f54e8acbe18f6904d0199398c..43add69987b3d63c125646f6c8abf27076c14003 100644 (file)
@@ -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;
                        }
index 05bfc8d4a2e3785c6c5a1e47a60ad1c2d7c7b212..7ef205b69f06bc3322aa9e4af701d1d35bd89f1e 100644 (file)
@@ -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) {
index f696f95781b61b97df0df72dd8875f79818e4ae8..e13da98ecb4b3da8a6a2c0267edccdf76c728570 100644 (file)
@@ -1824,7 +1824,7 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
                        
                        if ((samp->facenr!=face->facenr || samp->obi!=face->obi) && samp->shadfac) {
                                if (face->box.zmin < samp->zco[2]) {
-                                       if (BLI_in_rctf((rctf *)&face->box, samp->zco[0], samp->zco[1])) {
+                                       if (BLI_in_rctf_v((rctf *)&face->box, samp->zco)) {
                                                int inshadow= 0;
                                                
                                                if (face->type) {
index 9795c482af20b412a819e3a4b85ab2b6aacc9778..4b762f94d34138e35f4e3562dec486d8dd168463 100644 (file)
@@ -919,7 +919,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
                                        ScrArea *sa = CTX_wm_area(C);
 
                                        if (ar && ar->regiontype == RGN_TYPE_WINDOW && event &&
-                                           BLI_in_rcti(&ar->winrct, event->x, event->y))
+                                           BLI_in_rcti_v(&ar->winrct, &event->x))
                                        {
                                                winrect = &ar->winrct;
                                        }
@@ -1638,17 +1638,17 @@ static int handler_boundbox_test(wmEventHandler *handler, wmEvent *event)
                        rcti rect = *handler->bblocal;
                        BLI_translate_rcti(&rect, handler->bbwin->xmin, handler->bbwin->ymin);
 
-                       if (BLI_in_rcti(&rect, event->x, event->y))
+                       if (BLI_in_rcti_v(&rect, &event->x))
                                return 1;
-                       else if (event->type == MOUSEMOVE && BLI_in_rcti(&rect, event->prevx, event->prevy))
+                       else if (event->type == MOUSEMOVE && BLI_in_rcti_v(&rect, &event->prevx))
                                return 1;
                        else
                                return 0;
                }
                else {
-                       if (BLI_in_rcti(handler->bbwin, event->x, event->y))
+                       if (BLI_in_rcti_v(handler->bbwin, &event->x))
                                return 1;
-                       else if (event->type == MOUSEMOVE && BLI_in_rcti(handler->bbwin, event->prevx, event->prevy))
+                       else if (event->type == MOUSEMOVE && BLI_in_rcti_v(handler->bbwin, &event->prevx))
                                return 1;
                        else
                                return 0;
@@ -1826,10 +1826,10 @@ static int wm_event_inside_i(wmEvent *event, rcti *rect)
 {
        if (wm_event_always_pass(event))
                return 1;
-       if (BLI_in_rcti(rect, event->x, event->y))
+       if (BLI_in_rcti_v(rect, &event->x))
                return 1;
        if (event->type == MOUSEMOVE) {
-               if (BLI_in_rcti(rect, event->prevx, event->prevy)) {
+               if (BLI_in_rcti_v(rect, &event->prevx)) {
                        return 1;
                }
                return 0;
@@ -1837,19 +1837,19 @@ static int wm_event_inside_i(wmEvent *event, rcti *rect)
        return 0;
 }
 
-static ScrArea *area_event_inside(bContext *C, int x, int y)
+static ScrArea *area_event_inside(bContext *C, const int xy[2])
 {
        bScreen *screen = CTX_wm_screen(C);
        ScrArea *sa;
        
        if (screen)
                for (sa = screen->areabase.first; sa; sa = sa->next)
-                       if (BLI_in_rcti(&sa->totrct, x, y))
+                       if (BLI_in_rcti_v(&sa->totrct, xy))
                                return sa;
        return NULL;
 }
 
-static ARegion *region_event_inside(bContext *C, int x, int y)
+static ARegion *region_event_inside(bContext *C, const int xy[2])
 {
        bScreen *screen = CTX_wm_screen(C);
        ScrArea *area = CTX_wm_area(C);
@@ -1857,7 +1857,7 @@ static ARegion *region_event_inside(bContext *C, int x, int y)
        
        if (screen && area)
                for (ar = area->regionbase.first; ar; ar = ar->next)
-                       if (BLI_in_rcti(&ar->winrct, x, y))
+                       if (BLI_in_rcti_v(&ar->winrct, xy))
                                return ar;
        return NULL;
 }
@@ -1888,11 +1888,11 @@ static void wm_paintcursor_test(bContext *C, wmEvent *event)
                        wm_paintcursor_tag(C, wm->paintcursors.first, ar);
                
                /* if previous position was not in current region, we have to set a temp new context */
-               if (ar == NULL || !BLI_in_rcti(&ar->winrct, event->prevx, event->prevy)) {
+               if (ar == NULL || !BLI_in_rcti_v(&ar->winrct, &event->prevx)) {
                        ScrArea *sa = CTX_wm_area(C);
                        
-                       CTX_wm_area_set(C, area_event_inside(C, event->prevx, event->prevy));
-                       CTX_wm_region_set(C, region_event_inside(C, event->prevx, event->prevy));
+                       CTX_wm_area_set(C, area_event_inside(C, &event->prevx));
+                       CTX_wm_region_set(C, region_event_inside(C, &event->prevx));
 
                        wm_paintcursor_tag(C, wm->paintcursors.first, CTX_wm_region(C));
                        
@@ -2000,8 +2000,8 @@ void wm_event_do_handlers(bContext *C)
                        CTX_wm_window_set(C, win);
                        
                        /* we let modal handlers get active area/region, also wm_paintcursor_test needs it */
-                       CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
-                       CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
+                       CTX_wm_area_set(C, area_event_inside(C, &event->x));
+                       CTX_wm_region_set(C, region_event_inside(C, &event->x));
                        
                        /* MVC demands to not draw in event handlers... but we need to leave it for ogl selecting etc */
                        wm_window_make_drawable(C, win);
@@ -2061,7 +2061,7 @@ void wm_event_do_handlers(bContext *C)
                                                                        if (CTX_wm_window(C) == NULL)
                                                                                return;
 
-                                                                       doit |= (BLI_in_rcti(&ar->winrct, event->x, event->y));
+                                                                       doit |= (BLI_in_rcti_v(&ar->winrct, &event->x));
                                                                        
                                                                        if (action & WM_HANDLER_BREAK)
                                                                                break;
@@ -2083,8 +2083,8 @@ void wm_event_do_handlers(bContext *C)
                                
                                if ((action & WM_HANDLER_BREAK) == 0) {
                                        /* also some non-modal handlers need active area/region */
-                                       CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
-                                       CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
+                                       CTX_wm_area_set(C, area_event_inside(C, &event->x));
+                                       CTX_wm_region_set(C, region_event_inside(C, &event->x));
 
                                        wm_region_mouse_co(C, event);
 
index b280b979280efeb7f0d586e1879a620c690d9742..c9f1a2587dfe4a2e632fdcc5ccb5dbb23fef5c7d 100644 (file)
@@ -253,7 +253,7 @@ static void draw_filled_lasso(wmGesture *gt)
        
        /* highly unlikely this will fail, but could crash if (gt->points == 0) */
        if (sf_vert_first) {
-               float zvec[3] = {0.0f, 0.0f, 1.0f};
+               const float zvec[3] = {0.0f, 0.0f, 1.0f};
                BLI_scanfill_edge_add(&sf_ctx, sf_vert_first, sf_vert);
                BLI_scanfill_calc_ex(&sf_ctx, FALSE, zvec);