Fixed bug 4172 - remove logging Gesture error "NumPoints = 0" - not necessary when app isn't recording gesture. - happen when gesture path has less than 2 different points
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/src/events/SDL_gesture.c b/src/events/SDL_gesture.c
index 558a96f..0f5fc81 100644
--- a/src/events/SDL_gesture.c
+++ b/src/events/SDL_gesture.c
@@ -335,7 +335,7 @@ static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
}
/* DollarPath contains raw points, plus (possibly) the calculated length */
-static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
+static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points, SDL_bool is_recording)
{
int i;
float interval;
@@ -381,7 +381,9 @@ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
dist += d;
}
if (numPoints < DOLLARNPOINTS-1) {
- SDL_SetError("ERROR: NumPoints = %i", numPoints);
+ if (is_recording) {
+ SDL_SetError("ERROR: NumPoints = %i", numPoints);
+ }
return 0;
}
/* copy the last point */
@@ -435,7 +437,7 @@ static float dollarRecognize(const SDL_DollarPath *path,int *bestTempl,SDL_Gestu
SDL_memset(points, 0, sizeof(points));
- dollarNormalize(path,points);
+ dollarNormalize(path, points, SDL_FALSE);
/* PrintPath(points); */
*bestTempl = -1;
@@ -576,7 +578,7 @@ void SDL_GestureProcessEvent(SDL_Event* event)
#if defined(ENABLE_DOLLAR)
if (inTouch->recording) {
inTouch->recording = SDL_FALSE;
- dollarNormalize(&inTouch->dollarPath,path);
+ dollarNormalize(&inTouch->dollarPath, path, SDL_TRUE);
/* PrintPath(path); */
if (recordAll) {
index = SDL_AddDollarGesture(NULL,path);