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 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_display.h" |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_display_driver_1bpp_vertical_pattern_line_draw PORTABLE C */ |
36 |
|
|
/* 6.1 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* Vertical pattern line draw function for 1bpp display driver. */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* context Drawing context */ |
48 |
|
|
/* ystart y-coord of top endpoint */ |
49 |
|
|
/* yend y-coord of bottom endpoint */ |
50 |
|
|
/* xpos x-coord of left edge */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* None */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* None */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLED BY */ |
61 |
|
|
/* */ |
62 |
|
|
/* GUIX Internal Code */ |
63 |
|
|
/* */ |
64 |
|
|
/**************************************************************************/ |
65 |
|
21 |
VOID _gx_display_driver_1bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos) |
66 |
|
|
{ |
67 |
|
|
INT row; |
68 |
|
|
GX_UBYTE *put; |
69 |
|
|
GX_UBYTE *putrow; |
70 |
|
|
ULONG pattern; |
71 |
|
|
ULONG pattern_mask; |
72 |
|
|
GX_UBYTE on_color; |
73 |
|
|
GX_UBYTE off_color; |
74 |
|
|
GX_UBYTE draw_mask; |
75 |
|
|
INT stride; |
76 |
|
|
|
77 |
|
|
/* pick up row pitch in bytes. */ |
78 |
|
21 |
stride = (context -> gx_draw_context_pitch + 7) >> 3; |
79 |
|
|
|
80 |
|
|
/* pick up starting address of canvas memory */ |
81 |
|
21 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
82 |
|
21 |
putrow += ystart * stride; |
83 |
|
21 |
putrow += (xpos >> 3); |
84 |
|
|
|
85 |
|
|
/* pick up the requested pattern and mask */ |
86 |
|
21 |
pattern = context -> gx_draw_context_brush.gx_brush_line_pattern; |
87 |
|
21 |
pattern_mask = context -> gx_draw_context_brush.gx_brush_pattern_mask; |
88 |
|
|
|
89 |
|
21 |
on_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color & 0x01; |
90 |
|
21 |
off_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_fill_color & 0x01; |
91 |
|
21 |
draw_mask = (GX_UBYTE)(0x80 >> (xpos & 0x07)); |
92 |
|
|
|
93 |
|
|
/* draw line from top to bottom */ |
94 |
✓✓ |
3682 |
for (row = ystart; row <= yend; row++) |
95 |
|
|
{ |
96 |
|
3661 |
put = putrow; |
97 |
|
|
|
98 |
✓✓ |
3661 |
if (pattern & pattern_mask) |
99 |
|
|
{ |
100 |
✓✓ |
1820 |
if (on_color == 0x00) |
101 |
|
|
{ |
102 |
|
1020 |
*put = (GX_UBYTE)((*put) & (~draw_mask)); |
103 |
|
|
} |
104 |
|
|
else |
105 |
|
|
{ |
106 |
|
800 |
*put |= draw_mask; |
107 |
|
|
} |
108 |
|
|
} |
109 |
|
|
else |
110 |
|
|
{ |
111 |
✓✓ |
1841 |
if (off_color == 0x00) |
112 |
|
|
{ |
113 |
|
810 |
*put = (GX_UBYTE)((*put) & (~draw_mask)); |
114 |
|
|
} |
115 |
|
|
else |
116 |
|
|
{ |
117 |
|
1031 |
*put |= draw_mask; |
118 |
|
|
} |
119 |
|
|
} |
120 |
|
|
|
121 |
|
3661 |
pattern_mask >>= 1; |
122 |
✓✓ |
3661 |
if (!pattern_mask) |
123 |
|
|
{ |
124 |
|
134 |
pattern_mask = 0x80000000; |
125 |
|
|
} |
126 |
|
|
|
127 |
|
|
/* advance to the next scaneline */ |
128 |
|
3661 |
putrow += stride; |
129 |
|
|
} |
130 |
|
|
|
131 |
|
|
/* save current masks value back to brush */ |
132 |
|
21 |
context -> gx_draw_context_brush.gx_brush_pattern_mask = pattern_mask; |
133 |
|
21 |
} |
134 |
|
|
|