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:
authorCampbell Barton <ideasman42@gmail.com>2012-07-11 22:17:48 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-11 22:17:48 +0400
commita5127dba57490e0c0215e9cabfac1749585c53d1 (patch)
tree98911e5020e54806155e3a77db345f2b6882cb9f /source/blender
parent2070cd5d4929b969046492e55da34736a9d6304c (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')
-rw-r--r--source/blender/blenkernel/intern/displist.c6
-rw-r--r--source/blender/blenlib/BLI_rect.h28
-rw-r--r--source/blender/blenlib/BLI_scanfill.h3
-rw-r--r--source/blender/blenlib/intern/rct.c50
-rw-r--r--source/blender/editors/animation/keyframes_edit.c2
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/mask/mask_select.c2
-rw-r--r--source/blender/editors/screen/screen_edit.c8
-rw-r--r--source/blender/editors/screen/screen_intern.h2
-rw-r--r--source/blender/editors/screen/screen_ops.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c18
-rw-r--r--source/blender/editors/space_clip/tracking_select.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c12
-rw-r--r--source/blender/render/intern/source/shadbuf.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c38
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c2
17 files changed, 104 insertions, 85 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 6e5d6ffb0e9..9b349598db1 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -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 */
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 0cf32eeb276..4d0e54e344c 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -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
}
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index ceef378358b..cb996119fff 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -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) */
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index b36c3c717c0..b4397ea4546 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -38,17 +38,17 @@
#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);
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) {
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index f696f95781b..e13da98ecb4 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -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) {
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 9795c482af2..4b762f94d34 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -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);
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index b280b979280..c9f1a2587df 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -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);