tdrawrepl.c - plan9port - [fork] Plan 9 from user space
HTML git clone git://src.adamsgaard.dk/plan9port
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
tdrawrepl.c (313B)
---
1 #include <u.h>
2 #include <libc.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 }