1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** GUIX Component                                                        */
16 /**                                                                       */
17 /**   Canvas Management (Canvas)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_system.h"
28 #include "gx_utility.h"
29 #include "gx_canvas.h"
30 #include "gx_port.h"
31 
32 /* Bring in externs for caller checking code.  */
33 GX_CALLER_CHECKING_EXTERNS
34 
35 
36 /**************************************************************************/
37 /*                                                                        */
38 /*  FUNCTION                                               RELEASE        */
39 /*                                                                        */
40 /*    _gxe_canvas_offset_set                              PORTABLE C      */
41 /*                                                           6.1          */
42 /*  AUTHOR                                                                */
43 /*                                                                        */
44 /*    Kenneth Maxwell, Microsoft Corporation                              */
45 /*                                                                        */
46 /*  DESCRIPTION                                                           */
47 /*                                                                        */
48 /*    This function checks for errors in the canvas offset set function   */
49 /*    call.                                                               */
50 /*                                                                        */
51 /*  INPUT                                                                 */
52 /*                                                                        */
53 /*    canvas                                Canvas control block          */
54 /*    x                                     X coordinate of offset        */
55 /*    y                                     Y coordinate of offset        */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    status                                Completion status             */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    _gx_canvas_offset_set                 Actual canvas offset set 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_offset_set(GX_CANVAS * canvas,GX_VALUE x,GX_VALUE y)78 UINT  _gxe_canvas_offset_set(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 offset set function.  */
99     status = _gx_canvas_offset_set(canvas, x, y);
100 
101     /* Return completion  status.  */
102     return status;
103 }
104 
105