diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-01-04 09:28:44 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-01-04 09:28:44 +0300 |
commit | 72735b104dc756617d26f751de9b12919d559829 (patch) | |
tree | 102cb96f9e7aa3d9ee5f54dd6a09af67e9288178 /source/blender/editors | |
parent | f3c8e4ddffe512455f521b313a236190ad7efe11 (diff) |
Fixing Grease Pencil typo noted while scanning through Mike Erwin's
GSoC10 work. Cheers Mike for catching this!
Also removing the use of sqrt() as noted in a "todo" comment there...
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index aa20bb2667f..11a15fd8afc 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -210,13 +210,17 @@ static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2]) if (p->gpd->sbuffer_size == 0) return 1; - /* check if mouse moved at least certain distance on both axes (best case) */ + /* check if mouse moved at least certain distance on both axes (best case) + * - aims to eliminate some jitter-noise from input when trying to draw straight lines freehand + */ else if ((dx > MIN_MANHATTEN_PX) && (dy > MIN_MANHATTEN_PX)) return 1; - /* check if the distance since the last point is significant enough */ - // future optimisation: sqrt here may be too slow? - else if (sqrt(dx*dx + dy*dy) > MIN_EUCLIDEAN_PX) + /* check if the distance since the last point is significant enough + * - prevents points being added too densely + * - distance here doesn't use sqrt to prevent slowness... we should still be safe from overflows though + */ + else if ((dx*dx + dy*dy) > MIN_EUCLIDEAN_PX*MIN_EUCLIDEAN_PX) return 1; /* mouse 'didn't move' */ @@ -415,7 +419,7 @@ static void gp_stroke_simplify (tGPsdata *p) return; /* don't simplify if less than 4 points in buffer */ - if ((num_points <= 2) || (old_points == NULL)) + if ((num_points <= 4) || (old_points == NULL)) return; /* clear buffer (but don't free mem yet) so that we can write to it |