Optimize check in timer callback a bit.
It won't help much because there are not that many eyes, but then it also won't hurt, so stop checking when we know the pointer has not been moved.
This commit is contained in:
parent
88c2ec8222
commit
9463e7a941
1 changed files with 6 additions and 1 deletions
|
|
@ -162,13 +162,18 @@ timer_cb(EyesPlugin *eyes)
|
|||
|
||||
if ((x != eyes->pointer_last_x[i]) || (y != eyes->pointer_last_y[i]))
|
||||
{
|
||||
|
||||
calculate_pupil_xy (eyes, x, y, &pupil_x, &pupil_y, eyes->eyes[i]);
|
||||
draw_eye (eyes, i, pupil_x, pupil_y);
|
||||
|
||||
eyes->pointer_last_x[i] = x;
|
||||
eyes->pointer_last_y[i] = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* pointer position did not change since last poll, so
|
||||
why would it be different for the remaining eyes? */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue