GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_utility_rectangle_point_detect.c Lines: 7 7 100.0 %
Date: 2026-03-06 19:21:09 Branches: 8 8 100.0 %

Line Branch Exec Source
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
/*    _gx_utility_rectangle_point_detect                  PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This service detects if the specified point resides in the          */
44
/*    rectangle. If the point does reside in the rectangle, the service   */
45
/*    returns GX_TRUE.                                                    */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    rectangle                             Rectangle                     */
50
/*    point                                 Point                         */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    [GX_TRUE | GX_FALSE]                                                */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    None                                                                */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    Application Code                                                    */
63
/*    GUIX Internal Code                                                  */
64
/*                                                                        */
65
/**************************************************************************/
66
65883090
GX_BOOL  _gx_utility_rectangle_point_detect(GX_RECTANGLE *rectangle, GX_POINT point)
67
{
68
65883090
    if (rectangle -> gx_rectangle_left <= point.gx_point_x &&
69
51230439
        rectangle -> gx_rectangle_right >= point.gx_point_x &&
70
38638456
        rectangle -> gx_rectangle_top <= point.gx_point_y &&
71
36633024
        rectangle -> gx_rectangle_bottom >= point.gx_point_y)
72
    {
73
74
        /* Yes, the point is within the rectangle.  */
75
34684556
        return(GX_TRUE);
76
    }
77
    else
78
    {
79
80
        /* No, the point is not within the rectangle.  */
81
31198534
        return(GX_FALSE);
82
    }
83
}
84