Skip to content
Snippets Groups Projects
Commit 4917690c authored by patacongo's avatar patacongo
Browse files

Need to be consistent: rectangle endpoints are within rectangle

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1404 42af7a65-404d-4744-a932-0658087f49c3
parent ee553679
No related branches found
No related tags found
No related merge requests found
......@@ -95,21 +95,21 @@ void nxgl_nonintersecting(FAR struct nxgl_rect_s result[4],
result[NX_TOP_NDX].pt1.x = rect1->pt1.x;
result[NX_TOP_NDX].pt1.y = rect1->pt1.y;
result[NX_TOP_NDX].pt2.x = rect1->pt2.x;
result[NX_TOP_NDX].pt2.y = intersection.pt1.y;
result[NX_TOP_NDX].pt2.y = intersection.pt1.y - 1;
result[NX_BOTTOM_NDX].pt1.x = rect1->pt1.x;
result[NX_BOTTOM_NDX].pt1.y = intersection.pt2.y;
result[NX_BOTTOM_NDX].pt1.y = intersection.pt2.y + 1;
result[NX_BOTTOM_NDX].pt2.x = rect1->pt2.x;
result[NX_BOTTOM_NDX].pt2.y = rect1->pt2.y;
result[NX_LEFT_NDX].pt1.x = rect1->pt1.x;
result[NX_LEFT_NDX].pt1.x = rect1->pt1.x + 1;
result[NX_LEFT_NDX].pt1.y = intersection.pt1.y;
result[NX_LEFT_NDX].pt2.x = intersection.pt1.x;
result[NX_LEFT_NDX].pt2.y = intersection.pt2.y;
result[NX_RIGHT_NDX].pt1.x = intersection.pt2.x;
result[NX_RIGHT_NDX].pt1.y = intersection.pt1.y;
result[NX_RIGHT_NDX].pt2.x = rect1->pt2.x;
result[NX_RIGHT_NDX].pt2.x = rect1->pt2.x - 1;
result[NX_RIGHT_NDX].pt2.y = intersection.pt2.y;
}
......
......@@ -82,9 +82,9 @@ boolean nxgl_rectoverlap(FAR struct nxgl_rect_s *rect1,
* the two rectangles overlap in some fashion.
*/
return (rect1->pt1.x < rect2->pt2.x) && /* FALSE: rect1 is wholly to the right */
(rect2->pt1.x < rect1->pt2.x) && /* FALSE: rect2 is wholly to the right */
(rect1->pt1.y < rect2->pt2.y) && /* FALSE: rect1 is wholly below rect2 */
(rect2->pt1.y < rect1->pt2.y); /* FALSE: rect2 is wholly below rect1 */
return (rect1->pt1.x <= rect2->pt2.x) && /* FALSE: rect1 is wholly to the right */
(rect2->pt1.x <= rect1->pt2.x) && /* FALSE: rect2 is wholly to the right */
(rect1->pt1.y <= rect2->pt2.y) && /* FALSE: rect1 is wholly below rect2 */
(rect2->pt1.y <= rect1->pt2.y); /* FALSE: rect2 is wholly below rect1 */
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment