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
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_display.h"
28
29 /**************************************************************************/
30 /* */
31 /* FUNCTION RELEASE */
32 /* */
33 /* _gx_display_driver_32bpp_horizontal_line_draw PORTABLE C */
34 /* 6.1 */
35 /* AUTHOR */
36 /* */
37 /* Kenneth Maxwell, Microsoft Corporation */
38 /* */
39 /* DESCRIPTION */
40 /* */
41 /* Generic 32bpp color format horizontal line draw function. */
42 /* */
43 /* INPUT */
44 /* */
45 /* context Drawing context */
46 /* xstart x-coord of left endpoint */
47 /* xend x-coord of right endpoint */
48 /* ypos y-coord of line top */
49 /* width Width (height) of the line */
50 /* color Color of line to write */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* NOne */
55 /* */
56 /* CALLS */
57 /* */
58 /* _gx_display_driver_horizontal_line_alpha_draw */
59 /* Basic horizontal line alpha */
60 /* draw function */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* GUIX Internal Code */
65 /* */
66 /* RELEASE HISTORY */
67 /* */
68 /* DATE NAME DESCRIPTION */
69 /* */
70 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
71 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
72 /* resulting in version 6.1 */
73 /* */
74 /**************************************************************************/
_gx_display_driver_32bpp_horizontal_line_draw(GX_DRAW_CONTEXT * context,INT xstart,INT xend,INT ypos,INT width,GX_COLOR color)75 VOID _gx_display_driver_32bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color)
76 {
77 INT row;
78 INT column;
79 ULONG *put;
80 ULONG *rowstart;
81 INT len = xend - xstart + 1;
82
83 #if defined GX_BRUSH_ALPHA_SUPPORT
84 GX_UBYTE alpha;
85
86 alpha = context -> gx_draw_context_brush.gx_brush_alpha;
87 if (alpha == 0)
88 {
89 /* Nothing to drawn. Just return. */
90 return;
91 }
92
93 if (alpha != 0xff)
94 {
95 _gx_display_driver_horizontal_line_alpha_draw(context, xstart, xend, ypos, width, color, alpha);
96 return;
97 }
98 #endif
99
100 /* pick up start address of canvas memory */
101 rowstart = (ULONG *)context -> gx_draw_context_memory;
102
103 /* calculate start of row address */
104 rowstart += context -> gx_draw_context_pitch * ypos;
105
106 /* calculate pixel address */
107 rowstart += xstart;
108 /* draw 1-pixel hi lines to fill width */
109 for (row = 0; row < width; row++)
110 {
111 put = rowstart;
112
113 /* draw one line, left to right */
114 for (column = 0; column < len; column++)
115 {
116 *put++ = (ULONG)color;
117 }
118 rowstart += context -> gx_draw_context_pitch;
119 }
120 }
121
122