Lines Matching refs:rect2
43 bool IsCongruent(const LayerRect &rect1, const LayerRect &rect2) { in IsCongruent() argument
44 return ((rect1.left == rect2.left) && in IsCongruent()
45 (rect1.top == rect2.top) && in IsCongruent()
46 (rect1.right == rect2.right) && in IsCongruent()
47 (rect1.bottom == rect2.bottom)); in IsCongruent()
67 LayerRect Intersection(const LayerRect &rect1, const LayerRect &rect2) { in Intersection() argument
70 if (!IsValid(rect1) || !IsValid(rect2)) { in Intersection()
74 res.left = std::max(rect1.left, rect2.left); in Intersection()
75 res.top = std::max(rect1.top, rect2.top); in Intersection()
76 res.right = std::min(rect1.right, rect2.right); in Intersection()
77 res.bottom = std::min(rect1.bottom, rect2.bottom); in Intersection()
102 bool Contains(const LayerRect &rect1, const LayerRect &rect2) { in Contains() argument
103 if (!IsValid(rect1) || !IsValid(rect2)) { in Contains()
106 return (rect1.top <= rect2.top && rect1.bottom >= rect2.bottom && in Contains()
107 rect1.left <= rect2.left && rect1.right >= rect2.right); in Contains()
111 void Subtract(const LayerRect &rect1, const LayerRect &rect2, LayerRect *res) { in Subtract() argument
115 if (!IsValid(rect1) || !IsValid(rect2)) { in Subtract()
119 if (rect1.left != rect2.left || rect1.right != rect2.right) { in Subtract()
124 if (rect1.top < rect2.top) { in Subtract()
126 res[0].bottom = rect2.top; in Subtract()
128 res[0].top = rect2.top; in Subtract()
133 if (rect1.bottom < rect2.bottom) { in Subtract()
135 res[1].bottom = rect2.bottom; in Subtract()
137 res[1].top = rect2.bottom; in Subtract()
143 LayerRect Subtract(const LayerRect &rect1, const LayerRect &rect2) { in Subtract() argument
148 if ((rect1.left == rect2.left) && (rect1.right == rect2.right)) { in Subtract()
149 if ((rect1.top == rect2.top) && (rect2.bottom <= rect1.bottom)) { in Subtract()
150 res.top = rect2.bottom; in Subtract()
151 } else if ((rect1.bottom == rect2.bottom) && (rect2.top >= rect1.top)) { in Subtract()
152 res.bottom = rect2.top; in Subtract()
154 } else if ((rect1.top == rect2.top) && (rect1.bottom == rect2.bottom)) { in Subtract()
155 if ((rect1.left == rect2.left) && (rect2.right <= rect1.right)) { in Subtract()
156 res.left = rect2.right; in Subtract()
157 } else if ((rect1.right == rect2.right) && (rect2.left >= rect1.left)) { in Subtract()
158 res.right = rect2.left; in Subtract()
165 LayerRect Union(const LayerRect &rect1, const LayerRect &rect2) { in Union() argument
168 if (!IsValid(rect1) && !IsValid(rect2)) { in Union()
173 return rect2; in Union()
176 if (!IsValid(rect2)) { in Union()
180 res.left = std::min(rect1.left, rect2.left); in Union()
181 res.top = std::min(rect1.top, rect2.top); in Union()
182 res.right = std::max(rect1.right, rect2.right); in Union()
183 res.bottom = std::max(rect1.bottom, rect2.bottom); in Union()