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
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_rotated_horizontal_line_draw PORTABLE C */
35 /* 6.1.3 */
36 /* AUTHOR */
37 /* */
38 /* Kenneth Maxwell, Microsoft Corporation */
39 /* */
40 /* DESCRIPTION */
41 /* */
42 /* Generic 16bpp horizontal line draw function. */
43 /* */
44 /* INPUT */
45 /* */
46 /* context Drawing context */
47 /* xstart x-coord of left endpoint */
48 /* xend x-coord of right endpoint */
49 /* ypos y-coord of line top */
50 /* width Width (height) of the line */
51 /* color Color of line to write */
52 /* */
53 /* OUTPUT */
54 /* */
55 /* NOne */
56 /* */
57 /* CALLS */
58 /* */
59 /* _gx_display_driver_horizontal_line_alpha_draw */
60 /* Display driver basic */
61 /* horiztonal alpha line draw */
62 /* route */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* GUIX Internal Code */
67 /* */
68 /* RELEASE HISTORY */
69 /* */
70 /* DATE NAME DESCRIPTION */
71 /* */
72 /* 12-31-2020 Kenneth Maxwell Initial Version 6.1.3 */
73 /* */
74 /**************************************************************************/
_gx_display_driver_16bpp_rotated_horizontal_line_draw(GX_DRAW_CONTEXT * context,INT xstart,INT xend,INT ypos,INT width,GX_COLOR color)75 VOID _gx_display_driver_16bpp_rotated_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color)
76 {
77 #if 1
78 INT row;
79 INT column;
80 USHORT *put;
81 USHORT *rowstart;
82 INT len = xend - xstart + 1;
83
84 #if defined GX_BRUSH_ALPHA_SUPPORT
85 GX_UBYTE alpha;
86
87 alpha = context -> gx_draw_context_brush.gx_brush_alpha;
88 if (alpha == 0)
89 {
90 /* Nothing to drawn. Just return. */
91 return;
92 }
93
94 if (alpha != 0xff)
95 {
96 _gx_display_driver_horizontal_line_alpha_draw(context, xstart, xend, ypos, width, color, alpha);
97 return;
98 }
99 #endif
100
101 /* pick up start address of canvas memory */
102 rowstart = (USHORT *)context -> gx_draw_context_memory;
103
104 /* calculate start of row address */
105 if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
106 {
107 rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xstart - 1) * context -> gx_draw_context_pitch;
108 rowstart += ypos;
109 }
110 else
111 {
112 rowstart += xend * context -> gx_draw_context_pitch;
113 rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - ypos - width);
114 }
115
116
117 /* draw one line, left to right */
118 for (column = 0; column < len; column++)
119 {
120 put = rowstart;
121
122 /* draw lines to fill width */
123 for (row = 0; row < width; row++)
124 {
125 *put++ = (USHORT)color;
126 }
127
128 rowstart -= context->gx_draw_context_pitch;
129 }
130 #endif
131 }
132
133