]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libdraw/badrect.c
vmx: nanosec(): fix non-interruptable temporary, assign fasthz only once after xstart
[plan9front.git] / sys / src / libdraw / badrect.c
1 #include <u.h>
2 #include <libc.h>
3 #include <draw.h>
4
5 /*
6  * check for zero, negative size or insanely huge rectangle.
7  */
8 int
9 badrect(Rectangle r)
10 {
11         int x, y;
12         uint z;
13
14         x = Dx(r);
15         y = Dy(r);
16         if(x > 0 && y > 0){
17                 z = x*y;
18                 if(z/x == y && z < 0x10000000)
19                         return 0;
20         }
21         return 1;
22 }