1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Utility (Utility) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_utility.h" |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gxe_utility_rectangle_overlap_detect PORTABLE C */ |
36 |
|
|
/* 6.1 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* This function checks for errors in the utility rectangle overlap */ |
44 |
|
|
/* detect function call. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* first_rectangle First rectangle */ |
49 |
|
|
/* second_rectangle Second rectangle */ |
50 |
|
|
/* return_overlap_area Overlapping rectangle area */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* [GX_TRUE | GX_FALSE] */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* _gx_utility_rectangle_overlap_detect Actual utility rectangle */ |
59 |
|
|
/* overlap detect function */ |
60 |
|
|
/* */ |
61 |
|
|
/* CALLED BY */ |
62 |
|
|
/* */ |
63 |
|
|
/* Application Code */ |
64 |
|
|
/* */ |
65 |
|
|
/**************************************************************************/ |
66 |
|
162954 |
GX_BOOL _gxe_utility_rectangle_overlap_detect(GX_RECTANGLE *first_rectangle, GX_RECTANGLE *second_rectangle, |
67 |
|
|
GX_RECTANGLE *return_overlap_area) |
68 |
|
|
{ |
69 |
|
|
GX_BOOL status; |
70 |
|
|
|
71 |
|
|
/* Check for invalid input pointers. */ |
72 |
✓✓✓✓
|
162954 |
if ((first_rectangle == GX_NULL) || (second_rectangle == GX_NULL)) |
73 |
|
|
{ |
74 |
|
2 |
return GX_FALSE; |
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
/* Check for valid rectangle. */ |
78 |
✓✓ |
162952 |
if ((first_rectangle -> gx_rectangle_left > first_rectangle -> gx_rectangle_right) || |
79 |
✓✓ |
162948 |
(first_rectangle -> gx_rectangle_top > first_rectangle -> gx_rectangle_bottom) || |
80 |
✓✓ |
162947 |
(second_rectangle -> gx_rectangle_left > second_rectangle -> gx_rectangle_right) || |
81 |
✓✓ |
162946 |
(second_rectangle -> gx_rectangle_top > second_rectangle -> gx_rectangle_bottom)) |
82 |
|
|
{ |
83 |
|
7 |
return GX_FALSE; |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
/* Call the actual utility rectangle overlap detect function. */ |
87 |
|
162945 |
status = _gx_utility_rectangle_overlap_detect(first_rectangle, second_rectangle, return_overlap_area); |
88 |
|
|
|
89 |
|
|
/* Return completion status. */ |
90 |
|
162945 |
return status; |
91 |
|
|
} |
92 |
|
|
|