1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
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 |
|
|
/* */ |
31 |
|
|
/* FUNCTION RELEASE */ |
32 |
|
|
/* */ |
33 |
|
|
/* _gx_display_driver_1bpp_horizontal_line_draw PORTABLE C */ |
34 |
|
|
/* 6.1 */ |
35 |
|
|
/* AUTHOR */ |
36 |
|
|
/* */ |
37 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
38 |
|
|
/* */ |
39 |
|
|
/* DESCRIPTION */ |
40 |
|
|
/* */ |
41 |
|
|
/* Horizontal line draw function for 1bpp display driver. */ |
42 |
|
|
/* */ |
43 |
|
|
/* INPUT */ |
44 |
|
|
/* */ |
45 |
|
|
/* context Drawing context */ |
46 |
|
|
/* xstart x-coord of left endpoint */ |
47 |
|
|
/* xend x-coord of right endpoint */ |
48 |
|
|
/* ypos y-coord of line top */ |
49 |
|
|
/* width Width (height) of the line */ |
50 |
|
|
/* color Color of line to write */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* None */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* None */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLED BY */ |
61 |
|
|
/* */ |
62 |
|
|
/* GUIX Internal Code */ |
63 |
|
|
/* */ |
64 |
|
|
/**************************************************************************/ |
65 |
|
197703 |
VOID _gx_display_driver_1bpp_horizontal_line_draw(GX_DRAW_CONTEXT *context, INT xstart, INT xend, INT ypos, INT width, GX_COLOR color) |
66 |
|
|
{ |
67 |
|
|
INT row; |
68 |
|
|
INT column; |
69 |
|
|
GX_UBYTE *put; |
70 |
|
|
GX_UBYTE *putrow; |
71 |
|
|
GX_UBYTE mask; |
72 |
|
|
INT stride; |
73 |
|
|
|
74 |
|
|
/* Get row pitch in bytes. */ |
75 |
|
197703 |
stride = (context -> gx_draw_context_pitch + 7) >> 3; |
76 |
|
|
|
77 |
|
|
/* pick up start address of canvas memory */ |
78 |
|
197703 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
79 |
|
197703 |
putrow += ypos * stride; |
80 |
|
197703 |
putrow += (xstart >> 3); |
81 |
|
|
|
82 |
✓✓ |
3444379 |
for (row = 0; row < width; row++) |
83 |
|
|
{ |
84 |
|
3246676 |
put = putrow; |
85 |
|
|
|
86 |
|
3246676 |
mask = (GX_UBYTE)(0x80 >> (xstart & 0x07)); |
87 |
|
|
|
88 |
|
3246676 |
column = xstart; |
89 |
✓✓ |
33033568 |
while (column <= xend) |
90 |
|
|
{ |
91 |
✓✓✓✓
|
29786892 |
if ((mask == 0x80) && (xend - column + 1 >= 8)) |
92 |
|
|
{ |
93 |
✓✓ |
189576391 |
while (xend - column + 1 >= 8) |
94 |
|
|
{ |
95 |
✓✓ |
186435595 |
if (color == 0x00) |
96 |
|
|
{ |
97 |
|
100691948 |
*put++ = 0x00; |
98 |
|
|
} |
99 |
✓✓ |
85743647 |
else if (color == 0x01) |
100 |
|
|
{ |
101 |
|
85673526 |
*put++ = 0xff; |
102 |
|
|
} |
103 |
|
|
|
104 |
|
186435595 |
column += 8; |
105 |
|
|
} |
106 |
|
|
} |
107 |
|
|
else |
108 |
|
|
{ |
109 |
✓✓ |
26646096 |
if (color == 0x00) |
110 |
|
|
{ |
111 |
|
18683458 |
*put = (GX_UBYTE)((*put) & (~mask)); |
112 |
|
|
} |
113 |
✓✓ |
7962638 |
else if (color == 0x01) |
114 |
|
|
{ |
115 |
|
7947948 |
*put |= mask; |
116 |
|
|
} |
117 |
|
|
|
118 |
|
26646096 |
mask >>= 1; |
119 |
|
|
|
120 |
✓✓ |
26646096 |
if (mask == 0) |
121 |
|
|
{ |
122 |
|
2765291 |
put++; |
123 |
|
2765291 |
mask = 0x80; |
124 |
|
|
} |
125 |
|
|
|
126 |
|
26646096 |
column++; |
127 |
|
|
} |
128 |
|
|
} |
129 |
|
|
|
130 |
|
3246676 |
putrow += stride; |
131 |
|
|
} |
132 |
|
197703 |
} |
133 |
|
|
|