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>2010-08-25 12:31:52 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-08-25 12:31:52 +0400
commit81d5e4f8dfe4d4d6bffd719006da96167383a743 (patch)
tree2df47453889e6cd885319c173e1d272ce8ccec66 /source/blender/blenlib
parent0066e337683c9b78ff3a62e1caed004d07fe4803 (diff)
bugfix [#22819] Grease Pencil: OpenGL render incorrect if view mode, OK with cursor mode
also made drawing in camera view stick to the camera border (belated durian request), useful for animation review without worrying about screensize moving the overlay about.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_math_vector.h6
-rw-r--r--source/blender/blenlib/BLI_rect.h3
-rw-r--r--source/blender/blenlib/intern/math_vector.c6
-rw-r--r--source/blender/blenlib/intern/rct.c20
4 files changed, 29 insertions, 6 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 15135e08225..c6902d01059 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -151,9 +151,9 @@ void bisect_v3_v3v3v3(float r[3], float a[3], float b[3], float c[3]);
/*********************************** Other ***********************************/
-void print_v2(char *str, float a[2]);
-void print_v3(char *str, float a[3]);
-void print_v4(char *str, float a[4]);
+void print_v2(const char *str, const float a[2]);
+void print_v3(const char *str, const float a[3]);
+void print_v4(const char *str, const float a[4]);
MINLINE void normal_short_to_float_v3(float r[3], const short n[3]);
MINLINE void normal_float_to_short_v3(short r[3], const float n[3]);
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 0b886c17309..13b12fc4e1e 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -60,7 +60,10 @@ 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);
+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);
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index b1cea9ab3c4..6d908ddb1cd 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -298,17 +298,17 @@ void ortho_basis_v3v3_v3(float *v1, float *v2, float *v)
/*********************************** Other ***********************************/
-void print_v2(char *str, float v[2])
+void print_v2(const char *str, const float v[2])
{
printf("%s: %.3f %.3f\n", str, v[0], v[1]);
}
-void print_v3(char *str, float v[3])
+void print_v3(const char *str, const float v[3])
{
printf("%s: %.3f %.3f %.3f\n", str, v[0], v[1], v[2]);
}
-void print_v4(char *str, float v[4])
+void print_v4(const char *str, const float v[4])
{
printf("%s: %.3f %.3f %.3f %.3f\n", str, v[0], v[1], v[2], v[3]);
}
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 5466acdba9f..aa424c1c2bb 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -36,6 +36,8 @@
*/
#include "DNA_vec_types.h"
+#include <stdio.h>
+#include <math.h>
int BLI_rcti_is_empty(rcti * rect)
{
@@ -222,3 +224,21 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
return 0;
}
}
+
+void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
+{
+ tar->xmin= floor(src->xmin + 0.5);
+ tar->xmax= floor((src->xmax - src->xmin) + 0.5);
+ tar->ymin= floor(src->ymin + 0.5);
+ tar->ymax= floor((src->ymax - src->ymin) + 0.5);
+}
+
+void print_rctf(const char *str, rctf *rect)
+{
+ printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+}
+
+void print_rcti(const char *str, rcti *rect)
+{
+ printf("%s: xmin %d, xmax %d, ymin %d, ymax %d\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+}