diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-12-03 01:50:30 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-12-03 01:50:30 +0000 |
commit | 65dc96682f8a619c4b3854c5c7fd8b453f86ab63 (patch) | |
tree | 6e858d05cbb52577b45f91bb1e6cde818910e5fb /nuttx/graphics | |
parent | 4786d0fcf423bb1e64a18c6570a277466cf00a17 (diff) | |
download | px4-nuttx-65dc96682f8a619c4b3854c5c7fd8b453f86ab63.tar.gz px4-nuttx-65dc96682f8a619c4b3854c5c7fd8b453f86ab63.tar.bz2 px4-nuttx-65dc96682f8a619c4b3854c5c7fd8b453f86ab63.zip |
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
Diffstat (limited to 'nuttx/graphics')
-rw-r--r-- | nuttx/graphics/nxglib/nxglib_nonintersecting.c | 8 | ||||
-rw-r--r-- | nuttx/graphics/nxglib/nxglib_rectoverlap.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/nuttx/graphics/nxglib/nxglib_nonintersecting.c b/nuttx/graphics/nxglib/nxglib_nonintersecting.c index b498e6294..1aa06c0a2 100644 --- a/nuttx/graphics/nxglib/nxglib_nonintersecting.c +++ b/nuttx/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/nuttx/graphics/nxglib/nxglib_rectoverlap.c b/nuttx/graphics/nxglib/nxglib_rectoverlap.c index ec33d8969..4b741e798 100644 --- a/nuttx/graphics/nxglib/nxglib_rectoverlap.c +++ b/nuttx/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 */ } |