drawrepl.c (313B)
1 #include "u.h" 2 #include "lib.h" 3 #include "draw.h" 4 5 int 6 drawreplxy(int min, int max, int x) 7 { 8 int sx; 9 10 sx = (x-min)%(max-min); 11 if(sx < 0) 12 sx += max-min; 13 return sx+min; 14 } 15 16 Point 17 drawrepl(Rectangle r, Point p) 18 { 19 p.x = drawreplxy(r.min.x, r.max.x, p.x); 20 p.y = drawreplxy(r.min.y, r.max.y, p.y); 21 return p; 22 } 23