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-01-14 14:33:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-14 14:33:16 +0400
commitd14ac69c8c2340575cd453bd4cf473692de69f54 (patch)
tree749abed0ea2bdb0affdbcd70bcb0ee609d2d5ad9 /source/blender/editors
parent0863575816d281d4a7ffad351a8213367b6a938d (diff)
ensure functions are not used within FTOCHAR macro since they run 2-3 times.
brushes were doing curve lookups within this macro for example.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 2b75b32a705..5acc690807e 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1784,16 +1784,7 @@ static void scale_tri(float insetCos[4][3], float *origCos[4], const float inset
}
#endif //PROJ_DEBUG_NOSEAMBLEED
-static float Vec2Lenf_nosqrt(const float *v1, const float *v2)
-{
- float x, y;
-
- x = v1[0]-v2[0];
- y = v1[1]-v2[1];
- return x*x+y*y;
-}
-
-static float Vec2Lenf_nosqrt_other(const float *v1, const float v2_1, const float v2_2)
+static float len_squared_v2v2_alt(const float *v1, const float v2_1, const float v2_2)
{
float x, y;
@@ -1802,7 +1793,7 @@ static float Vec2Lenf_nosqrt_other(const float *v1, const float v2_1, const floa
return x*x+y*y;
}
-/* note, use a squared value so we can use Vec2Lenf_nosqrt
+/* note, use a squared value so we can use len_squared_v2v2
* be sure that you have done a bounds check first or this may fail */
/* only give bucket_bounds as an arg because we need it elsewhere */
static int project_bucket_isect_circle(const float cent[2], const float radius_squared, rctf *bucket_bounds)
@@ -1826,21 +1817,21 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
if (cent[0] < bucket_bounds->xmin) {
/* lower left out of radius test */
if (cent[1] < bucket_bounds->ymin) {
- return (Vec2Lenf_nosqrt_other(cent, bucket_bounds->xmin, bucket_bounds->ymin) < radius_squared) ? 1 : 0;
+ return (len_squared_v2v2_alt(cent, bucket_bounds->xmin, bucket_bounds->ymin) < radius_squared) ? 1 : 0;
}
/* top left test */
else if (cent[1] > bucket_bounds->ymax) {
- return (Vec2Lenf_nosqrt_other(cent, bucket_bounds->xmin, bucket_bounds->ymax) < radius_squared) ? 1 : 0;
+ return (len_squared_v2v2_alt(cent, bucket_bounds->xmin, bucket_bounds->ymax) < radius_squared) ? 1 : 0;
}
}
else if (cent[0] > bucket_bounds->xmax) {
/* lower right out of radius test */
if (cent[1] < bucket_bounds->ymin) {
- return (Vec2Lenf_nosqrt_other(cent, bucket_bounds->xmax, bucket_bounds->ymin) < radius_squared) ? 1 : 0;
+ return (len_squared_v2v2_alt(cent, bucket_bounds->xmax, bucket_bounds->ymin) < radius_squared) ? 1 : 0;
}
/* top right test */
else if (cent[1] > bucket_bounds->ymax) {
- return (Vec2Lenf_nosqrt_other(cent, bucket_bounds->xmax, bucket_bounds->ymax) < radius_squared) ? 1 : 0;
+ return (len_squared_v2v2_alt(cent, bucket_bounds->xmax, bucket_bounds->ymax) < radius_squared) ? 1 : 0;
}
}
@@ -3901,8 +3892,7 @@ static void *do_projectpaint_thread(void *ph_v)
projPixel = (ProjPixel *)node->link;
- /*dist = len_v2v2(projPixel->projCoSS, pos);*/ /* correct but uses a sqrtf */
- dist_nosqrt = Vec2Lenf_nosqrt(projPixel->projCoSS, pos);
+ dist_nosqrt = len_squared_v2v2(projPixel->projCoSS, pos);
/*if (dist < radius) {*/ /* correct but uses a sqrtf */
if (dist_nosqrt <= radius_squared) {