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 /**   Display Management (Display)                                        */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 /* Include necessary system files.  */
23 
24 #include "gx_api.h"
25 #include "gx_display.h"
26 
27 /**************************************************************************/
28 /*                                                                        */
29 /*  FUNCTION                                               RELEASE        */
30 /*                                                                        */
31 /*    _gx_display_driver_565rgb_rotated_setup             PORTABLE C      */
32 /*                                                           6.1.3        */
33 /*  AUTHOR                                                                */
34 /*                                                                        */
35 /*    Kenneth Maxwell, Microsoft Corporation                              */
36 /*                                                                        */
37 /*  DESCRIPTION                                                           */
38 /*                                                                        */
39 /*    Generic 16-bit 565RGB color format display driver setup routine     */
40 /*    supporting 90 and 270 degree rotation.                              */
41 /*                                                                        */
42 /*  INPUT                                                                 */
43 /*                                                                        */
44 /*    display                               The display control block     */
45 /*    aux_data                              Driver-defined auxiliary data */
46 /*    toggle_function                       Driver-defined screen toggle  */
47 /*                                            function                    */
48 /*                                                                        */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*    None                                                                */
52 /*                                                                        */
53 /*  CALLS                                                                 */
54 /*                                                                        */
55 /*    None                                                                */
56 /*                                                                        */
57 /*  CALLED BY                                                             */
58 /*                                                                        */
59 /*    GUIX Internal Code                                                  */
60 /*                                                                        */
61 /*  RELEASE HISTORY                                                       */
62 /*                                                                        */
63 /*    DATE              NAME                      DESCRIPTION             */
64 /*                                                                        */
65 /*  12-31-2020     Kenneth Maxwell          Initial Version 6.1.3         */
66 /*                                                                        */
67 /**************************************************************************/
_gx_display_driver_565rgb_rotated_setup(GX_DISPLAY * display,VOID * aux_data,VOID (* toggle_function)(struct GX_CANVAS_STRUCT * canvas,GX_RECTANGLE * dirty_area))68 VOID _gx_display_driver_565rgb_rotated_setup(GX_DISPLAY *display, VOID *aux_data,
69                                      VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
70                                                              GX_RECTANGLE *dirty_area))
71 {
72     _gx_display_driver_565rgb_setup(display, aux_data, toggle_function);
73 
74     /* Default initiate and complete function to null for general condition. */
75 #if defined(GX_MOUSE_SUPPORT)
76     display -> gx_display_mouse_capture                        = GX_NULL;
77     display -> gx_display_mouse_restore                        = GX_NULL;
78     display -> gx_display_mouse_capture                        = GX_NULL;
79     display -> gx_display_mouse_restore                        = GX_NULL;
80     display -> gx_display_mouse_draw                           = GX_NULL;
81     display -> gx_display_driver_drawing_initiate              = GX_NULL;
82     display -> gx_display_driver_drawing_complete              = GX_NULL;
83     display -> gx_display_mouse_position_set                   = GX_NULL;
84     display -> gx_display_mouse_enable                         = GX_NULL;
85 #endif
86 
87     // default to 90 degree rotation angle
88     display -> gx_display_rotation_angle                       = GX_SCREEN_ROTATION_CW;
89 
90     display -> gx_display_driver_canvas_copy                   = _gx_display_driver_16bpp_rotated_canvas_copy;
91     display -> gx_display_driver_simple_line_draw              = _gx_display_driver_16bpp_rotated_simple_line_draw;
92     display -> gx_display_driver_horizontal_line_draw          = _gx_display_driver_16bpp_rotated_horizontal_line_draw;
93     display -> gx_display_driver_vertical_line_draw            = _gx_display_driver_16bpp_rotated_vertical_line_draw;
94     display -> gx_display_driver_horizontal_pattern_line_draw  = _gx_display_driver_16bpp_rotated_horizontal_pattern_line_draw;
95     display -> gx_display_driver_horizontal_pixelmap_line_draw = _gx_display_driver_565rgb_rotated_horizontal_pixelmap_line_draw;
96     display -> gx_display_driver_vertical_pattern_line_draw    = _gx_display_driver_16bpp_rotated_vertical_pattern_line_draw;
97     display -> gx_display_driver_pixel_write                   = _gx_display_driver_16bpp_rotated_pixel_write;
98     display -> gx_display_driver_block_move                    = _gx_display_driver_16bpp_rotated_block_move;
99 
100     display -> gx_display_driver_pixelmap_draw                 = _gx_display_driver_565rgb_rotated_pixelmap_draw;
101     display -> gx_display_driver_pixelmap_rotate               = _gx_display_driver_565rgb_rotated_pixelmap_rotate;
102     display -> gx_display_driver_alphamap_draw                 = _gx_display_driver_generic_rotated_alphamap_draw;
103     display -> gx_display_driver_polygon_fill                  = _gx_display_driver_generic_rotated_polygon_fill;
104 
105 #if defined(GX_ARC_DRAWING_SUPPORT)
106     display -> gx_display_driver_circle_fill                   = _gx_display_driver_generic_rotated_circle_fill;
107     display -> gx_display_driver_pie_fill                      = _gx_display_driver_generic_rotated_pie_fill;
108     display -> gx_display_driver_arc_fill                      = _gx_display_driver_generic_rotated_arc_fill;
109     display -> gx_display_driver_ellipse_fill                  = _gx_display_driver_generic_rotated_ellipse_fill;
110 #endif
111 
112     display -> gx_display_driver_canvas_blend                  = _gx_display_driver_565rgb_rotated_canvas_blend;
113     display -> gx_display_driver_pixel_blend                   = _gx_display_driver_565rgb_rotated_pixel_blend;
114     display -> gx_display_driver_pixelmap_blend                = _gx_display_driver_565rgb_rotated_pixelmap_blend;
115 
116     display -> gx_display_driver_8bit_glyph_draw               = _gx_display_driver_generic_rotated_glyph_8bit_draw;
117     display -> gx_display_driver_4bit_glyph_draw               = _gx_display_driver_generic_rotated_glyph_4bit_draw;
118     display -> gx_display_driver_1bit_glyph_draw               = _gx_display_driver_565rgb_rotated_glyph_1bit_draw;
119 
120 #if defined(GX_SOFTWARE_DECODER_SUPPORT)
121     display -> gx_display_driver_jpeg_draw                     = _gx_display_driver_565rgb_rotated_jpeg_draw;
122     display -> gx_display_driver_png_draw                      = _gx_display_driver_565rgb_rotated_png_draw;
123 #endif
124 }
125 
126