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 |
|
|
/* */ |
30 |
|
|
/* FUNCTION RELEASE */ |
31 |
|
|
/* */ |
32 |
|
|
/* _gx_display_driver_1bpp_horizontal_line_draw PORTABLE C */ |
33 |
|
|
/* 6.1 */ |
34 |
|
|
/* AUTHOR */ |
35 |
|
|
/* */ |
36 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
37 |
|
|
/* */ |
38 |
|
|
/* DESCRIPTION */ |
39 |
|
|
/* */ |
40 |
|
|
/* Horizontal line draw function for 1bpp display driver. */ |
41 |
|
|
/* */ |
42 |
|
|
/* INPUT */ |
43 |
|
|
/* */ |
44 |
|
|
/* context Drawing context */ |
45 |
|
|
/* xstart x-coord of left endpoint */ |
46 |
|
|
/* xend x-coord of right endpoint */ |
47 |
|
|
/* ypos y-coord of line top */ |
48 |
|
|
/* width Width (height) 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 |
|
|
/**************************************************************************/ |
72 |
|
197703 |
VOID _gx_display_driver_1bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, 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 |
|
197703 |
stride = (context -> gx_draw_context_pitch + 7) >> 3; |
83 |
|
|
|
84 |
|
|
/* pick up start address of canvas memory */ |
85 |
|
197703 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
86 |
|
197703 |
putrow += ypos * stride; |
87 |
|
197703 |
putrow += (xstart >> 3); |
88 |
|
|
|
89 |
✓✓ |
3444379 |
for (row = 0; row < width; row++) |
90 |
|
|
{ |
91 |
|
3246676 |
put = putrow; |
92 |
|
|
|
93 |
|
3246676 |
mask = (GX_UBYTE)(0x80 >> (xstart & 0x07)); |
94 |
|
|
|
95 |
|
3246676 |
column = xstart; |
96 |
✓✓ |
33033568 |
while (column <= xend) |
97 |
|
|
{ |
98 |
✓✓✓✓
|
29786892 |
if ((mask == 0x80) && (xend - column + 1 >= 8)) |
99 |
|
|
{ |
100 |
✓✓ |
189576391 |
while (xend - column + 1 >= 8) |
101 |
|
|
{ |
102 |
✓✓ |
186435595 |
if (color == 0x00) |
103 |
|
|
{ |
104 |
|
100691948 |
*put++ = 0x00; |
105 |
|
|
} |
106 |
✓✓ |
85743647 |
else if (color == 0x01) |
107 |
|
|
{ |
108 |
|
85673526 |
*put++ = 0xff; |
109 |
|
|
} |
110 |
|
|
|
111 |
|
186435595 |
column += 8; |
112 |
|
|
} |
113 |
|
|
} |
114 |
|
|
else |
115 |
|
|
{ |
116 |
✓✓ |
26646096 |
if (color == 0x00) |
117 |
|
|
{ |
118 |
|
18683458 |
*put = (GX_UBYTE)((*put) & (~mask)); |
119 |
|
|
} |
120 |
✓✓ |
7962638 |
else if (color == 0x01) |
121 |
|
|
{ |
122 |
|
7947948 |
*put |= mask; |
123 |
|
|
} |
124 |
|
|
|
125 |
|
26646096 |
mask >>= 1; |
126 |
|
|
|
127 |
✓✓ |
26646096 |
if (mask == 0) |
128 |
|
|
{ |
129 |
|
2765291 |
put++; |
130 |
|
2765291 |
mask = 0x80; |
131 |
|
|
} |
132 |
|
|
|
133 |
|
26646096 |
column++; |
134 |
|
|
} |
135 |
|
|
} |
136 |
|
|
|
137 |
|
3246676 |
putrow += stride; |
138 |
|
|
} |
139 |
|
197703 |
} |
140 |
|
|
|