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_system.h" |
29 |
|
|
#include "gx_utility.h" |
30 |
|
|
#include "gx_display.h" |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gx_display_driver_1bpp_glyph_1bpp_draw PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This draws the specified text using the current context, */ |
46 |
|
|
/* clipped to one viewport */ |
47 |
|
|
/* */ |
48 |
|
|
/* INPUT */ |
49 |
|
|
/* */ |
50 |
|
|
/* context Draw context */ |
51 |
|
|
/* draw_area The rectangle where the glyph */ |
52 |
|
|
/* is to be drawn. */ |
53 |
|
|
/* map_offset Offset into the glyph */ |
54 |
|
|
/* glyph Pointer to glyph structure */ |
55 |
|
|
/* */ |
56 |
|
|
/* OUTPUT */ |
57 |
|
|
/* */ |
58 |
|
|
/* None */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLS */ |
61 |
|
|
/* */ |
62 |
|
|
/* None */ |
63 |
|
|
/* */ |
64 |
|
|
/* CALLED BY */ |
65 |
|
|
/* */ |
66 |
|
|
/* _gx_canvas_text_draw */ |
67 |
|
|
/* */ |
68 |
|
|
/**************************************************************************/ |
69 |
|
|
|
70 |
|
|
/* Draw area defines where the glyph is drawn. The draw area is not larger than the glyph. If it is smaller than |
71 |
|
|
the glyph, the map_offset defines the how many rows on the top to skip, and how many col on the left to skip. */ |
72 |
|
|
|
73 |
|
135578 |
VOID _gx_display_driver_1bpp_glyph_1bpp_draw(GX_DRAW_CONTEXT *context, GX_RECTANGLE *draw_area, GX_POINT *map_offset, GX_CONST GX_GLYPH *glyph) |
74 |
|
|
{ |
75 |
|
|
INT xval; |
76 |
|
|
INT yval; |
77 |
|
|
INT width; |
78 |
|
|
GX_UBYTE *putrow; |
79 |
|
|
GX_UBYTE *getrow; |
80 |
|
|
GX_UBYTE *put; |
81 |
|
|
GX_CONST GX_UBYTE *get; |
82 |
|
|
GX_UBYTE putmask; |
83 |
|
|
GX_UBYTE getmask; |
84 |
|
|
INT putstride; |
85 |
|
|
INT getstride; |
86 |
|
|
GX_UBYTE text_color; |
87 |
|
|
|
88 |
|
135578 |
text_color = (GX_UBYTE)context -> gx_draw_context_brush.gx_brush_line_color; |
89 |
|
|
|
90 |
|
135578 |
putstride = (context -> gx_draw_context_pitch + 7) >> 3; |
91 |
|
135578 |
getstride = (glyph -> gx_glyph_width + 7) >> 3; |
92 |
|
|
|
93 |
|
135578 |
putrow = (GX_UBYTE *)context -> gx_draw_context_memory; |
94 |
|
135578 |
putrow += (draw_area -> gx_rectangle_top * putstride); |
95 |
|
135578 |
putrow += (draw_area -> gx_rectangle_left >> 3); |
96 |
|
|
|
97 |
|
135578 |
getrow = (GX_UBYTE *)(glyph -> gx_glyph_map); |
98 |
|
135578 |
getrow += (map_offset -> gx_point_y * getstride); |
99 |
|
135578 |
getrow += (map_offset -> gx_point_x >> 3); |
100 |
|
|
|
101 |
|
135578 |
width = draw_area -> gx_rectangle_right - draw_area -> gx_rectangle_left + 1; |
102 |
|
|
|
103 |
✓✓ |
1730710 |
for (yval = draw_area -> gx_rectangle_top; yval <= draw_area -> gx_rectangle_bottom; yval++) |
104 |
|
|
{ |
105 |
|
1595132 |
put = putrow; |
106 |
|
1595132 |
get = getrow; |
107 |
|
|
|
108 |
|
1595132 |
putmask = (GX_UBYTE)(0x80 >> (draw_area -> gx_rectangle_left & 0x07)); |
109 |
|
1595132 |
getmask = (GX_UBYTE)(0x80 >> (map_offset -> gx_point_x & 0x07)); |
110 |
|
|
|
111 |
✓✓ |
13467014 |
for (xval = 0; xval < width; xval++) |
112 |
|
|
{ |
113 |
✓✓ |
11871882 |
if (text_color == 0x01) |
114 |
|
|
{ |
115 |
✓✓ |
9507621 |
if ((*get) & getmask) |
116 |
|
|
{ |
117 |
|
5137944 |
*put |= putmask; |
118 |
|
|
} |
119 |
|
|
} |
120 |
✓✓ |
2364261 |
else if (text_color == 0x00) |
121 |
|
|
{ |
122 |
✓✓ |
2363055 |
if ((*get) & getmask) |
123 |
|
|
{ |
124 |
|
1280479 |
*put = (GX_UBYTE)((*put) & (~putmask)); |
125 |
|
|
} |
126 |
|
|
} |
127 |
|
|
|
128 |
|
11871882 |
getmask >>= 1; |
129 |
|
11871882 |
putmask >>= 1; |
130 |
|
|
|
131 |
✓✓ |
11871882 |
if (!getmask) |
132 |
|
|
{ |
133 |
|
952992 |
getmask = 0x80; |
134 |
|
952992 |
get++; |
135 |
|
|
} |
136 |
|
|
|
137 |
✓✓ |
11871882 |
if (!putmask) |
138 |
|
|
{ |
139 |
|
1509758 |
putmask = 0x80; |
140 |
|
1509758 |
put++; |
141 |
|
|
} |
142 |
|
|
} |
143 |
|
|
|
144 |
|
1595132 |
putrow += putstride; |
145 |
|
1595132 |
getrow += getstride; |
146 |
|
|
} |
147 |
|
135578 |
} |
148 |
|
|
|