summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-04-20 13:12:35 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-04-21 13:49:38 +1000
commitafaa17812513232785c8c629294190629197dfd8 (patch)
tree08689ebd936205c04ce37b4f392b742b1972af1e
parentdf90db892d16143742eb3c09e048f5b76457a62e (diff)
dix: document GetDirection
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Simon Thum <simon.thum@gmx.de>
-rw-r--r--dix/ptrveloc.c8
1 files changed, 7 insertions, 1 deletions
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];