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 #define GX_SOURCE_CODE
21
22
23 /* Include necessary system files. */
24
25 #include "gx_api.h"
26 #include "gx_display.h"
27
28
29 /**************************************************************************/
30 /* */
31 /* FUNCTION RELEASE */
32 /* */
33 /* _gx_display_driver_32bpp_rotated_vertical_line_draw PORTABLE C */
34 /* 6.1.4 */
35 /* AUTHOR */
36 /* */
37 /* Kenneth Maxwell, Microsoft Corporation */
38 /* */
39 /* DESCRIPTION */
40 /* */
41 /* Generic rotated vertical line draw function for 16bpp canvas. */
42 /* */
43 /* INPUT */
44 /* */
45 /* context Drawing context */
46 /* ystart y-coord of top endpoint */
47 /* yend y-coord of bottom endpoint */
48 /* xpos x-coord of left edge */
49 /* width width of the line */
50 /* color Color of line to write */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* None */
55 /* */
56 /* CALLS */
57 /* */
58 /* _gx_display_driver_vertical_line_alpha_draw */
59 /* Basic display driver vertical */
60 /* line alpha draw function */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* GUIX Internal Code */
65 /* */
66 /* RELEASE HISTORY */
67 /* */
68 /* DATE NAME DESCRIPTION */
69 /* */
70 /* 02-02-2021 Kenneth Maxwell Initial Version 6.1.4 */
71 /* */
72 /**************************************************************************/
_gx_display_driver_32bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT * context,INT ystart,INT yend,INT xpos,INT width,GX_COLOR color)73 VOID _gx_display_driver_32bpp_rotated_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
74 {
75 INT row;
76 INT column;
77 ULONG *put;
78 ULONG *rowstart;
79 INT len = yend - ystart + 1;
80
81 #if defined GX_BRUSH_ALPHA_SUPPORT
82 GX_UBYTE alpha;
83
84 alpha = context -> gx_draw_context_brush.gx_brush_alpha;
85 if (alpha == 0)
86 {
87 /* Nothing to drawn. Just return. */
88 return;
89 }
90 if (alpha != 0xff)
91 {
92 _gx_display_driver_vertical_line_alpha_draw(context, ystart, yend, xpos, width, color, alpha);
93 return;
94 }
95 #endif
96
97 /* Pick up starting address of canvas memory. */
98 rowstart = (ULONG *)context -> gx_draw_context_memory;
99
100 if (context -> gx_draw_context_display -> gx_display_rotation_angle == GX_SCREEN_ROTATION_CW)
101 {
102
103 /* Calculate start of scanline. */
104 rowstart += (context -> gx_draw_context_canvas -> gx_canvas_x_resolution - xpos - 1) * context -> gx_draw_context_pitch;
105
106 /* Offset into starting pixel. */
107 rowstart += ystart;
108 }
109 else
110 {
111 rowstart += (xpos + width - 1) * context -> gx_draw_context_pitch;
112 rowstart += (context -> gx_draw_context_canvas -> gx_canvas_y_resolution - yend - 1);
113 }
114
115 /* Draw line width from left to right. */
116 for (column = 0; column < width; column++)
117 {
118 put = rowstart;
119
120 /* Draw line from top to bottom. */
121 for (row = 0; row < len; row++)
122 {
123 *put++ = (ULONG)color;
124 }
125
126 /* Advance to the next scaneline. */
127 rowstart -= context -> gx_draw_context_pitch;
128 }
129 }
130
131