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 |
|
|
/* Include necessary system files. */ |
24 |
|
|
|
25 |
|
|
#include "gx_api.h" |
26 |
|
|
#include "gx_display.h" |
27 |
|
|
/**************************************************************************/ |
28 |
|
|
/* */ |
29 |
|
|
/* FUNCTION RELEASE */ |
30 |
|
|
/* */ |
31 |
|
|
/* _gx_display_driver_1bpp_vertical_line_draw PORTABLE C */ |
32 |
|
|
/* 6.1 */ |
33 |
|
|
/* AUTHOR */ |
34 |
|
|
/* */ |
35 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
36 |
|
|
/* */ |
37 |
|
|
/* DESCRIPTION */ |
38 |
|
|
/* */ |
39 |
|
|
/* Vertical line draw function for 1bpp display driver. */ |
40 |
|
|
/* */ |
41 |
|
|
/* INPUT */ |
42 |
|
|
/* */ |
43 |
|
|
/* context Drawing context */ |
44 |
|
|
/* ystart y-coord of top endpoint */ |
45 |
|
|
/* yend y-coord of bottom endpoint */ |
46 |
|
|
/* xpos x-coord of left edge */ |
47 |
|
|
/* width width of the line */ |
48 |
|
|
/* color Color of line to write */ |
49 |
|
|
/* */ |
50 |
|
|
/* OUTPUT */ |
51 |
|
|
/* */ |
52 |
|
|
/* None */ |
53 |
|
|
/* */ |
54 |
|
|
/* CALLS */ |
55 |
|
|
/* */ |
56 |
|
|
/* None */ |
57 |
|
|
/* */ |
58 |
|
|
/* CALLED BY */ |
59 |
|
|
/* */ |
60 |
|
|
/* GUIX Internal Code */ |
61 |
|
|
/* */ |
62 |
|
|
/* RELEASE HISTORY */ |
63 |
|
|
/* */ |
64 |
|
|
/* DATE NAME DESCRIPTION */ |
65 |
|
|
/* */ |
66 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
67 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
68 |
|
|
/* resulting in version 6.1 */ |
69 |
|
|
/* */ |
70 |
|
|
/**************************************************************************/ |
71 |
|
96382 |
VOID _gx_display_driver_1bpp_vertical_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos, INT width, GX_COLOR color) |
72 |
|
|
{ |
73 |
|
|
INT row; |
74 |
|
|
INT column; |
75 |
|
|
GX_UBYTE *put; |
76 |
|
|
GX_UBYTE *putrow; |
77 |
|
|
GX_UBYTE mask; |
78 |
|
|
INT stride; |
79 |
|
|
|
80 |
|
|
/* Get row pitch in bytes. */ |
81 |
|
96382 |
stride = (context -> gx_draw_context_pitch + 7) >> 3; |
82 |
|
|
|
83 |
|
|
/* pick up starting address of canvas memory */ |
84 |
|
96382 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
85 |
|
96382 |
putrow += ystart * stride; |
86 |
|
96382 |
putrow += (xpos >> 3); |
87 |
|
|
|
88 |
|
|
/* draw line from top to bottom */ |
89 |
✓✓ |
6192804 |
for (row = ystart; row <= yend; row++) |
90 |
|
|
{ |
91 |
|
6096422 |
put = putrow; |
92 |
|
|
|
93 |
|
6096422 |
mask = (GX_UBYTE)(0x80 >> (xpos & 0x07)); |
94 |
|
|
|
95 |
|
|
/* draw line width from left to right */ |
96 |
✓✓ |
14168596 |
for (column = 0; column < width; column++) |
97 |
|
|
{ |
98 |
✓✓ |
8072174 |
if (color == 0x00) |
99 |
|
|
{ |
100 |
|
3254415 |
*put = (GX_UBYTE)((*put) & (~mask)); |
101 |
|
|
} |
102 |
✓✓ |
4817759 |
else if ((color == 0x01)) |
103 |
|
|
{ |
104 |
|
4817318 |
*put |= mask; |
105 |
|
|
} |
106 |
|
|
|
107 |
|
8072174 |
mask >>= 1; |
108 |
|
|
|
109 |
✓✓ |
8072174 |
if (!mask) |
110 |
|
|
{ |
111 |
|
1838009 |
put++; |
112 |
|
1838009 |
mask = 0x80; |
113 |
|
|
} |
114 |
|
|
} |
115 |
|
|
|
116 |
|
|
/* advance to the next scaneline */ |
117 |
|
6096422 |
putrow += stride; |
118 |
|
|
} |
119 |
|
96382 |
} |
120 |
|
|
|