diff options
author | Charlie Jolly <mistajolly@gmail.com> | 2018-12-05 21:48:27 +0300 |
---|---|---|
committer | Charlie Jolly <mistajolly@gmail.com> | 2018-12-07 14:45:48 +0300 |
commit | ad47b0236e32dc9a583a0d7209d8030bbb7c358e (patch) | |
tree | a68c61dc5bf051bfe14ab48276a7eba39d365c70 /source/blender/editors/gpencil/gpencil_brush.c | |
parent | 942e9835a9acdc19164bf6b07796eace1548f3fd (diff) |
GP: Refactor coordinates to float
See: D4030
Differential Revision: https://developer.blender.org/D4036
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_brush.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_brush.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 1e9538e86f8..9feea61c672 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -138,7 +138,7 @@ typedef struct tGP_BrushEditData { /* - position and pressure * - the *_prev variants are the previous values */ - int mval[2], mval_prev[2]; + float mval[2], mval_prev[2]; float pressure, pressure_prev; /* - effect vector (e.g. 2D/3D translation for grab brush) */ @@ -261,7 +261,9 @@ static float gp_brush_influence_calc(tGP_BrushEditData *gso, const int radius, c /* distance fading */ if (gp_brush->flag & GP_SCULPT_FLAG_USE_FALLOFF) { - float distance = (float)len_v2v2_int(gso->mval, co); + int mval_i[2]; + round_v2i_v2fl(mval_i, gso->mval); + float distance = (float)len_v2v2_int(mval_i, co); float fac; CLAMP(distance, 0.0f, (float)radius); @@ -594,7 +596,7 @@ static void gp_brush_calc_midpoint(tGP_BrushEditData *gso) float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL); float mval_f[2]; - copy_v2fl_v2i(mval_f, gso->mval); + copy_v2_v2(mval_f, gso->mval); float mval_prj[2]; float dvec[3]; @@ -1435,7 +1437,9 @@ static bool gpsculpt_brush_do_stroke( /* do boundbox check first */ if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { /* only check if point is inside */ - if (len_v2v2_int(gso->mval, pc1) <= radius) { + int mval_i[2]; + round_v2i_v2fl(mval_i, gso->mval); + if (len_v2v2_int(mval_i, pc1) <= radius) { /* apply operation to this point */ changed = apply(gso, gps, 0, radius, pc1); } |