GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_display_driver_4bpp_grayscale_setup.c Lines: 58 58 100.0 %
Date: 2026-03-06 19:21:09 Branches: 0 0 - %

Line Branch Exec Source
1
2
/***************************************************************************
3
 * Copyright (c) 2024 Microsoft Corporation
4
 * Copyright (c) 2026-present Eclipse ThreadX contributors
5
 *
6
 * This program and the accompanying materials are made available under the
7
 * terms of the MIT License which is available at
8
 * https://opensource.org/licenses/MIT.
9
 *
10
 * SPDX-License-Identifier: MIT
11
 **************************************************************************/
12
13
14
/**************************************************************************/
15
/**************************************************************************/
16
/**                                                                       */
17
/** GUIX Component                                                        */
18
/**                                                                       */
19
/**   Display Management (Display)                                        */
20
/**                                                                       */
21
/**************************************************************************/
22
23
#define GX_SOURCE_CODE
24
/* Include necessary system files.  */
25
26
#include "gx_api.h"
27
#include "gx_display.h"
28
29
#if defined(GX_MOUSE_SUPPORT) && !defined(GX_HARDWARE_MOUSE_SUPPORT)
30
static GX_UBYTE mouse_capture_memory[GX_MOUSE_MAX_RESOLUTION * GX_MOUSE_MAX_RESOLUTION / 4] = { 0 };
31
#endif
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_display_driver_4bpp_grayscale_setup             PORTABLE C      */
38
/*                                                           6.1.3        */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    Generic 4bpp color format display driver setup routine.             */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    display                               The display control block     */
50
/*    aux_data                              Driver-defined auxiliary data */
51
/*    toggle_function                       Driver-defined screen toggle  */
52
/*                                            function                    */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    None                                                                */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    None                                                                */
61
/*                                                                        */
62
/*  CALLED BY                                                             */
63
/*                                                                        */
64
/*    GUIX Internal Code                                                  */
65
/*                                                                        */
66
/**************************************************************************/
67
26
VOID _gx_display_driver_4bpp_grayscale_setup(GX_DISPLAY *display, VOID *aux_data,
68
                                             VOID (*toggle_function)(struct GX_CANVAS_STRUCT *canvas,
69
                                                                     GX_RECTANGLE *dirty_area))
70
{
71
    /* Default initiate and complete function to null for general condition. */
72
26
    display -> gx_display_driver_drawing_initiate              = GX_NULL;
73
26
    display -> gx_display_driver_drawing_complete              = GX_NULL;
74
75
#if defined(GX_MOUSE_SUPPORT)
76
#if defined(GX_HARDWARE_MOUSE_SUPPORT)
77
    display -> gx_display_mouse_position_set                   = GX_NULL;
78
    display -> gx_display_mouse_enable                         = GX_NULL;
79
#else
80
    display -> gx_display_mouse.gx_mouse_capture_memory        = (GX_UBYTE *)mouse_capture_memory;
81
    display -> gx_display_mouse.gx_mouse_status                = 0;
82
83
    display -> gx_display_mouse.gx_mouse_position.gx_point_x   = display -> gx_display_width / 2;
84
    display -> gx_display_mouse.gx_mouse_position.gx_point_y   = display -> gx_display_height / 2;
85
86
    /* these functions are specific to the display color format, and will be NULL for hardware mouse */
87
    display -> gx_display_mouse_capture                        = _gx_display_driver_4bpp_mouse_capture;
88
    display -> gx_display_mouse_restore                        = _gx_display_driver_4bpp_mouse_restore;
89
    display -> gx_display_mouse_draw                           = _gx_display_driver_generic_mouse_draw;
90
    display -> gx_display_driver_drawing_initiate              = _gx_display_driver_generic_drawing_initiate;
91
    display -> gx_display_driver_drawing_complete              = _gx_display_driver_generic_drawing_complete;
92
    display -> gx_display_mouse_position_set                   = _gx_display_driver_generic_mouse_position_set;
93
    display -> gx_display_mouse_enable                         = _gx_display_driver_generic_mouse_enable;
94
#endif
95
96
    /* these functions are generic, same for every color depth, but will be overridden for hardware mouse */
97
    display -> gx_display_mouse.gx_mouse_cursor_info           = GX_NULL;
98
    display -> gx_display_mouse_define                         = _gx_display_driver_generic_mouse_define;
99
#endif
100
101
26
    display -> gx_display_rotation_angle                       = 0;
102
26
    display -> gx_display_driver_data                          = (VOID *)aux_data;
103
26
    display -> gx_display_accelerator                          = GX_NULL;
104
26
    display -> gx_display_layer_services                       = GX_NULL;
105
26
    display -> gx_display_driver_callback_assign               = GX_NULL;
106
107
26
    display -> gx_display_color_format                         = GX_COLOR_FORMAT_4BIT_GRAY;
108
26
    display -> gx_display_driver_canvas_copy                   = _gx_display_driver_4bpp_canvas_copy;
109
26
    display -> gx_display_driver_simple_line_draw              = _gx_display_driver_4bpp_simple_line_draw;
110
26
    display -> gx_display_driver_horizontal_line_draw          = _gx_display_driver_4bpp_horizontal_line_draw;
111
26
    display -> gx_display_driver_vertical_line_draw            = _gx_display_driver_4bpp_vertical_line_draw;
112
26
    display -> gx_display_driver_horizontal_pattern_line_draw  = _gx_display_driver_4bpp_horizontal_pattern_line_draw;
113
26
    display -> gx_display_driver_vertical_pattern_line_draw    = _gx_display_driver_4bpp_vertical_pattern_line_draw;
114
26
    display -> gx_display_driver_horizontal_pixelmap_line_draw = _gx_display_driver_4bpp_horizontal_pixelmap_line_draw;
115
26
    display -> gx_display_driver_pixel_write                   = _gx_display_driver_4bpp_pixel_write;
116
117
26
    display -> gx_display_driver_native_color_get              = _gx_display_driver_4bpp_native_color_get;
118
26
    display -> gx_display_driver_row_pitch_get                 = _gx_display_driver_4bpp_row_pitch_get;
119
26
    display -> gx_display_driver_block_move                    = _gx_display_driver_4bpp_block_move;
120
26
    display -> gx_display_driver_pixelmap_draw                 = _gx_display_driver_4bpp_pixelmap_draw;
121
122
26
    display -> gx_display_driver_alphamap_draw                 = GX_NULL;
123
26
    display -> gx_display_driver_anti_aliased_line_draw        = GX_NULL;
124
26
    display -> gx_display_driver_anti_aliased_wide_line_draw   = GX_NULL;
125
26
    display -> gx_display_driver_pixelmap_rotate               = _gx_display_driver_4bpp_pixelmap_rotate;
126
127
26
    display -> gx_display_driver_simple_wide_line_draw         = _gx_display_driver_generic_simple_wide_line_draw;
128
26
    display -> gx_display_driver_polygon_draw                  = _gx_display_driver_generic_polygon_draw;
129
26
    display -> gx_display_driver_polygon_fill                  = _gx_display_driver_generic_polygon_fill;
130
131
#if defined(GX_ARC_DRAWING_SUPPORT)
132
26
    display -> gx_display_driver_anti_aliased_circle_draw      = GX_NULL;
133
26
    display -> gx_display_driver_anti_aliased_ellipse_draw     = GX_NULL;
134
26
    display -> gx_display_driver_circle_draw                   = _gx_display_driver_generic_circle_draw;
135
26
    display -> gx_display_driver_circle_fill                   = _gx_display_driver_generic_circle_fill;
136
26
    display -> gx_display_driver_pie_fill                      = _gx_display_driver_generic_pie_fill;
137
26
    display -> gx_display_driver_anti_aliased_arc_draw         = GX_NULL;
138
26
    display -> gx_display_driver_arc_draw                      = _gx_display_driver_generic_arc_draw;
139
26
    display -> gx_display_driver_arc_fill                      = _gx_display_driver_generic_arc_fill;
140
26
    display -> gx_display_driver_ellipse_draw                  = _gx_display_driver_generic_ellipse_draw;
141
26
    display -> gx_display_driver_ellipse_fill                  = _gx_display_driver_generic_ellipse_fill;
142
26
    display -> gx_display_driver_anti_aliased_wide_circle_draw = GX_NULL;
143
26
    display -> gx_display_driver_wide_circle_draw              = _gx_display_driver_generic_wide_circle_draw;
144
26
    display -> gx_display_driver_anti_aliased_wide_ellipse_draw= GX_NULL;
145
26
    display -> gx_display_driver_wide_ellipse_draw             = _gx_display_driver_generic_wide_ellipse_draw;
146
26
    display -> gx_display_driver_anti_aliased_wide_arc_draw    = GX_NULL;
147
26
    display -> gx_display_driver_wide_arc_draw                 = _gx_display_driver_generic_wide_arc_draw;
148
#endif
149
150
26
    display -> gx_display_driver_8bit_glyph_draw               = GX_NULL;
151
26
    display -> gx_display_driver_4bit_glyph_draw               = _gx_display_driver_4bpp_glyph_4bit_draw;
152
26
    display -> gx_display_driver_1bit_glyph_draw               = _gx_display_driver_4bpp_glyph_1bit_draw;
153
154
155
26
    display -> gx_display_driver_palette_set                   = GX_NULL;
156
26
    display -> gx_display_driver_buffer_toggle                 = toggle_function;
157
158
26
    display -> gx_display_driver_canvas_blend                  = GX_NULL;
159
26
    display -> gx_display_driver_pixel_blend                   = GX_NULL;
160
26
    display -> gx_display_driver_pixelmap_blend                = GX_NULL;
161
162
26
    display -> gx_display_driver_8bit_compressed_glyph_draw    = GX_NULL;
163
26
    display -> gx_display_driver_4bit_compressed_glyph_draw    = GX_NULL;
164
26
    display -> gx_display_driver_1bit_compressed_glyph_draw    = GX_NULL;
165
166
#if defined(GX_SOFTWARE_DECODER_SUPPORT)
167
26
    display -> gx_display_driver_jpeg_draw                     = GX_NULL;
168
26
    display -> gx_display_driver_png_draw                      = GX_NULL;
169
#endif
170
26
}
171