1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** GUIX Component */
17 /** */
18 /** Display Management (Display) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_display.h"
28 /**************************************************************************/
29 /* */
30 /* FUNCTION RELEASE */
31 /* */
32 /* _gx_display_driver_1bpp_vertical_line_draw PORTABLE C */
33 /* 6.1 */
34 /* AUTHOR */
35 /* */
36 /* Kenneth Maxwell, Microsoft Corporation */
37 /* */
38 /* DESCRIPTION */
39 /* */
40 /* Vertical line draw function for 1bpp display driver. */
41 /* */
42 /* INPUT */
43 /* */
44 /* context Drawing context */
45 /* ystart y-coord of top endpoint */
46 /* yend y-coord of bottom endpoint */
47 /* xpos x-coord of left edge */
48 /* width width of the line */
49 /* color Color of line to write */
50 /* */
51 /* OUTPUT */
52 /* */
53 /* None */
54 /* */
55 /* CALLS */
56 /* */
57 /* None */
58 /* */
59 /* CALLED BY */
60 /* */
61 /* GUIX Internal Code */
62 /* */
63 /* RELEASE HISTORY */
64 /* */
65 /* DATE NAME DESCRIPTION */
66 /* */
67 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
68 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
69 /* resulting in version 6.1 */
70 /* */
71 /**************************************************************************/
_gx_display_driver_1bpp_vertical_line_draw(GX_DRAW_CONTEXT * context,INT ystart,INT yend,INT xpos,INT width,GX_COLOR color)72 VOID _gx_display_driver_1bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color)
73 {
74 INT row;
75 INT column;
76 GX_UBYTE *put;
77 GX_UBYTE *putrow;
78 GX_UBYTE mask;
79 INT stride;
80
81 /* Get row pitch in bytes. */
82 stride = (context -> gx_draw_context_pitch + 7) >> 3;
83
84 /* pick up starting address of canvas memory */
85 putrow = (GX_UBYTE *)context -> gx_draw_context_memory;
86 putrow += ystart * stride;
87 putrow += (xpos >> 3);
88
89 /* draw line from top to bottom */
90 for (row = ystart; row <= yend; row++)
91 {
92 put = putrow;
93
94 mask = (GX_UBYTE)(0x80 >> (xpos & 0x07));
95
96 /* draw line width from left to right */
97 for (column = 0; column < width; column++)
98 {
99 if (color == 0x00)
100 {
101 *put = (GX_UBYTE)((*put) & (~mask));
102 }
103 else if ((color == 0x01))
104 {
105 *put |= mask;
106 }
107
108 mask >>= 1;
109
110 if (!mask)
111 {
112 put++;
113 mask = 0x80;
114 }
115 }
116
117 /* advance to the next scaneline */
118 putrow += stride;
119 }
120 }
121
122