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 /**   Canvas Management (Canvas)                                          */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_system.h"
29 #include "gx_window.h"
30 #include "gx_canvas.h"
31 #include "gx_port.h"
32 
33 /* Bring in externs for caller checking code.  */
34 GX_CALLER_CHECKING_EXTERNS
35 
36 
37 /**************************************************************************/
38 /*                                                                        */
39 /*  FUNCTION                                               RELEASE        */
40 /*                                                                        */
41 /*    _gxe_canvas_shift                                   PORTABLE C      */
42 /*                                                           6.1          */
43 /*  AUTHOR                                                                */
44 /*                                                                        */
45 /*    Kenneth Maxwell, Microsoft Corporation                              */
46 /*                                                                        */
47 /*  DESCRIPTION                                                           */
48 /*                                                                        */
49 /*    This function checks for errors in the canvas shift function call.  */
50 /*                                                                        */
51 /*  INPUT                                                                 */
52 /*                                                                        */
53 /*    canvas                                canvas control block          */
54 /*    x                                     x-axis shift amount in pixels */
55 /*    y                                     y-axis shift amount in pixels */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    status                                Completion status             */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*   _gx_canvas_shift                       Actual canvas shift call.     */
64 /*                                                                        */
65 /*  CALLED BY                                                             */
66 /*                                                                        */
67 /*    Application Code                                                    */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
74 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
75 /*                                            resulting in version 6.1    */
76 /*                                                                        */
77 /**************************************************************************/
_gxe_canvas_shift(GX_CANVAS * canvas,GX_VALUE x,GX_VALUE y)78 UINT  _gxe_canvas_shift(GX_CANVAS *canvas, GX_VALUE x, GX_VALUE y)
79 {
80 UINT status;
81 
82     /* Check for appropriate caller.  */
83     GX_INIT_AND_THREADS_CALLER_CHECKING
84 
85     /* Check for the invalid input pointers.  */
86     if ((canvas == GX_NULL) ||
87         (canvas -> gx_canvas_display == GX_NULL) ||
88         (canvas -> gx_canvas_memory == GX_NULL))
89     {
90         return(GX_PTR_ERROR);
91     }
92 
93     if (canvas -> gx_canvas_id != GX_CANVAS_ID)
94     {
95         return (GX_INVALID_CANVAS);
96     }
97 
98     /* Call the actual canvas shift function.  */
99     status = _gx_canvas_shift(canvas, x, y);
100 
101     /* Return completion status.  */
102     return status;
103 }
104 
105