From afaa17812513232785c8c629294190629197dfd8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 20 Apr 2011 13:12:35 +1000 Subject: [PATCH] dix: document GetDirection Signed-off-by: Peter Hutterer Reviewed-by: Daniel Stone Reviewed-by: Jamey Sharp Reviewed-by: Simon Thum --- dix/ptrveloc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c index ab2bca766..c0e3e6ce5 100644 --- a/dix/ptrveloc.c +++ b/dix/ptrveloc.c @@ -506,7 +506,13 @@ DoGetDirection(int dx, int dy){ #define DIRECTION_CACHE_RANGE 5 #define DIRECTION_CACHE_SIZE (DIRECTION_CACHE_RANGE*2+1) -/* cache DoGetDirection(). */ +/* cache DoGetDirection(). + * To avoid excessive use of direction calculation, cache the values for + * [-5..5] for both x/y. Anything outside of that is calcualted on the fly. + * + * @return A bitmask for N, NE, S, SE, etc. indicating the directions for + * this movement. + */ static int GetDirection(int dx, int dy){ static int cache[DIRECTION_CACHE_SIZE][DIRECTION_CACHE_SIZE];