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 |
|
|
/** Utility (Utility) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_system.h" |
28 |
|
|
#include "gx_utility.h" |
29 |
|
|
#include "gx_canvas.h" |
30 |
|
|
|
31 |
|
|
#define DRAW_PIXEL if (data & mask) \ |
32 |
|
|
{ \ |
33 |
|
|
*write_data = 0xff; \ |
34 |
|
|
} \ |
35 |
|
|
write_data++; \ |
36 |
|
|
mask = mask >> 1; |
37 |
|
|
|
38 |
|
|
#if defined(GX_RENESAS_DAVE2D_FONT_SUPPORT) |
39 |
|
|
#define DRAW_REVERSED_PIXEL if (data & mask) \ |
40 |
|
|
{ \ |
41 |
|
|
*write_data = 0xff; \ |
42 |
|
|
} \ |
43 |
|
|
write_data++; \ |
44 |
|
|
mask = (GX_UBYTE)(mask << 1); |
45 |
|
|
#endif |
46 |
|
|
|
47 |
|
|
/**************************************************************************/ |
48 |
|
|
/* */ |
49 |
|
|
/* FUNCTION RELEASE */ |
50 |
|
|
/* */ |
51 |
|
|
/* _gx_utility_string_to_alphamap PORTABLE C */ |
52 |
|
|
/* 6.1.3 */ |
53 |
|
|
/* AUTHOR */ |
54 |
|
|
/* */ |
55 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
56 |
|
|
/* */ |
57 |
|
|
/* DESCRIPTION (Deprecated) */ |
58 |
|
|
/* */ |
59 |
|
|
/* This function draws text to an 8bpp memory alphamap. */ |
60 |
|
|
/* */ |
61 |
|
|
/* INPUT */ |
62 |
|
|
/* */ |
63 |
|
|
/* text Pointer to string */ |
64 |
|
|
/* font Font for text drawing */ |
65 |
|
|
/* textmap Pointer to pixemap structure */ |
66 |
|
|
/* */ |
67 |
|
|
/* OUTPUT */ |
68 |
|
|
/* */ |
69 |
|
|
/* status Completion status */ |
70 |
|
|
/* */ |
71 |
|
|
/* CALLS */ |
72 |
|
|
/* */ |
73 |
|
|
/* _gx_utility_string_length_check Validate string length */ |
74 |
|
|
/* _gx_utility_string_to_alphamap_ext New version of this function */ |
75 |
|
|
/* */ |
76 |
|
|
/* CALLED BY */ |
77 |
|
|
/* */ |
78 |
|
|
/* Application Software */ |
79 |
|
|
/* */ |
80 |
|
|
/**************************************************************************/ |
81 |
|
|
#if defined(GX_ENABLE_DEPRECATED_STRING_API) |
82 |
|
6 |
UINT _gx_utility_string_to_alphamap(GX_CONST GX_CHAR *text, GX_CONST GX_FONT *font, GX_PIXELMAP *textmap) |
83 |
|
|
{ |
84 |
|
|
UINT status; |
85 |
|
|
UINT length; |
86 |
|
|
GX_STRING string; |
87 |
|
|
|
88 |
|
6 |
string.gx_string_ptr = text; |
89 |
|
6 |
status = _gx_utility_string_length_check(text, &length, GX_MAX_STRING_LENGTH); |
90 |
✓✓ |
6 |
if (status == GX_SUCCESS) |
91 |
|
|
{ |
92 |
|
5 |
string.gx_string_length = length; |
93 |
|
5 |
status = _gx_utility_string_to_alphamap_ext(&string, font, textmap); |
94 |
|
|
} |
95 |
|
6 |
return status; |
96 |
|
|
} |
97 |
|
|
#endif |
98 |
|
|
|
99 |
|
|
/**************************************************************************/ |
100 |
|
|
/* */ |
101 |
|
|
/* FUNCTION RELEASE */ |
102 |
|
|
/* */ |
103 |
|
|
/* _gx_utility_string_to_alphamap_ext PORTABLE C */ |
104 |
|
|
/* 6.1.3 */ |
105 |
|
|
/* AUTHOR */ |
106 |
|
|
/* */ |
107 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
108 |
|
|
/* */ |
109 |
|
|
/* DESCRIPTION (Deprecated) */ |
110 |
|
|
/* */ |
111 |
|
|
/* This function draws text to an 8bpp memory alphamap. */ |
112 |
|
|
/* */ |
113 |
|
|
/* INPUT */ |
114 |
|
|
/* */ |
115 |
|
|
/* text Pointer to string */ |
116 |
|
|
/* font Font for text drawing */ |
117 |
|
|
/* textmap Pointer to pixemap structure */ |
118 |
|
|
/* */ |
119 |
|
|
/* OUTPUT */ |
120 |
|
|
/* */ |
121 |
|
|
/* status Completion status */ |
122 |
|
|
/* */ |
123 |
|
|
/* CALLS */ |
124 |
|
|
/* */ |
125 |
|
|
/* _gx_system_string_width_get Get width of the string in */ |
126 |
|
|
/* pixels */ |
127 |
|
|
/* _gx_canvas_text_draw Draw glyphs on canvas */ |
128 |
|
|
/* _gx_utility_string_to_alphamap Convert string to alpha-map */ |
129 |
|
|
/* _gx_utiity_pixelmap_rotate Rotate alphaap to desired */ |
130 |
|
|
/* angle */ |
131 |
|
|
/* _gx_canvas_pixelmap_draw Draw text alphamap */ |
132 |
|
|
/* _gx_system_memory_free Free memory used for rotated */ |
133 |
|
|
/* alphamap and canvas */ |
134 |
|
|
/* */ |
135 |
|
|
/* CALLED BY */ |
136 |
|
|
/* */ |
137 |
|
|
/* Application Software */ |
138 |
|
|
/* */ |
139 |
|
|
/**************************************************************************/ |
140 |
|
4280 |
UINT _gx_utility_string_to_alphamap_ext(GX_CONST GX_STRING *string, GX_CONST GX_FONT *font, GX_PIXELMAP *textmap) |
141 |
|
|
{ |
142 |
|
|
GX_VALUE alphamap_width; |
143 |
|
|
GX_VALUE alphamap_height; |
144 |
|
|
UINT status; |
145 |
|
4280 |
GX_CONST GX_FONT *font_page = font; |
146 |
|
|
GX_CHAR_CODE char_val; |
147 |
|
|
GX_CONST GX_GLYPH *glyph; |
148 |
|
4280 |
GX_BOOL first_glyph = GX_TRUE; |
149 |
|
|
GX_STRING string_copy; |
150 |
|
|
|
151 |
|
|
#ifdef GX_UTF8_SUPPORT |
152 |
|
|
UINT glyph_len; |
153 |
|
|
#endif |
154 |
|
|
|
155 |
|
4280 |
string_copy = *string; |
156 |
|
4280 |
_gx_system_string_width_get_ext(font, &string_copy, &alphamap_width); |
157 |
|
|
|
158 |
✓✓ |
21616 |
while (string_copy.gx_string_length) |
159 |
|
|
{ |
160 |
|
|
#ifdef GX_UTF8_SUPPORT |
161 |
|
17337 |
_gx_utility_utf8_string_character_get(&string_copy, &char_val, &glyph_len); |
162 |
|
|
#else |
163 |
|
|
char_val = (GX_CHAR_CODE)(*string_copy.gx_string_ptr); |
164 |
|
|
string_copy.gx_string_ptr++; |
165 |
|
|
string_copy.gx_string_length--; |
166 |
|
|
#endif /* GX_UTF8_SUPPORT */ |
167 |
|
|
|
168 |
✓✓ |
17337 |
if (!char_val) |
169 |
|
|
{ |
170 |
|
1 |
break; |
171 |
|
|
} |
172 |
|
|
|
173 |
✓✓✓✓
|
17336 |
if (first_glyph || string_copy.gx_string_ptr[0] == GX_NULL) |
174 |
|
|
{ |
175 |
✓✓ |
8560 |
while (font_page) |
176 |
|
|
{ |
177 |
✓✓ |
8558 |
if (font_page -> gx_font_first_glyph <= char_val && |
178 |
✓✓ |
8554 |
font_page -> gx_font_last_glyph >= char_val) |
179 |
|
|
{ |
180 |
|
8549 |
break; |
181 |
|
|
} |
182 |
|
9 |
font_page = font_page -> gx_font_next_page; |
183 |
|
|
} |
184 |
|
|
|
185 |
✓✓ |
8551 |
if (font_page) |
186 |
|
|
{ |
187 |
|
8549 |
glyph = &font_page -> gx_font_glyphs.gx_font_normal_glyphs[char_val - font_page -> gx_font_first_glyph]; |
188 |
|
|
|
189 |
✓✓ |
8549 |
if (first_glyph) |
190 |
|
|
{ |
191 |
|
4279 |
first_glyph = GX_FALSE; |
192 |
|
|
|
193 |
✓✓ |
4279 |
if (glyph -> gx_glyph_leading < 0) |
194 |
|
|
{ |
195 |
|
388 |
alphamap_width = (GX_VALUE)(alphamap_width - glyph -> gx_glyph_leading); |
196 |
|
|
} |
197 |
|
|
} |
198 |
|
|
else |
199 |
|
|
{ |
200 |
|
|
/* Last glyph. */ |
201 |
|
4270 |
alphamap_width = (GX_VALUE)(alphamap_width + glyph -> gx_glyph_leading); |
202 |
|
|
|
203 |
✓✓ |
4270 |
if (glyph -> gx_glyph_width > glyph -> gx_glyph_advance) |
204 |
|
|
{ |
205 |
|
3 |
alphamap_width = (GX_VALUE)(alphamap_width + glyph -> gx_glyph_width - glyph -> gx_glyph_advance); |
206 |
|
|
} |
207 |
|
|
} |
208 |
|
|
} |
209 |
|
|
} |
210 |
|
|
} |
211 |
|
|
|
212 |
|
4280 |
alphamap_height = font -> gx_font_line_height; |
213 |
|
|
|
214 |
✓✓✓✓
|
4280 |
if (alphamap_width && alphamap_height) |
215 |
|
|
{ |
216 |
|
|
/* create an alphamap into which to draw the text */ |
217 |
|
4278 |
status = _gx_utility_alphamap_create(alphamap_width, alphamap_height, textmap); |
218 |
✓✓ |
4278 |
if (status == GX_SUCCESS) |
219 |
|
|
{ |
220 |
|
|
/* Draw the text into our temporary canvas */ |
221 |
|
4259 |
_gx_utility_string_to_alphamap_draw(string, font, textmap); |
222 |
|
|
} |
223 |
|
|
} |
224 |
|
|
else |
225 |
|
|
{ |
226 |
|
2 |
status = GX_FAILURE; |
227 |
|
|
} |
228 |
|
|
|
229 |
|
4280 |
return status; |
230 |
|
|
} |
231 |
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
/**************************************************************************/ |
235 |
|
|
/* */ |
236 |
|
|
/* FUNCTION RELEASE */ |
237 |
|
|
/* */ |
238 |
|
|
/* _gx_utility_glyph_8bpp_to_alphamap_draw PORTABLE C */ |
239 |
|
|
/* 6.1.3 */ |
240 |
|
|
/* AUTHOR */ |
241 |
|
|
/* */ |
242 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
243 |
|
|
/* */ |
244 |
|
|
/* DESCRIPTION */ |
245 |
|
|
/* */ |
246 |
|
|
/* Internal helper function that renders 8bpp glyph into alpha-map */ |
247 |
|
|
/* memory. */ |
248 |
|
|
/* */ |
249 |
|
|
/* INPUT */ |
250 |
|
|
/* */ |
251 |
|
|
/* map Pixelmap that the glyph is */ |
252 |
|
|
/* drawn to */ |
253 |
|
|
/* xpos X-coord where the glyph is */ |
254 |
|
|
/* drawn to */ |
255 |
|
|
/* ypos Y-coord where the glyph is */ |
256 |
|
|
/* darwn to */ |
257 |
|
|
/* glyph Pointer to glyph structure */ |
258 |
|
|
/* */ |
259 |
|
|
/* OUTPUT */ |
260 |
|
|
/* */ |
261 |
|
|
/* status Completion status */ |
262 |
|
|
/* */ |
263 |
|
|
/* CALLS */ |
264 |
|
|
/* */ |
265 |
|
|
/* None */ |
266 |
|
|
/* */ |
267 |
|
|
/* CALLED BY */ |
268 |
|
|
/* */ |
269 |
|
|
/* GUIX Internal Code */ |
270 |
|
|
/* */ |
271 |
|
|
/**************************************************************************/ |
272 |
|
13354 |
VOID _gx_utility_glyph_8bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph) |
273 |
|
|
{ |
274 |
|
|
GX_UBYTE *read_data; |
275 |
|
|
GX_UBYTE *read_row; |
276 |
|
|
GX_UBYTE *write_data; |
277 |
|
|
GX_UBYTE *write_row; |
278 |
|
|
UINT row; |
279 |
|
|
UINT col; |
280 |
|
13354 |
UINT pixel_width = 0; |
281 |
|
|
UINT y_height; |
282 |
|
|
USHORT write_stride; |
283 |
|
|
|
284 |
✓✓ |
13354 |
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270)) |
285 |
|
|
{ |
286 |
|
207 |
write_stride = (USHORT)map -> gx_pixelmap_height; |
287 |
|
207 |
pixel_width = glyph -> gx_glyph_height; |
288 |
|
207 |
y_height = glyph -> gx_glyph_width; |
289 |
|
207 |
GX_SWAP_VALS(xpos, ypos) |
290 |
|
|
|
291 |
✓✓ |
207 |
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90) |
292 |
|
|
{ |
293 |
|
115 |
ypos = (map -> gx_pixelmap_width - ypos - glyph -> gx_glyph_width); |
294 |
|
|
} |
295 |
|
|
else |
296 |
|
|
{ |
297 |
|
92 |
xpos = (map -> gx_pixelmap_height - xpos - glyph -> gx_glyph_height); |
298 |
|
|
} |
299 |
|
|
} |
300 |
|
|
else |
301 |
|
|
{ |
302 |
|
13147 |
write_stride = (USHORT)map -> gx_pixelmap_width; |
303 |
|
13147 |
pixel_width = glyph -> gx_glyph_width; |
304 |
|
13147 |
y_height = glyph -> gx_glyph_height; |
305 |
|
|
} |
306 |
|
|
|
307 |
|
13354 |
read_row = (GX_UBYTE *)glyph -> gx_glyph_map; |
308 |
|
|
|
309 |
|
13354 |
write_row = (GX_UBYTE *)map -> gx_pixelmap_data; |
310 |
|
13354 |
write_row += ypos * write_stride; |
311 |
|
13354 |
write_row += xpos; |
312 |
|
|
|
313 |
✓✓ |
266556 |
for (row = 0; row < y_height; row++) |
314 |
|
|
{ |
315 |
|
253202 |
read_data = read_row; |
316 |
|
253202 |
write_data = write_row; |
317 |
|
|
|
318 |
✓✓ |
3822201 |
for (col = 0; col < pixel_width; col++) |
319 |
|
|
{ |
320 |
|
3568999 |
*write_data++ = *read_data++; |
321 |
|
|
} |
322 |
|
253202 |
read_row += pixel_width; |
323 |
|
253202 |
write_row += write_stride; |
324 |
|
|
} |
325 |
|
13354 |
} |
326 |
|
|
|
327 |
|
|
/**************************************************************************/ |
328 |
|
|
/* */ |
329 |
|
|
/* FUNCTION RELEASE */ |
330 |
|
|
/* */ |
331 |
|
|
/* _gx_utility_glyph_4bpp_to_alphamap_draw PORTABLE C */ |
332 |
|
|
/* 6.1.3 */ |
333 |
|
|
/* AUTHOR */ |
334 |
|
|
/* */ |
335 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
336 |
|
|
/* */ |
337 |
|
|
/* DESCRIPTION */ |
338 |
|
|
/* */ |
339 |
|
|
/* Internal helper function that renders 4bpp glyph into alpha-map */ |
340 |
|
|
/* memory. */ |
341 |
|
|
/* */ |
342 |
|
|
/* INPUT */ |
343 |
|
|
/* */ |
344 |
|
|
/* map Pixelmap that the glyph is */ |
345 |
|
|
/* drawn to */ |
346 |
|
|
/* xpos X-coord where the glyph is */ |
347 |
|
|
/* drawn to */ |
348 |
|
|
/* ypos Y-coord where the glyph is */ |
349 |
|
|
/* darwn to */ |
350 |
|
|
/* glyph Pointer to glyph structure */ |
351 |
|
|
/* */ |
352 |
|
|
/* OUTPUT */ |
353 |
|
|
/* */ |
354 |
|
|
/* status Completion status */ |
355 |
|
|
/* */ |
356 |
|
|
/* CALLS */ |
357 |
|
|
/* */ |
358 |
|
|
/* None */ |
359 |
|
|
/* */ |
360 |
|
|
/* CALLED BY */ |
361 |
|
|
/* */ |
362 |
|
|
/* GUIX Internal Code */ |
363 |
|
|
/* */ |
364 |
|
|
/**************************************************************************/ |
365 |
|
3629 |
VOID _gx_utility_glyph_4bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph) |
366 |
|
|
{ |
367 |
|
|
GX_UBYTE *read_data; |
368 |
|
|
GX_UBYTE *read_row; |
369 |
|
|
GX_UBYTE *write_data; |
370 |
|
|
GX_UBYTE *write_row; |
371 |
|
|
UINT row; |
372 |
|
|
UINT col; |
373 |
|
3629 |
UINT pixel_width = 0; |
374 |
|
|
UINT read_stride; |
375 |
|
|
USHORT write_stride; |
376 |
|
|
UINT y_height; |
377 |
|
|
GX_UBYTE data; |
378 |
|
|
|
379 |
✓✓ |
3629 |
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270)) |
380 |
|
|
{ |
381 |
|
351 |
write_stride = (USHORT)map -> gx_pixelmap_height; |
382 |
|
351 |
pixel_width = glyph -> gx_glyph_height; |
383 |
|
351 |
y_height = glyph -> gx_glyph_width; |
384 |
|
|
|
385 |
|
351 |
GX_SWAP_VALS(xpos, ypos) |
386 |
|
|
|
387 |
✓✓ |
351 |
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90) |
388 |
|
|
{ |
389 |
|
195 |
ypos = (INT)map -> gx_pixelmap_width - (INT)ypos - (INT)y_height; |
390 |
|
|
} |
391 |
|
|
else |
392 |
|
|
{ |
393 |
|
156 |
xpos = (INT)map -> gx_pixelmap_height - (INT)xpos - (INT)pixel_width; |
394 |
|
|
} |
395 |
|
|
} |
396 |
|
|
else |
397 |
|
|
{ |
398 |
|
3278 |
pixel_width = (USHORT)glyph -> gx_glyph_width; |
399 |
|
3278 |
y_height = glyph -> gx_glyph_height; |
400 |
|
3278 |
write_stride = (USHORT)map -> gx_pixelmap_width; |
401 |
|
|
} |
402 |
|
|
|
403 |
|
3629 |
read_row = (GX_UBYTE *)glyph -> gx_glyph_map; |
404 |
|
3629 |
write_row = (GX_UBYTE *)map -> gx_pixelmap_data; |
405 |
|
3629 |
write_row += ypos * write_stride; |
406 |
|
3629 |
write_row += xpos; |
407 |
|
|
|
408 |
|
3629 |
read_stride = (pixel_width + 1) / 2; |
409 |
|
|
|
410 |
✓✓ |
47394 |
for (row = 0; row < y_height; row++) |
411 |
|
|
{ |
412 |
|
43765 |
read_data = read_row; |
413 |
|
43765 |
write_data = write_row; |
414 |
|
|
|
415 |
✓✓ |
294860 |
for (col = 0; col < pixel_width; col++) |
416 |
|
|
{ |
417 |
|
251095 |
data = *read_data++; |
418 |
|
|
|
419 |
|
251095 |
*write_data++ = (GX_UBYTE)((data & 0xf0) | (data >> 4)); |
420 |
|
251095 |
col++; |
421 |
|
|
|
422 |
✓✓ |
251095 |
if (col < pixel_width) |
423 |
|
|
{ |
424 |
|
221353 |
*write_data++ = (GX_UBYTE)((data << 4) | (data & 0x0f)); |
425 |
|
|
} |
426 |
|
|
} |
427 |
|
43765 |
read_row += read_stride; |
428 |
|
43765 |
write_row += write_stride; |
429 |
|
|
} |
430 |
|
3629 |
} |
431 |
|
|
|
432 |
|
|
/**************************************************************************/ |
433 |
|
|
/* */ |
434 |
|
|
/* FUNCTION RELEASE */ |
435 |
|
|
/* */ |
436 |
|
|
/* _gx_utility_glyph_reversed_4bpp_to_alphamap_draw PORTABLE C */ |
437 |
|
|
/* 6.1.3 */ |
438 |
|
|
/* AUTHOR */ |
439 |
|
|
/* */ |
440 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
441 |
|
|
/* */ |
442 |
|
|
/* DESCRIPTION */ |
443 |
|
|
/* */ |
444 |
|
|
/* Internal helper function that renders 4bpp reversed bit order glyph */ |
445 |
|
|
/* into alpha-map memory. */ |
446 |
|
|
/* */ |
447 |
|
|
/* INPUT */ |
448 |
|
|
/* */ |
449 |
|
|
/* map Pixelmap that the glyph is */ |
450 |
|
|
/* drawn to */ |
451 |
|
|
/* xpos X-coord where the glyph is */ |
452 |
|
|
/* drawn to */ |
453 |
|
|
/* ypos Y-coord where the glyph is */ |
454 |
|
|
/* darwn to */ |
455 |
|
|
/* glyph Pointer to glyph structure */ |
456 |
|
|
/* */ |
457 |
|
|
/* OUTPUT */ |
458 |
|
|
/* */ |
459 |
|
|
/* status Completion status */ |
460 |
|
|
/* */ |
461 |
|
|
/* CALLS */ |
462 |
|
|
/* */ |
463 |
|
|
/* None */ |
464 |
|
|
/* */ |
465 |
|
|
/* CALLED BY */ |
466 |
|
|
/* */ |
467 |
|
|
/* GUIX Internal Code */ |
468 |
|
|
/* */ |
469 |
|
|
/**************************************************************************/ |
470 |
|
|
#if defined(GX_RENESAS_DAVE2D_FONT_SUPPORT) |
471 |
|
|
VOID _gx_utility_glyph_reversed_4bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph) |
472 |
|
|
{ |
473 |
|
|
GX_UBYTE *read_data; |
474 |
|
|
GX_UBYTE *read_row; |
475 |
|
|
GX_UBYTE *write_data; |
476 |
|
|
GX_UBYTE *write_row; |
477 |
|
|
UINT row; |
478 |
|
|
UINT col; |
479 |
|
|
UINT pixel_width = 0; |
480 |
|
|
UINT byte_width; |
481 |
|
|
UINT y_height; |
482 |
|
|
USHORT write_stride; |
483 |
|
|
GX_UBYTE data; |
484 |
|
|
|
485 |
|
|
|
486 |
|
|
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270)) |
487 |
|
|
{ |
488 |
|
|
write_stride = (USHORT)map -> gx_pixelmap_height; |
489 |
|
|
pixel_width = glyph -> gx_glyph_height; |
490 |
|
|
y_height = glyph -> gx_glyph_width; |
491 |
|
|
|
492 |
|
|
GX_SWAP_VALS(xpos, ypos) |
493 |
|
|
|
494 |
|
|
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90) |
495 |
|
|
{ |
496 |
|
|
ypos = (INT)map -> gx_pixelmap_width - (INT)ypos - (INT)y_height; |
497 |
|
|
} |
498 |
|
|
else |
499 |
|
|
{ |
500 |
|
|
xpos = (INT)map -> gx_pixelmap_height - (INT)xpos - (INT)pixel_width; |
501 |
|
|
} |
502 |
|
|
} |
503 |
|
|
else |
504 |
|
|
{ |
505 |
|
|
pixel_width = glyph -> gx_glyph_width; |
506 |
|
|
y_height = glyph -> gx_glyph_height; |
507 |
|
|
write_stride = (USHORT)map -> gx_pixelmap_width; |
508 |
|
|
} |
509 |
|
|
|
510 |
|
|
read_row = (GX_UBYTE *)glyph -> gx_glyph_map; |
511 |
|
|
write_row = (GX_UBYTE *)map -> gx_pixelmap_data; |
512 |
|
|
write_row += ypos * write_stride; |
513 |
|
|
write_row += xpos; |
514 |
|
|
|
515 |
|
|
byte_width = (pixel_width + 1) / 2; |
516 |
|
|
|
517 |
|
|
|
518 |
|
|
for (row = 0; row < y_height; row++) |
519 |
|
|
{ |
520 |
|
|
read_data = read_row; |
521 |
|
|
write_data = write_row; |
522 |
|
|
|
523 |
|
|
for (col = 0; col < pixel_width; col++) |
524 |
|
|
{ |
525 |
|
|
data = *read_data++; |
526 |
|
|
|
527 |
|
|
*write_data++ = (GX_UBYTE)((data << 4) | (data & 0x0f)); |
528 |
|
|
col++; |
529 |
|
|
|
530 |
|
|
if (col < pixel_width) |
531 |
|
|
{ |
532 |
|
|
*write_data++ = (GX_UBYTE)((data & 0xf0) | (data >> 4)); |
533 |
|
|
} |
534 |
|
|
} |
535 |
|
|
read_row += byte_width; |
536 |
|
|
write_row += write_stride; |
537 |
|
|
} |
538 |
|
|
} |
539 |
|
|
#endif |
540 |
|
|
|
541 |
|
|
/**************************************************************************/ |
542 |
|
|
/* */ |
543 |
|
|
/* FUNCTION RELEASE */ |
544 |
|
|
/* */ |
545 |
|
|
/* _gx_utility_glyph_1bpp_to_alphamap_draw PORTABLE C */ |
546 |
|
|
/* 6.1.3 */ |
547 |
|
|
/* AUTHOR */ |
548 |
|
|
/* */ |
549 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
550 |
|
|
/* */ |
551 |
|
|
/* DESCRIPTION */ |
552 |
|
|
/* */ |
553 |
|
|
/* Internal helper function that renders 1bpp glyph into alpha-map */ |
554 |
|
|
/* memory. */ |
555 |
|
|
/* */ |
556 |
|
|
/* INPUT */ |
557 |
|
|
/* */ |
558 |
|
|
/* map Pixelmap that the glyph is */ |
559 |
|
|
/* drawn to */ |
560 |
|
|
/* xpos X-coord where the glyph is */ |
561 |
|
|
/* drawn to */ |
562 |
|
|
/* ypos Y-coord where the glyph is */ |
563 |
|
|
/* darwn to */ |
564 |
|
|
/* glyph Pointer to glyph structure */ |
565 |
|
|
/* */ |
566 |
|
|
/* OUTPUT */ |
567 |
|
|
/* */ |
568 |
|
|
/* status Completion status */ |
569 |
|
|
/* */ |
570 |
|
|
/* CALLS */ |
571 |
|
|
/* */ |
572 |
|
|
/* None */ |
573 |
|
|
/* */ |
574 |
|
|
/* CALLED BY */ |
575 |
|
|
/* */ |
576 |
|
|
/* GUIX Internal Code */ |
577 |
|
|
/* */ |
578 |
|
|
/**************************************************************************/ |
579 |
|
275 |
VOID _gx_utility_glyph_1bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph) |
580 |
|
|
{ |
581 |
|
|
GX_UBYTE *read_data; |
582 |
|
|
GX_UBYTE *read_row; |
583 |
|
|
GX_UBYTE *write_data; |
584 |
|
|
GX_UBYTE *write_row; |
585 |
|
|
UINT row; |
586 |
|
|
UINT col; |
587 |
|
|
UINT y_height; |
588 |
|
|
GX_UBYTE glyph_width; |
589 |
|
|
GX_UBYTE data; |
590 |
|
275 |
UINT pixel_in_first_byte = 8; |
591 |
|
|
UINT pixel_in_last_byte; |
592 |
|
|
UINT num_bits; |
593 |
|
|
UINT num_bytes; |
594 |
|
|
USHORT write_stride; |
595 |
|
|
GX_UBYTE mask; |
596 |
|
|
|
597 |
✓✓ |
275 |
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270)) |
598 |
|
|
{ |
599 |
|
252 |
write_stride = (USHORT)map -> gx_pixelmap_height; |
600 |
|
252 |
y_height = glyph -> gx_glyph_width; |
601 |
|
252 |
glyph_width = (USHORT)glyph -> gx_glyph_height; |
602 |
|
252 |
GX_SWAP_VALS(xpos, ypos) |
603 |
|
|
|
604 |
✓✓ |
252 |
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90) |
605 |
|
|
{ |
606 |
|
140 |
ypos = (map -> gx_pixelmap_width - ypos - glyph -> gx_glyph_width); |
607 |
|
|
} |
608 |
|
|
else |
609 |
|
|
{ |
610 |
|
112 |
xpos = (map -> gx_pixelmap_height - xpos - glyph -> gx_glyph_height); |
611 |
|
|
} |
612 |
|
|
} |
613 |
|
|
else |
614 |
|
|
{ |
615 |
|
23 |
write_stride = (USHORT)map -> gx_pixelmap_width; |
616 |
|
23 |
y_height = glyph -> gx_glyph_height; |
617 |
|
23 |
glyph_width = glyph -> gx_glyph_width; |
618 |
|
|
} |
619 |
|
|
|
620 |
|
275 |
pixel_in_last_byte = ((UINT)glyph_width) & 0x7; |
621 |
✓✓ |
275 |
if (pixel_in_last_byte == 0) |
622 |
|
|
{ |
623 |
|
2 |
pixel_in_last_byte = 8; |
624 |
|
|
} |
625 |
|
|
|
626 |
|
275 |
num_bytes = (((UINT)glyph_width) + 7) >> 3; |
627 |
|
|
|
628 |
✓✓ |
275 |
if (num_bytes == 1) |
629 |
|
|
{ |
630 |
|
9 |
pixel_in_first_byte = pixel_in_last_byte; |
631 |
|
|
} |
632 |
|
|
|
633 |
|
275 |
read_row = (GX_UBYTE *)glyph -> gx_glyph_map; |
634 |
|
|
|
635 |
|
275 |
write_row = (GX_UBYTE *)map -> gx_pixelmap_data; |
636 |
|
275 |
write_row += ypos * write_stride; |
637 |
|
275 |
write_row += xpos; |
638 |
|
|
|
639 |
✓✓ |
3951 |
for (row = 0; row < y_height; row++) |
640 |
|
|
{ |
641 |
|
3676 |
read_data = read_row; |
642 |
|
3676 |
write_data = write_row; |
643 |
|
3676 |
num_bits = pixel_in_first_byte; |
644 |
|
|
|
645 |
✓✓ |
14344 |
for (col = 0; col < num_bytes; col++) |
646 |
|
|
{ |
647 |
|
10668 |
data = *read_data++; |
648 |
|
10668 |
mask = 0x80; |
649 |
|
|
|
650 |
✓✓✓✓
|
10668 |
if ((col == (num_bytes - 1)) && (num_bytes > 1)) |
651 |
|
|
{ |
652 |
|
3608 |
num_bits = pixel_in_last_byte; |
653 |
|
|
} |
654 |
|
|
|
655 |
✓✓✓✓ ✓✓✓✓
|
10668 |
switch (num_bits) |
656 |
|
|
{ |
657 |
|
7024 |
case 8: |
658 |
✓✓ |
7024 |
DRAW_PIXEL; |
659 |
|
|
/* fallthrough */ |
660 |
|
7031 |
case 7: |
661 |
✓✓ |
7031 |
DRAW_PIXEL; |
662 |
|
|
/* fallthrough */ |
663 |
|
7055 |
case 6: |
664 |
✓✓ |
7055 |
DRAW_PIXEL; |
665 |
|
|
/* fallthrough */ |
666 |
|
7159 |
case 5: |
667 |
✓✓ |
7159 |
DRAW_PIXEL; |
668 |
|
|
/* fallthrough */ |
669 |
|
10567 |
case 4: |
670 |
✓✓ |
10567 |
DRAW_PIXEL; |
671 |
|
|
/* fallthrough */ |
672 |
|
10585 |
case 3: |
673 |
✓✓ |
10585 |
DRAW_PIXEL; |
674 |
|
|
/* fallthrough */ |
675 |
|
10592 |
case 2: |
676 |
✓✓ |
10592 |
DRAW_PIXEL; |
677 |
|
|
/* fallthrough */ |
678 |
|
10668 |
default: |
679 |
✓✓ |
10668 |
if (data & mask) |
680 |
|
|
{ |
681 |
|
4411 |
*write_data = 0xff; |
682 |
|
|
} |
683 |
|
10668 |
write_data++; |
684 |
|
10668 |
break; |
685 |
|
|
} |
686 |
|
|
} |
687 |
|
|
|
688 |
|
3676 |
read_row += num_bytes; |
689 |
|
3676 |
write_row += write_stride; |
690 |
|
|
} |
691 |
|
275 |
} |
692 |
|
|
|
693 |
|
|
/**************************************************************************/ |
694 |
|
|
/* */ |
695 |
|
|
/* FUNCTION RELEASE */ |
696 |
|
|
/* */ |
697 |
|
|
/* _gx_utility_glyph_reversed_1bpp_to_alphamap_draw PORTABLE C */ |
698 |
|
|
/* 6.1.3 */ |
699 |
|
|
/* AUTHOR */ |
700 |
|
|
/* */ |
701 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
702 |
|
|
/* */ |
703 |
|
|
/* DESCRIPTION */ |
704 |
|
|
/* */ |
705 |
|
|
/* Internal helper function that renders 1bpp reveresed bit order */ |
706 |
|
|
/* glyph into alpha-map memory. */ |
707 |
|
|
/* */ |
708 |
|
|
/* INPUT */ |
709 |
|
|
/* */ |
710 |
|
|
/* map Pixelmap that the glyph is */ |
711 |
|
|
/* drawn to */ |
712 |
|
|
/* xpos X-coord where the glyph is */ |
713 |
|
|
/* drawn to */ |
714 |
|
|
/* ypos Y-coord where the glyph is */ |
715 |
|
|
/* darwn to */ |
716 |
|
|
/* glyph Pointer to glyph structure */ |
717 |
|
|
/* */ |
718 |
|
|
/* OUTPUT */ |
719 |
|
|
/* */ |
720 |
|
|
/* status Completion status */ |
721 |
|
|
/* */ |
722 |
|
|
/* CALLS */ |
723 |
|
|
/* */ |
724 |
|
|
/* None */ |
725 |
|
|
/* */ |
726 |
|
|
/* CALLED BY */ |
727 |
|
|
/* */ |
728 |
|
|
/* GUIX Internal Code */ |
729 |
|
|
/* */ |
730 |
|
|
/**************************************************************************/ |
731 |
|
|
#if defined(GX_RENESAS_DAVE2D_FONT_SUPPORT) |
732 |
|
|
VOID _gx_utility_glyph_reversed_1bpp_to_alphamap_draw(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph) |
733 |
|
|
{ |
734 |
|
|
GX_UBYTE *read_data; |
735 |
|
|
GX_UBYTE *read_row; |
736 |
|
|
GX_UBYTE *write_data; |
737 |
|
|
GX_UBYTE *write_row; |
738 |
|
|
UINT row; |
739 |
|
|
UINT col; |
740 |
|
|
UINT y_height; |
741 |
|
|
GX_UBYTE glyph_width; |
742 |
|
|
GX_UBYTE data; |
743 |
|
|
UINT pixel_in_first_byte = 8; |
744 |
|
|
UINT pixel_in_last_byte; |
745 |
|
|
UINT num_bits; |
746 |
|
|
UINT num_bytes; |
747 |
|
|
USHORT write_stride; |
748 |
|
|
GX_UBYTE mask; |
749 |
|
|
|
750 |
|
|
if (map -> gx_pixelmap_flags & (GX_PIXELMAP_ROTATED_90 | GX_PIXELMAP_ROTATED_270)) |
751 |
|
|
{ |
752 |
|
|
write_stride = (USHORT)map -> gx_pixelmap_height; |
753 |
|
|
y_height = glyph -> gx_glyph_width; |
754 |
|
|
glyph_width = glyph -> gx_glyph_height; |
755 |
|
|
GX_SWAP_VALS(xpos, ypos) |
756 |
|
|
|
757 |
|
|
if (map -> gx_pixelmap_flags & GX_PIXELMAP_ROTATED_90) |
758 |
|
|
{ |
759 |
|
|
ypos = (map -> gx_pixelmap_width - ypos - glyph -> gx_glyph_width); |
760 |
|
|
} |
761 |
|
|
else |
762 |
|
|
{ |
763 |
|
|
xpos = (map -> gx_pixelmap_height - xpos - glyph -> gx_glyph_height); |
764 |
|
|
} |
765 |
|
|
} |
766 |
|
|
else |
767 |
|
|
{ |
768 |
|
|
write_stride = (USHORT)map -> gx_pixelmap_width; |
769 |
|
|
y_height = glyph -> gx_glyph_height; |
770 |
|
|
glyph_width = glyph -> gx_glyph_width; |
771 |
|
|
} |
772 |
|
|
|
773 |
|
|
pixel_in_last_byte = ((UINT)glyph_width) & 0x7; |
774 |
|
|
if (pixel_in_last_byte == 0) |
775 |
|
|
{ |
776 |
|
|
pixel_in_last_byte = 8; |
777 |
|
|
} |
778 |
|
|
|
779 |
|
|
num_bytes = (((UINT)glyph_width) + 7) >> 3; |
780 |
|
|
|
781 |
|
|
if (num_bytes == 1) |
782 |
|
|
{ |
783 |
|
|
pixel_in_first_byte = pixel_in_last_byte; |
784 |
|
|
} |
785 |
|
|
|
786 |
|
|
read_row = (GX_UBYTE *)glyph -> gx_glyph_map; |
787 |
|
|
|
788 |
|
|
write_row = (GX_UBYTE *)map -> gx_pixelmap_data; |
789 |
|
|
write_row += ypos * write_stride; |
790 |
|
|
write_row += xpos; |
791 |
|
|
|
792 |
|
|
for (row = 0; row < y_height; row++) |
793 |
|
|
{ |
794 |
|
|
read_data = read_row; |
795 |
|
|
write_data = write_row; |
796 |
|
|
num_bits = pixel_in_first_byte; |
797 |
|
|
|
798 |
|
|
for (col = 0; col < num_bytes; col++) |
799 |
|
|
{ |
800 |
|
|
data = *read_data++; |
801 |
|
|
mask = 0x01; |
802 |
|
|
|
803 |
|
|
if ((col == (num_bytes - 1)) && (num_bytes > 1)) |
804 |
|
|
{ |
805 |
|
|
num_bits = pixel_in_last_byte; |
806 |
|
|
} |
807 |
|
|
|
808 |
|
|
switch (num_bits) |
809 |
|
|
{ |
810 |
|
|
case 8: |
811 |
|
|
DRAW_REVERSED_PIXEL; |
812 |
|
|
/* fallthrough */ |
813 |
|
|
case 7: |
814 |
|
|
DRAW_REVERSED_PIXEL; |
815 |
|
|
/* fallthrough */ |
816 |
|
|
case 6: |
817 |
|
|
DRAW_REVERSED_PIXEL; |
818 |
|
|
/* fallthrough */ |
819 |
|
|
case 5: |
820 |
|
|
DRAW_REVERSED_PIXEL; |
821 |
|
|
/* fallthrough */ |
822 |
|
|
case 4: |
823 |
|
|
DRAW_REVERSED_PIXEL; |
824 |
|
|
/* fallthrough */ |
825 |
|
|
case 3: |
826 |
|
|
DRAW_REVERSED_PIXEL; |
827 |
|
|
/* fallthrough */ |
828 |
|
|
case 2: |
829 |
|
|
DRAW_REVERSED_PIXEL; |
830 |
|
|
/* fallthrough */ |
831 |
|
|
default: |
832 |
|
|
if (data & mask) |
833 |
|
|
{ |
834 |
|
|
*write_data = 0xff; |
835 |
|
|
} |
836 |
|
|
write_data++; |
837 |
|
|
break; |
838 |
|
|
} |
839 |
|
|
} |
840 |
|
|
|
841 |
|
|
read_row += num_bytes; |
842 |
|
|
write_row += write_stride; |
843 |
|
|
} |
844 |
|
|
} |
845 |
|
|
#endif |
846 |
|
|
|
847 |
|
|
/**************************************************************************/ |
848 |
|
|
/* */ |
849 |
|
|
/* FUNCTION RELEASE */ |
850 |
|
|
/* */ |
851 |
|
|
/* _gx_utility_string_to_alphamap_draw PORTABLE C */ |
852 |
|
|
/* 6.1.3 */ |
853 |
|
|
/* AUTHOR */ |
854 |
|
|
/* */ |
855 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
856 |
|
|
/* */ |
857 |
|
|
/* DESCRIPTION */ |
858 |
|
|
/* */ |
859 |
|
|
/* Internal helper function that renders entire string to alpha-map */ |
860 |
|
|
/* memory. */ |
861 |
|
|
/* */ |
862 |
|
|
/* INPUT */ |
863 |
|
|
/* */ |
864 |
|
|
/* text Pointer to string */ |
865 |
|
|
/* font Font for text drawing */ |
866 |
|
|
/* map Pointer to pixemap structure */ |
867 |
|
|
/* */ |
868 |
|
|
/* OUTPUT */ |
869 |
|
|
/* */ |
870 |
|
|
/* status Completion status */ |
871 |
|
|
/* */ |
872 |
|
|
/* CALLS */ |
873 |
|
|
/* */ |
874 |
|
|
/* _gx_utility_glyph_8bpp_to_alphamap_draw */ |
875 |
|
|
/* Render 8bpp glyph to alphamap */ |
876 |
|
|
/* _gx_utility_glyph_4bpp_to_alphamap_draw */ |
877 |
|
|
/* Render 4bpp glyph to alphamap */ |
878 |
|
|
/* _gx_utility_glyph_1bpp_to_alphamap_draw */ |
879 |
|
|
/* Render 1bpp glyph to alphamap */ |
880 |
|
|
/* _gx_utility_utf8_string_character_get Parse utf8 string to */ |
881 |
|
|
/* to multibyte glyph */ |
882 |
|
|
/* _gx_utility_string_length_check Test string length */ |
883 |
|
|
/* */ |
884 |
|
|
/* CALLED BY */ |
885 |
|
|
/* */ |
886 |
|
|
/* GUIX Internal Code */ |
887 |
|
|
/* */ |
888 |
|
|
/**************************************************************************/ |
889 |
|
4259 |
VOID _gx_utility_string_to_alphamap_draw(GX_CONST GX_STRING *string, GX_CONST GX_FONT *font, GX_PIXELMAP *map) |
890 |
|
|
{ |
891 |
|
|
INT xpos; |
892 |
|
|
int y_offset; |
893 |
|
|
GX_CONST GX_GLYPH *glyph; |
894 |
|
|
GX_CONST GX_FONT *font_page; |
895 |
|
|
GX_CHAR_CODE glyph_index; |
896 |
|
|
GX_CHAR_CODE char_val; |
897 |
|
4259 |
GX_BOOL first_char = GX_TRUE; |
898 |
|
|
INT leading; |
899 |
|
|
GX_STRING string_copy; |
900 |
|
|
VOID (*glyph_draw)(GX_PIXELMAP *map, INT xpos, INT ypos, GX_CONST GX_GLYPH *glyph); |
901 |
|
|
|
902 |
|
|
#ifdef GX_UTF8_SUPPORT |
903 |
|
|
UINT glyph_len; |
904 |
|
|
#endif /* GX_UTF8_SUPPORT */ |
905 |
|
|
|
906 |
|
|
#if defined(GX_RENESAS_DAVE2D_FONT_SUPPORT) |
907 |
|
|
if (font -> gx_font_format & GX_FONT_FORMAT_COMPRESSED) |
908 |
|
|
{ |
909 |
|
|
/* Not supported. */ |
910 |
|
|
return; |
911 |
|
|
} |
912 |
|
|
#endif |
913 |
|
|
|
914 |
|
4259 |
xpos = 0; |
915 |
|
4259 |
string_copy = *string; |
916 |
|
|
|
917 |
✓✓ |
4259 |
if (font -> gx_font_format & GX_FONT_FORMAT_ROTATED_90) |
918 |
|
|
{ |
919 |
|
120 |
map -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_90; |
920 |
|
|
} |
921 |
✓✓ |
4139 |
else if (font -> gx_font_format & GX_FONT_FORMAT_ROTATED_270) |
922 |
|
|
{ |
923 |
|
96 |
map -> gx_pixelmap_flags |= GX_PIXELMAP_ROTATED_270; |
924 |
|
|
} |
925 |
|
|
|
926 |
✓✓✓✓
|
4259 |
switch (font -> gx_font_format & GX_FONT_FORMAT_BPP_MASK) |
927 |
|
|
{ |
928 |
|
3765 |
case GX_FONT_FORMAT_8BPP: |
929 |
|
3765 |
glyph_draw = _gx_utility_glyph_8bpp_to_alphamap_draw; |
930 |
|
3765 |
break; |
931 |
|
|
|
932 |
|
427 |
case GX_FONT_FORMAT_4BPP: |
933 |
|
|
#if defined(GX_RENESAS_DAVE2D_FONT_SUPPORT) |
934 |
|
|
if (font -> gx_font_format & GX_FONT_FORMAT_REVERSED_ORDER) |
935 |
|
|
{ |
936 |
|
|
glyph_draw = _gx_utility_glyph_reversed_4bpp_to_alphamap_draw; |
937 |
|
|
} |
938 |
|
|
else |
939 |
|
|
{ |
940 |
|
|
#endif |
941 |
|
427 |
glyph_draw = _gx_utility_glyph_4bpp_to_alphamap_draw; |
942 |
|
|
#if defined(GX_RENESAS_DAVE2D_FONT_SUPPORT) |
943 |
|
|
} |
944 |
|
|
#endif |
945 |
|
427 |
break; |
946 |
|
|
|
947 |
|
66 |
case GX_FONT_FORMAT_1BPP: |
948 |
|
|
#if defined(GX_RENESAS_DAVE2D_FONT_SUPPORT) |
949 |
|
|
if (font -> gx_font_format & GX_FONT_FORMAT_REVERSED_ORDER) |
950 |
|
|
{ |
951 |
|
|
glyph_draw = _gx_utility_glyph_reversed_1bpp_to_alphamap_draw; |
952 |
|
|
} |
953 |
|
|
else |
954 |
|
|
{ |
955 |
|
|
#endif |
956 |
|
66 |
glyph_draw = _gx_utility_glyph_1bpp_to_alphamap_draw; |
957 |
|
|
#if defined(GX_RENESAS_DAVE2D_FONT_SUPPORT) |
958 |
|
|
} |
959 |
|
|
#endif |
960 |
|
66 |
break; |
961 |
|
|
|
962 |
|
1 |
default: |
963 |
|
1 |
glyph_draw = GX_NULL; |
964 |
|
1 |
break; |
965 |
|
|
} |
966 |
|
|
|
967 |
✓✓ |
4259 |
if (glyph_draw == GX_NULL) |
968 |
|
|
{ |
969 |
|
1 |
return; |
970 |
|
|
} |
971 |
|
|
|
972 |
✓✓ |
25775 |
while (string_copy.gx_string_length) |
973 |
|
|
{ |
974 |
|
|
#ifdef GX_UTF8_SUPPORT |
975 |
|
17260 |
_gx_utility_utf8_string_character_get(&string_copy, &char_val, &glyph_len); |
976 |
|
|
#else |
977 |
|
|
char_val = (GX_CHAR_CODE)(*string_copy.gx_string_ptr); |
978 |
|
|
string_copy.gx_string_ptr++; |
979 |
|
|
string_copy.gx_string_length--; |
980 |
|
|
#endif /* GX_UTF8_SUPPORT */ |
981 |
|
|
|
982 |
✓✓ |
17260 |
if (!char_val) |
983 |
|
|
{ |
984 |
|
1 |
break; |
985 |
|
|
} |
986 |
|
|
|
987 |
|
17259 |
font_page = font; |
988 |
|
|
|
989 |
✓✓ |
17282 |
while (font_page) |
990 |
|
|
{ |
991 |
✓✓ |
17281 |
if (font_page -> gx_font_first_glyph <= char_val && |
992 |
✓✓ |
17271 |
font_page -> gx_font_last_glyph >= char_val) |
993 |
|
|
{ |
994 |
|
17258 |
break; |
995 |
|
|
} |
996 |
|
23 |
font_page = font_page -> gx_font_next_page; |
997 |
|
|
} |
998 |
✓✓ |
17259 |
if (font_page) |
999 |
|
|
{ |
1000 |
|
17258 |
glyph_index = (GX_CHAR_CODE)(char_val - font_page -> gx_font_first_glyph); |
1001 |
|
17258 |
glyph = &font_page -> gx_font_glyphs.gx_font_normal_glyphs[glyph_index]; |
1002 |
|
17258 |
y_offset = font_page -> gx_font_baseline - glyph -> gx_glyph_ascent; |
1003 |
|
|
|
1004 |
|
17258 |
leading = glyph -> gx_glyph_leading; |
1005 |
✓✓ |
17258 |
if (first_char) |
1006 |
|
|
{ |
1007 |
|
4258 |
first_char = GX_FALSE; |
1008 |
|
|
|
1009 |
|
4258 |
leading = 0; |
1010 |
|
|
} |
1011 |
|
17258 |
glyph_draw(map, xpos + leading, y_offset, glyph); |
1012 |
|
17258 |
xpos += glyph -> gx_glyph_advance; |
1013 |
|
|
} |
1014 |
|
|
} |
1015 |
|
|
} |
1016 |
|
|
|