1 
2 /***************************************************************************
3  * Copyright (c) 2024 Microsoft Corporation
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 /**   Dispaly Management (Dispaly)                                        */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_display.h"
29 
30 /**************************************************************************/
31 /*                                                                        */
32 /*  FUNCTION                                               RELEASE        */
33 /*                                                                        */
34 /*    _gx_display_driver_16bpp_mouse_restore              PORTABLE C      */
35 /*                                                           6.1          */
36 /*  AUTHOR                                                                */
37 /*                                                                        */
38 /*    Kenneth Maxwell, Microsoft Corporation                              */
39 /*                                                                        */
40 /*  DESCRIPTION                                                           */
41 /*                                                                        */
42 /*    This service restores captured memory under the mouse area.         */
43 /*                                                                        */
44 /*  INPUT                                                                 */
45 /*                                                                        */
46 /*    display                               Display control block         */
47 /*                                                                        */
48 /*  OUTPUT                                                                */
49 /*                                                                        */
50 /*  CALLS                                                                 */
51 /*                                                                        */
52 /*                                                                        */
53 /*  CALLED BY                                                             */
54 /*                                                                        */
55 /*    GUIX Internal Code                                                  */
56 /*                                                                        */
57 /*  RELEASE HISTORY                                                       */
58 /*                                                                        */
59 /*    DATE              NAME                      DESCRIPTION             */
60 /*                                                                        */
61 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
62 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
63 /*                                            resulting in version 6.1    */
64 /*                                                                        */
65 /**************************************************************************/
66 #if defined(GX_MOUSE_SUPPORT)
67 #if !defined(GX_HARDWARE_MOUSE_SUPPORT)
_gx_display_driver_16bpp_mouse_restore(GX_DISPLAY * display)68 VOID _gx_display_driver_16bpp_mouse_restore(GX_DISPLAY *display)
69 {
70 INT          row;
71 INT          column;
72 INT          height;
73 INT          width;
74 USHORT      *putrow;
75 USHORT      *put;
76 USHORT      *get;
77 GX_CANVAS   *canvas;
78 
79     if(display -> gx_display_mouse.gx_mouse_cursor_info)
80     {
81         if (display -> gx_display_mouse.gx_mouse_capture_memory &&
82             (display -> gx_display_mouse.gx_mouse_status & GX_MOUSE_VISIBLE))
83         {
84             canvas = display -> gx_display_mouse.gx_mouse_canvas;
85             height = display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_bottom - display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_top + 1;
86             width = display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_right - display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_left + 1;
87 
88             if (width > 0 && height > 0)
89             {
90                 get = (USHORT *)display -> gx_display_mouse.gx_mouse_capture_memory;
91                 putrow = (USHORT *)canvas -> gx_canvas_memory;
92                 putrow += canvas -> gx_canvas_x_resolution * display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_top;
93                 putrow += display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_left;
94 
95                 for (row = 0; row < height; row++)
96                 {
97                     put = putrow;
98                     for (column = 0; column < width; column++)
99                     {
100                         *put++ = *get++;
101                     }
102                     putrow += display -> gx_display_width;
103                 }
104             }
105         }
106         display -> gx_display_mouse.gx_mouse_status &= (GX_UBYTE)(~GX_MOUSE_VISIBLE);
107     }
108 }
109 #endif
110 #endif
111 
112