Lines Matching refs:rect1
43 bool IsCongruent(const LayerRect &rect1, const LayerRect &rect2) {
44 return ((rect1.left == rect2.left) &&
45 (rect1.top == rect2.top) &&
46 (rect1.right == rect2.right) &&
47 (rect1.bottom == rect2.bottom));
62 LayerRect Intersection(const LayerRect &rect1, const LayerRect &rect2) {
65 if (!IsValid(rect1) || !IsValid(rect2)) {
69 res.left = std::max(rect1.left, rect2.left);
70 res.top = std::max(rect1.top, rect2.top);
71 res.right = std::min(rect1.right, rect2.right);
72 res.bottom = std::min(rect1.bottom, rect2.bottom);
96 // Not a geometrical rect deduction. Deducts rect2 from rect1 only if it results a single rect
97 LayerRect Subtract(const LayerRect &rect1, const LayerRect &rect2) {
100 res = rect1;
102 if ((rect1.left == rect2.left) && (rect1.right == rect2.right)) {
103 if ((rect1.top == rect2.top) && (rect2.bottom <= rect1.bottom)) {
105 } else if ((rect1.bottom == rect2.bottom) && (rect2.top >= rect1.top)) {
108 } else if ((rect1.top == rect2.top) && (rect1.bottom == rect2.bottom)) {
109 if ((rect1.left == rect2.left) && (rect2.right <= rect1.right)) {
111 } else if ((rect1.right == rect2.right) && (rect2.left >= rect1.left)) {
119 LayerRect Union(const LayerRect &rect1, const LayerRect &rect2) {
122 if (!IsValid(rect1) && !IsValid(rect2)) {
126 if (!IsValid(rect1)) {
131 return rect1;
134 res.left = std::min(rect1.left, rect2.left);
135 res.top = std::min(rect1.top, rect2.top);
136 res.right = std::max(rect1.right, rect2.right);
137 res.bottom = std::max(rect1.bottom, rect2.bottom);