diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-15 04:29:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-15 04:29:56 +0400 |
commit | 7cc5af4ef3869f6a1d2766eb5643f94e2f540cfa (patch) | |
tree | 42c7e5d6179e20e479e8eae7792c7091cc9ffd31 /source/blender/blenlib | |
parent | f8bf58e0f21c59c4440165fbad55b082846b6b54 (diff) |
minor refactor for rect functions. more consistent naming.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_rect.h | 22 | ||||
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 20 |
2 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index 8a9794b77c9..1c06e107c1f 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -49,23 +49,23 @@ void BLI_rctf_init_minmax(struct rctf *rect); void BLI_rcti_do_minmax_v(struct rcti *rect, const int xy[2]); void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2]); -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); +void BLI_rctf_translate(struct rctf *rect, float x, float y); +void BLI_rcti_translate(struct rcti *rect, int x, int y); +void BLI_rcti_resize(struct rcti *rect, int x, int y); +void BLI_rctf_resize(struct rctf *rect, float x, float y); 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]); +int BLI_rcti_isect_segment(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]); +int BLI_rctf_isect_segment(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); +int BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest); +int BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest); +void BLI_rctf_union(struct rctf *rctf1, const struct rctf *rctf2); +void BLI_rcti_union(struct rcti *rcti1, const struct rcti *rcti2); +void BLI_rcti_rctf_copy(struct rcti *tar, const struct rctf *src); void print_rctf(const char *str, const struct rctf *rect); void print_rcti(const char *str, const struct rcti *rect); diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index bdca1bb51bd..658d45ad171 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -115,7 +115,7 @@ static int isect_segments(const int v1[2], const int v2[2], const int v3[2], con } } -int BLI_segment_in_rcti(const rcti *rect, const int s1[2], const int s2[2]) +int BLI_rcti_isect_segment(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; @@ -150,7 +150,7 @@ int BLI_segment_in_rcti(const rcti *rect, const int s1[2], const int s2[2]) } } -void BLI_union_rctf(rctf *rct1, const rctf *rct2) +void BLI_rctf_union(rctf *rct1, const rctf *rct2) { if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin; if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax; @@ -158,7 +158,7 @@ void BLI_union_rctf(rctf *rct1, const rctf *rct2) if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax; } -void BLI_union_rcti(rcti *rct1, const rcti *rct2) +void BLI_rcti_union(rcti *rct1, const rcti *rct2) { if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin; if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax; @@ -234,14 +234,14 @@ void BLI_rctf_do_minmax_v(struct rctf *rect, const float xy[2]) if (xy[1] > rect->ymax) rect->ymax = xy[1]; } -void BLI_translate_rcti(rcti *rect, int x, int y) +void BLI_rcti_translate(rcti *rect, int x, int y) { rect->xmin += x; rect->ymin += y; rect->xmax += x; rect->ymax += y; } -void BLI_translate_rctf(rctf *rect, float x, float y) +void BLI_rctf_translate(rctf *rect, float x, float y) { rect->xmin += x; rect->ymin += y; @@ -250,7 +250,7 @@ void BLI_translate_rctf(rctf *rect, float x, float y) } /* change width & height around the central location */ -void BLI_resize_rcti(rcti *rect, int x, int y) +void BLI_rcti_resize(rcti *rect, int x, int y) { rect->xmin = rect->xmax = (rect->xmax + rect->xmin) / 2; rect->ymin = rect->ymax = (rect->ymax + rect->ymin) / 2; @@ -260,7 +260,7 @@ void BLI_resize_rcti(rcti *rect, int x, int y) rect->ymax = rect->ymin + y; } -void BLI_resize_rctf(rctf *rect, float x, float y) +void BLI_rctf_resize(rctf *rect, float x, float y) { rect->xmin = rect->xmax = (rect->xmax + rect->xmin) * 0.5f; rect->ymin = rect->ymax = (rect->ymax + rect->ymin) * 0.5f; @@ -270,7 +270,7 @@ void BLI_resize_rctf(rctf *rect, float x, float y) rect->ymax = rect->ymin + y; } -int BLI_isect_rctf(const rctf *src1, const rctf *src2, rctf *dest) +int BLI_rctf_isect(const rctf *src1, const rctf *src2, rctf *dest) { float xmin, xmax; float ymin, ymax; @@ -300,7 +300,7 @@ int BLI_isect_rctf(const rctf *src1, const rctf *src2, rctf *dest) } } -int BLI_isect_rcti(const rcti *src1, const rcti *src2, rcti *dest) +int BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest) { int xmin, xmax; int ymin, ymax; @@ -330,7 +330,7 @@ int BLI_isect_rcti(const rcti *src1, const rcti *src2, rcti *dest) } } -void BLI_copy_rcti_rctf(rcti *tar, const rctf *src) +void BLI_rcti_rctf_copy(rcti *tar, const rctf *src) { tar->xmin = floorf(src->xmin + 0.5f); tar->xmax = floorf((src->xmax - src->xmin) + 0.5f); |