diff --git a/graphics/nxglib/nxglib_nonintersecting.c b/graphics/nxglib/nxglib_nonintersecting.c index b498e6294c..1aa06c0a26 100644 --- a/graphics/nxglib/nxglib_nonintersecting.c +++ b/graphics/nxglib/nxglib_nonintersecting.c @@ -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; } diff --git a/graphics/nxglib/nxglib_rectoverlap.c b/graphics/nxglib/nxglib_rectoverlap.c index ec33d8969c..4b741e7981 100644 --- a/graphics/nxglib/nxglib_rectoverlap.c +++ b/graphics/nxglib/nxglib_rectoverlap.c @@ -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 */ }