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-08-12 05:07:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-12 05:07:31 +0400
commit9cce2d864554cb78abfb5e2909dfb1a506933d3c (patch)
tree57f1037cb16ce26791f4bb1cd5fb0a88293d8af9 /source/blender/blenlib
parent1aaaf67a9e42cfbba6d8c955a9e0a7519b296933 (diff)
smooth-view for 2d views, graph editor, sequencer, node view, works with border zoom, view selected, view all.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_rect.h4
-rw-r--r--source/blender/blenlib/intern/rct.c33
2 files changed, 37 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 1c06e107c1f..55ab961cc53 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -53,6 +53,10 @@ 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);
+void BLI_rctf_interp(struct rctf *rect, const struct rctf *rect_a, const struct rctf *rect_b, const float fac);
+//void BLI_rcti_interp(struct rctf *rect, struct rctf *rect_a, struct rctf *rect_b, float fac);
+int BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit);
+int BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b);
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);
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 68a00d81444..e22becddfd6 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -270,6 +270,39 @@ void BLI_rctf_resize(rctf *rect, float x, float y)
rect->ymax = rect->ymin + y;
}
+void BLI_rctf_interp(rctf *rect, const rctf *rect_a, const rctf *rect_b, const float fac)
+{
+ const float ifac = 1.0f - fac;
+ rect->xmin = (rect_a->xmin * ifac) + (rect_b->xmin * fac);
+ rect->xmax = (rect_a->xmax * ifac) + (rect_b->xmax * fac);
+ rect->ymin = (rect_a->ymin * ifac) + (rect_b->ymin * fac);
+ rect->ymax = (rect_a->ymax * ifac) + (rect_b->ymax * fac);
+}
+
+/* BLI_rcti_interp() not needed yet */
+
+int BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit)
+{
+ if (fabsf(rect_a->xmin - rect_b->xmin) < limit)
+ if (fabsf(rect_a->xmax - rect_b->xmax) < limit)
+ if (fabsf(rect_a->ymin - rect_b->ymin) < limit)
+ if (fabsf(rect_a->ymax - rect_b->ymax) < limit)
+ return 1;
+
+ return 0;
+}
+
+int BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b)
+{
+ if (rect_a->xmin == rect_b->xmin)
+ if (rect_a->xmax == rect_b->xmax)
+ if (rect_a->ymin == rect_b->ymin)
+ if (rect_a->ymax == rect_b->ymax)
+ return 1;
+
+ return 0;
+}
+
int BLI_rctf_isect(const rctf *src1, const rctf *src2, rctf *dest)
{
float xmin, xmax;