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_1bpp_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_1bpp_mouse_restore(GX_DISPLAY * display)68 VOID _gx_display_driver_1bpp_mouse_restore(GX_DISPLAY *display) 69 { 70 INT row; 71 INT column; 72 INT height; 73 INT width; 74 GX_UBYTE *putrow; 75 GX_UBYTE *put; 76 GX_UBYTE *get; 77 GX_UBYTE *getrow; 78 GX_UBYTE getmask; 79 GX_UBYTE putmask; 80 GX_CANVAS *canvas; 81 82 if (display -> gx_display_mouse.gx_mouse_cursor_info) 83 { 84 if (display -> gx_display_mouse.gx_mouse_capture_memory && 85 (display -> gx_display_mouse.gx_mouse_status & GX_MOUSE_VISIBLE)) 86 { 87 canvas = display -> gx_display_mouse.gx_mouse_canvas; 88 height = display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_bottom - display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_top + 1; 89 width = display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_right - display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_left + 1; 90 91 if (width > 0 && height > 0) 92 { 93 getrow = (GX_UBYTE *)display -> gx_display_mouse.gx_mouse_capture_memory; 94 putrow = (GX_UBYTE *)canvas -> gx_canvas_memory; 95 putrow += ((canvas -> gx_canvas_x_resolution + 7) >> 3) * display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_top; 96 putrow += display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_left >> 3; 97 98 for (row = 0; row < height; row++) 99 { 100 getmask = 0x80; 101 putmask = (GX_UBYTE)(((GX_UBYTE)0x80) >> (display -> gx_display_mouse.gx_mouse_rect.gx_rectangle_left & 0x07)); 102 103 put = putrow; 104 get = getrow; 105 for (column = 0; column < width; column++) 106 { 107 if ((*get) & getmask) 108 { 109 *put |= putmask; 110 } 111 else 112 { 113 *put = (GX_UBYTE)((*put) & (~putmask)); 114 } 115 getmask >>= 1; 116 putmask >>= 1; 117 if (!getmask) 118 { 119 get++; 120 getmask = 0x80; 121 } 122 if (!putmask) 123 { 124 put++; 125 putmask = 0x80; 126 } 127 } 128 putrow += (display -> gx_display_width + 7) >> 3; 129 getrow += (width + 7) >> 3; 130 } 131 } 132 } 133 } 134 display -> gx_display_mouse.gx_mouse_status &= (GX_UBYTE)(~GX_MOUSE_VISIBLE); 135 } 136 #endif 137 #endif 138 139