1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 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 /* RELEASE HISTORY */ 66 /* */ 67 /* DATE NAME DESCRIPTION */ 68 /* */ 69 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 70 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 71 /* resulting in version 6.1 */ 72 /* */ 73 /**************************************************************************/ _gxe_utility_rectangle_overlap_detect(GX_RECTANGLE * first_rectangle,GX_RECTANGLE * second_rectangle,GX_RECTANGLE * return_overlap_area)74GX_BOOL _gxe_utility_rectangle_overlap_detect(GX_RECTANGLE *first_rectangle, GX_RECTANGLE *second_rectangle, 75 GX_RECTANGLE *return_overlap_area) 76 { 77 GX_BOOL status; 78 79 /* Check for invalid input pointers. */ 80 if ((first_rectangle == GX_NULL) || (second_rectangle == GX_NULL)) 81 { 82 return GX_FALSE; 83 } 84 85 /* Check for valid rectangle. */ 86 if ((first_rectangle -> gx_rectangle_left > first_rectangle -> gx_rectangle_right) || 87 (first_rectangle -> gx_rectangle_top > first_rectangle -> gx_rectangle_bottom) || 88 (second_rectangle -> gx_rectangle_left > second_rectangle -> gx_rectangle_right) || 89 (second_rectangle -> gx_rectangle_top > second_rectangle -> gx_rectangle_bottom)) 90 { 91 return GX_FALSE; 92 } 93 94 /* Call the actual utility rectangle overlap detect function. */ 95 status = _gx_utility_rectangle_overlap_detect(first_rectangle, second_rectangle, return_overlap_area); 96 97 /* Return completion status. */ 98 return status; 99 } 100 101