]> git.vomp.tv Git - vompclient.git/blob - region.cc
Completion of move recording code. Fixes for dir counts, other bugs.
[vompclient.git] / region.cc
1 #include "region.h"
2
3 Region::Region()
4 {
5   x = 0;
6   y = 0;
7   w = 0;
8   h = 0;
9   z = 0;
10 }
11
12 bool Region::overlappedBy(Region& d)
13 {
14   return
15   ( (d.x2() >= x) &&
16     (d.x <= x2()) &&
17     (d.y <= y2()) &&
18     (d.y2() >= y)    );
19 }
20
21 UINT Region::x2()
22 {
23   return x + w - 1;
24 }
25
26 UINT Region::y2()
27 {
28   return y + h - 1;
29 }
30 /*
31 Region Region::subtract(Region& other)
32 {
33   OK printf("This:           %i %i %i %i\n", x, y, w, h);
34   OK printf("Subtract this:  %i %i %i %i\n", other.x, other.y, other.w, other.h);
35
36
37   Region s;
38
39   if (x < other.x)
40   {
41     printf("Case 1\n");
42     s.x = x;
43     s.y = y;
44     s.w = other.x - x;
45     s.h = h;
46   }
47   else if (x2() > other.x2())
48   {
49     printf("Case 2\n");
50     s.x = other.x2()+1;
51     s.y = y;
52     s.w = w - s.x;
53     s.h = h;
54   }
55   else if (y < other.y)
56   {
57     printf("Case 3\n");
58     s.x = x;
59     s.y = y;
60     s.w = w;
61     s.h = other.y - y;
62   }
63   else if (y2() > other.y2())
64   {
65     printf("Case 4\n");
66     s.x = x;
67     s.y = other.y2()+1;
68     s.w = w;
69     s.h = h - s.y;
70   }
71   else
72   {
73     s.x = 0;
74     s.y = 0;
75     s.w = 0;
76     s.h = 0;
77   }
78   OK printf("Result:         %i %i %i %i\n", s.x, s.y, s.w, s.h);
79
80   return s;
81 }
82 */
83
84   //i.x = (x >= other.x ? x : other.x);
85   //i.y = (y >= other.y ? y : other.y);
86   //i.w = (x2() <= other.x2() ? x2() : other.x2()) - i.x;
87   //i.h = (y2() <= other.y2() ? y2() : other.y2()) - i.y;
88   //return i;