diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-29 17:26:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-29 17:26:43 +0400 |
commit | 903f9b98f5e5bd93938220e301b7f27d97d103aa (patch) | |
tree | a09bb0b2273ab090f147375dbb90054304bf7336 /source/blender/editors/sculpt_paint | |
parent | 202cd77ea9ac6b85a238e64185da9e38d70231fe (diff) |
avoid calling BKE_brush_alpha_get() when project painting onto each pixel,
also increase the epsilon for ruler thickness offset.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 320f9092c09..aa43287a551 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -3763,8 +3763,9 @@ static void *do_projectpaint_thread(void *ph_v) float pos_ofs[2] = {0}; float co[2]; unsigned short mask_short; - const float radius = (float)BKE_brush_size_get(ps->scene, brush); - const float radius_squared = radius * radius; /* avoid a square root with every dist comparison */ + const float brush_alpha = BKE_brush_alpha_get(ps->scene, brush); + const float brush_radius = (float)BKE_brush_size_get(ps->scene, brush); + const float brush_radius_sq = brush_radius * brush_radius; /* avoid a square root with every dist comparison */ short lock_alpha = ELEM(brush->blend, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_ADD_ALPHA) ? 0 : brush->flag & BRUSH_LOCK_ALPHA; @@ -3852,14 +3853,14 @@ static void *do_projectpaint_thread(void *ph_v) dist_nosqrt = len_squared_v2v2(projPixel->projCoSS, pos); /*if (dist < radius) {*/ /* correct but uses a sqrtf */ - if (dist_nosqrt <= radius_squared) { + if (dist_nosqrt <= brush_radius_sq) { dist = sqrtf(dist_nosqrt); - falloff = BKE_brush_curve_strength_clamp(ps->brush, dist, radius); + falloff = BKE_brush_curve_strength_clamp(ps->brush, dist, brush_radius); if (falloff > 0.0f) { float texrgb[3]; - float mask = falloff * BKE_brush_alpha_get(ps->scene, brush); + float mask = falloff * brush_alpha; if (ps->is_texbrush) { MTex *mtex = &brush->mtex; |