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 |
|
|
|
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_4bpp_vertical_pattern_line_draw PORTABLE C */ |
33 |
|
|
/* 6.1.7 */ |
34 |
|
|
/* AUTHOR */ |
35 |
|
|
/* */ |
36 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
37 |
|
|
/* */ |
38 |
|
|
/* DESCRIPTION */ |
39 |
|
|
/* */ |
40 |
|
|
/* Vertical line draw function for 4bpp 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 |
|
|
/* */ |
49 |
|
|
/* OUTPUT */ |
50 |
|
|
/* */ |
51 |
|
|
/* None */ |
52 |
|
|
/* */ |
53 |
|
|
/* CALLS */ |
54 |
|
|
/* */ |
55 |
|
|
/* None */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLED BY */ |
58 |
|
|
/* */ |
59 |
|
|
/* GUIX Internal Code */ |
60 |
|
|
/* */ |
61 |
|
|
/* RELEASE HISTORY */ |
62 |
|
|
/* */ |
63 |
|
|
/* DATE NAME DESCRIPTION */ |
64 |
|
|
/* */ |
65 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
66 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
67 |
|
|
/* resulting in version 6.1 */ |
68 |
|
|
/* 06-02-2021 Kenneth Maxwell Modified comment(s), */ |
69 |
|
|
/* removed unused variable */ |
70 |
|
|
/* assignment, */ |
71 |
|
|
/* resulting in version 6.1.7 */ |
72 |
|
|
/* */ |
73 |
|
|
/**************************************************************************/ |
74 |
|
11 |
VOID _gx_display_driver_4bpp_vertical_pattern_line_draw(GX_DRAW_CONTEXT *context, INT ystart, INT yend, INT xpos) |
75 |
|
|
{ |
76 |
|
|
INT row; |
77 |
|
|
GX_UBYTE *put; |
78 |
|
|
GX_UBYTE *putrow; |
79 |
|
|
ULONG pattern; |
80 |
|
|
ULONG pattern_mask; |
81 |
|
|
GX_UBYTE on_color; |
82 |
|
|
GX_UBYTE off_color; |
83 |
|
|
GX_UBYTE draw_mask; |
84 |
|
|
INT stride; |
85 |
|
|
|
86 |
|
|
/* pick up row pitch in bytes. */ |
87 |
|
11 |
stride = (context -> gx_draw_context_pitch + 1) >> 1; |
88 |
|
|
|
89 |
|
|
/* pick up starting address of canvas memory */ |
90 |
|
11 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
91 |
|
11 |
putrow += ystart * stride; |
92 |
|
11 |
putrow += (xpos >> 1); |
93 |
|
|
|
94 |
|
|
/* pick up the requested pattern and mask */ |
95 |
|
11 |
pattern = context -> gx_draw_context_brush.gx_brush_line_pattern; |
96 |
|
11 |
pattern_mask = context -> gx_draw_context_brush.gx_brush_pattern_mask; |
97 |
|
|
|
98 |
|
11 |
on_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color & 0x0f; |
99 |
|
11 |
on_color |= (GX_UBYTE)(on_color << 4); |
100 |
|
11 |
off_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_fill_color & 0x0f; |
101 |
|
11 |
off_color |= (GX_UBYTE)(off_color << 4); |
102 |
|
|
|
103 |
|
|
/* draw line from top to bottom */ |
104 |
✓✓ |
1850 |
for (row = ystart; row <= yend; row++) |
105 |
|
|
{ |
106 |
|
1839 |
put = putrow; |
107 |
✓✓ |
1839 |
if (xpos & 0x01) |
108 |
|
|
{ |
109 |
|
1610 |
draw_mask = 0x0f; |
110 |
|
|
} |
111 |
|
|
else |
112 |
|
|
{ |
113 |
|
229 |
draw_mask = 0xf0; |
114 |
|
|
} |
115 |
|
|
|
116 |
|
|
/* Set bits to 0 first */ |
117 |
|
1839 |
*put &= (GX_UBYTE)(~draw_mask); |
118 |
|
|
|
119 |
|
|
/* Set bits color */ |
120 |
✓✓ |
1839 |
if (pattern & pattern_mask) |
121 |
|
|
{ |
122 |
|
914 |
*put |= (on_color & draw_mask); |
123 |
|
|
} |
124 |
|
|
else |
125 |
|
|
{ |
126 |
|
925 |
*put |= (off_color & draw_mask); |
127 |
|
|
} |
128 |
|
|
|
129 |
|
1839 |
pattern_mask >>= 1; |
130 |
✓✓ |
1839 |
if (!pattern_mask) |
131 |
|
|
{ |
132 |
|
67 |
pattern_mask = 0x80000000; |
133 |
|
|
} |
134 |
|
|
|
135 |
|
|
/* advance to the next scaneline */ |
136 |
|
1839 |
putrow += stride; |
137 |
|
|
} |
138 |
|
|
|
139 |
|
|
/* save current masks value back to brush */ |
140 |
|
11 |
context -> gx_draw_context_brush.gx_brush_pattern_mask = pattern_mask; |
141 |
|
11 |
} |
142 |
|
|
|