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 |
|
|
/** Binres Loader Management (Binres Loader) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_binres_loader.h" |
28 |
|
|
#include "gx_system.h" |
29 |
|
|
#include "gx_utility.h" |
30 |
|
|
|
31 |
|
|
extern GX_CONST GX_FONT _gx_system_font_mono; |
32 |
|
|
extern GX_CONST GX_FONT _gx_system_font_4bpp; |
33 |
|
|
extern GX_CONST GX_FONT _gx_system_font_8bpp; |
34 |
|
|
|
35 |
|
|
/**************************************************************************/ |
36 |
|
|
/* */ |
37 |
|
|
/* FUNCTION RELEASE */ |
38 |
|
|
/* */ |
39 |
|
|
/* _gx_binres_theme_header_load PORTABLE C */ |
40 |
|
|
/* 6.1 */ |
41 |
|
|
/* AUTHOR */ |
42 |
|
|
/* */ |
43 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
44 |
|
|
/* */ |
45 |
|
|
/* DESCRIPTION */ |
46 |
|
|
/* */ |
47 |
|
|
/* This function reads theme header from a binary data buffer. */ |
48 |
|
|
/* */ |
49 |
|
|
/* INPUT */ |
50 |
|
|
/* */ |
51 |
|
|
/* info Binary read control block */ |
52 |
|
|
/* header Returned theme header */ |
53 |
|
|
/* */ |
54 |
|
|
/* OUTPUT */ |
55 |
|
|
/* */ |
56 |
|
|
/* Status Completion status */ |
57 |
|
|
/* */ |
58 |
|
|
/* CALLS */ |
59 |
|
|
/* */ |
60 |
|
|
/* None */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLED BY */ |
63 |
|
|
/* */ |
64 |
|
|
/* GUIX Internal Code */ |
65 |
|
|
/* */ |
66 |
|
|
/* RELEASE HISTORY */ |
67 |
|
|
/* */ |
68 |
|
|
/* DATE NAME DESCRIPTION */ |
69 |
|
|
/* */ |
70 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
71 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
72 |
|
|
/* removed use of memcpy, */ |
73 |
|
|
/* resulting in version 6.1 */ |
74 |
|
|
/* */ |
75 |
|
|
/**************************************************************************/ |
76 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
77 |
|
|
|
78 |
|
126 |
static UINT _gx_binres_theme_header_load(GX_BINRES_DATA_INFO *info, GX_THEME_HEADER *header) |
79 |
|
|
{ |
80 |
|
126 |
GX_BINRES_READ_USHORT(header -> gx_theme_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
81 |
|
126 |
info -> gx_binres_read_offset += sizeof(USHORT); |
82 |
|
|
|
83 |
|
126 |
GX_BINRES_READ_USHORT(header -> gx_theme_header_index, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
84 |
|
126 |
info -> gx_binres_read_offset += sizeof(USHORT); |
85 |
|
|
|
86 |
|
126 |
GX_BINRES_READ_USHORT(header -> gx_theme_header_color_count, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
87 |
|
126 |
info -> gx_binres_read_offset += sizeof(USHORT); |
88 |
|
|
|
89 |
|
126 |
GX_BINRES_READ_USHORT(header -> gx_theme_header_palette_count, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
90 |
|
126 |
info -> gx_binres_read_offset += sizeof(USHORT); |
91 |
|
|
|
92 |
|
126 |
GX_BINRES_READ_USHORT(header -> gx_theme_header_font_count, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
93 |
|
126 |
info -> gx_binres_read_offset += sizeof(USHORT); |
94 |
|
|
|
95 |
|
126 |
GX_BINRES_READ_USHORT(header -> gx_theme_header_pixelmap_count, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
96 |
|
126 |
info -> gx_binres_read_offset += sizeof(USHORT); |
97 |
|
|
|
98 |
|
126 |
GX_BINRES_READ_GX_VALUE(header -> gx_theme_header_vscroll_appearance.gx_scroll_width, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
99 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_VALUE); |
100 |
|
|
|
101 |
|
126 |
GX_BINRES_READ_GX_VALUE(header -> gx_theme_header_vscroll_appearance.gx_scroll_thumb_width, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
102 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_VALUE); |
103 |
|
|
|
104 |
|
126 |
GX_BINRES_READ_GX_VALUE(header -> gx_theme_header_vscroll_appearance.gx_scroll_thumb_travel_min, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
105 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_VALUE); |
106 |
|
|
|
107 |
|
126 |
GX_BINRES_READ_GX_VALUE(header -> gx_theme_header_vscroll_appearance.gx_scroll_thumb_travel_max, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
108 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_VALUE); |
109 |
|
|
|
110 |
|
126 |
GX_BINRES_READ_GX_UBYTE(header -> gx_theme_header_vscroll_appearance.gx_scroll_thumb_border_style, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
111 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
112 |
|
|
|
113 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_vscroll_appearance.gx_scroll_fill_pixelmap, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
114 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
115 |
|
|
|
116 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_vscroll_appearance.gx_scroll_thumb_pixelmap, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
117 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
118 |
|
|
|
119 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_vscroll_appearance.gx_scroll_up_pixelmap, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
120 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
121 |
|
|
|
122 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_vscroll_appearance.gx_scroll_down_pixelmap, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
123 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
124 |
|
|
|
125 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_vscroll_appearance.gx_scroll_thumb_color, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
126 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
127 |
|
|
|
128 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_vscroll_appearance.gx_scroll_thumb_border_color, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
129 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
130 |
|
|
|
131 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_vscroll_appearance.gx_scroll_button_color, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
132 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
133 |
|
|
|
134 |
|
126 |
GX_BINRES_READ_GX_VALUE(header -> gx_theme_header_hscroll_appearance.gx_scroll_width, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
135 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_VALUE); |
136 |
|
|
|
137 |
|
126 |
GX_BINRES_READ_GX_VALUE(header -> gx_theme_header_hscroll_appearance.gx_scroll_thumb_width, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
138 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_VALUE); |
139 |
|
|
|
140 |
|
126 |
GX_BINRES_READ_GX_VALUE(header -> gx_theme_header_hscroll_appearance.gx_scroll_thumb_travel_min, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
141 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_VALUE); |
142 |
|
|
|
143 |
|
126 |
GX_BINRES_READ_GX_VALUE(header -> gx_theme_header_hscroll_appearance.gx_scroll_thumb_travel_max, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
144 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_VALUE); |
145 |
|
|
|
146 |
|
126 |
GX_BINRES_READ_GX_UBYTE(header -> gx_theme_header_hscroll_appearance.gx_scroll_thumb_border_style, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
147 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
148 |
|
|
|
149 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_hscroll_appearance.gx_scroll_fill_pixelmap, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
150 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
151 |
|
|
|
152 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_hscroll_appearance.gx_scroll_thumb_pixelmap, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
153 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
154 |
|
|
|
155 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_hscroll_appearance.gx_scroll_up_pixelmap, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
156 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
157 |
|
|
|
158 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_hscroll_appearance.gx_scroll_down_pixelmap, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
159 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
160 |
|
|
|
161 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_hscroll_appearance.gx_scroll_thumb_color, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
162 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
163 |
|
|
|
164 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_hscroll_appearance.gx_scroll_thumb_border_color, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
165 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
166 |
|
|
|
167 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_hscroll_appearance.gx_scroll_button_color, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
168 |
|
126 |
info -> gx_binres_read_offset += sizeof(GX_RESOURCE_ID); |
169 |
|
|
|
170 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_vscroll_style, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
171 |
|
126 |
info -> gx_binres_read_offset += sizeof(ULONG); |
172 |
|
|
|
173 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_hscroll_style, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
174 |
|
126 |
info -> gx_binres_read_offset += sizeof(ULONG); |
175 |
|
|
|
176 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_color_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
177 |
|
126 |
info -> gx_binres_read_offset += sizeof(ULONG); |
178 |
|
|
|
179 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_palette_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
180 |
|
126 |
info -> gx_binres_read_offset += sizeof(ULONG); |
181 |
|
|
|
182 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_font_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
183 |
|
126 |
info -> gx_binres_read_offset += sizeof(ULONG); |
184 |
|
|
|
185 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_pixelmap_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
186 |
|
126 |
info -> gx_binres_read_offset += sizeof(ULONG); |
187 |
|
|
|
188 |
|
126 |
GX_BINRES_READ_ULONG(header -> gx_theme_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
189 |
|
126 |
info -> gx_binres_read_offset += sizeof(ULONG); |
190 |
|
|
|
191 |
|
126 |
return GX_SUCCESS; |
192 |
|
|
} |
193 |
|
|
#endif |
194 |
|
|
|
195 |
|
|
/**************************************************************************/ |
196 |
|
|
/* */ |
197 |
|
|
/* FUNCTION RELEASE */ |
198 |
|
|
/* */ |
199 |
|
|
/* _gx_binres_color_header_load PORTABLE C */ |
200 |
|
|
/* 6.1 */ |
201 |
|
|
/* AUTHOR */ |
202 |
|
|
/* */ |
203 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
204 |
|
|
/* */ |
205 |
|
|
/* DESCRIPTION */ |
206 |
|
|
/* */ |
207 |
|
|
/* This function reads color header from a binary data buffer. */ |
208 |
|
|
/* */ |
209 |
|
|
/* INPUT */ |
210 |
|
|
/* */ |
211 |
|
|
/* info Binary read control block */ |
212 |
|
|
/* header Returned color header */ |
213 |
|
|
/* */ |
214 |
|
|
/* OUTPUT */ |
215 |
|
|
/* */ |
216 |
|
|
/* Status Completion status */ |
217 |
|
|
/* */ |
218 |
|
|
/* CALLS */ |
219 |
|
|
/* */ |
220 |
|
|
/* None */ |
221 |
|
|
/* */ |
222 |
|
|
/* CALLED BY */ |
223 |
|
|
/* */ |
224 |
|
|
/* GUIX Internal Code */ |
225 |
|
|
/* */ |
226 |
|
|
/* RELEASE HISTORY */ |
227 |
|
|
/* */ |
228 |
|
|
/* DATE NAME DESCRIPTION */ |
229 |
|
|
/* */ |
230 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
231 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
232 |
|
|
/* removed use of memcpy, */ |
233 |
|
|
/* resulting in version 6.1 */ |
234 |
|
|
/* */ |
235 |
|
|
/**************************************************************************/ |
236 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
237 |
|
33 |
static UINT _gx_binres_color_header_load(GX_BINRES_DATA_INFO *info, GX_COLOR_HEADER *header) |
238 |
|
|
{ |
239 |
|
33 |
GX_BINRES_READ_USHORT(header -> gx_color_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
240 |
|
33 |
info -> gx_binres_read_offset += sizeof(USHORT); |
241 |
|
|
|
242 |
|
33 |
GX_BINRES_READ_USHORT(header -> gx_color_header_color_count, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
243 |
|
33 |
info -> gx_binres_read_offset += sizeof(USHORT); |
244 |
|
|
|
245 |
|
33 |
GX_BINRES_READ_ULONG(header -> gx_color_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
246 |
|
33 |
info -> gx_binres_read_offset += sizeof(ULONG); |
247 |
|
|
|
248 |
|
33 |
return GX_SUCCESS; |
249 |
|
|
} |
250 |
|
|
#endif |
251 |
|
|
|
252 |
|
|
/**************************************************************************/ |
253 |
|
|
/* */ |
254 |
|
|
/* FUNCTION RELEASE */ |
255 |
|
|
/* */ |
256 |
|
|
/* _gx_binres_palette_header_load PORTABLE C */ |
257 |
|
|
/* 6.1 */ |
258 |
|
|
/* AUTHOR */ |
259 |
|
|
/* */ |
260 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
261 |
|
|
/* */ |
262 |
|
|
/* DESCRIPTION */ |
263 |
|
|
/* */ |
264 |
|
|
/* This function reads palette header from a binary data buffer. */ |
265 |
|
|
/* */ |
266 |
|
|
/* INPUT */ |
267 |
|
|
/* */ |
268 |
|
|
/* info Binary read control block */ |
269 |
|
|
/* header Returned palette header */ |
270 |
|
|
/* */ |
271 |
|
|
/* OUTPUT */ |
272 |
|
|
/* */ |
273 |
|
|
/* Status Completion status */ |
274 |
|
|
/* */ |
275 |
|
|
/* CALLS */ |
276 |
|
|
/* */ |
277 |
|
|
/* None */ |
278 |
|
|
/* */ |
279 |
|
|
/* CALLED BY */ |
280 |
|
|
/* */ |
281 |
|
|
/* GUIX Internal Code */ |
282 |
|
|
/* */ |
283 |
|
|
/* RELEASE HISTORY */ |
284 |
|
|
/* */ |
285 |
|
|
/* DATE NAME DESCRIPTION */ |
286 |
|
|
/* */ |
287 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
288 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
289 |
|
|
/* removed use of memcpy, */ |
290 |
|
|
/* resulting in version 6.1 */ |
291 |
|
|
/* */ |
292 |
|
|
/**************************************************************************/ |
293 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
294 |
|
10 |
static UINT _gx_binres_palette_header_load(GX_BINRES_DATA_INFO *info, GX_PALETTE_HEADER *header) |
295 |
|
|
{ |
296 |
|
10 |
GX_BINRES_READ_USHORT(header -> gx_palette_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
297 |
|
10 |
info -> gx_binres_read_offset += sizeof(USHORT); |
298 |
|
|
|
299 |
|
10 |
GX_BINRES_READ_USHORT(header -> gx_palette_header_color_count, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
300 |
|
10 |
info -> gx_binres_read_offset += sizeof(USHORT); |
301 |
|
|
|
302 |
|
10 |
GX_BINRES_READ_ULONG(header -> gx_palette_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
303 |
|
10 |
info -> gx_binres_read_offset += sizeof(ULONG); |
304 |
|
|
|
305 |
|
10 |
return GX_SUCCESS; |
306 |
|
|
} |
307 |
|
|
#endif |
308 |
|
|
|
309 |
|
|
/**************************************************************************/ |
310 |
|
|
/* */ |
311 |
|
|
/* FUNCTION RELEASE */ |
312 |
|
|
/* */ |
313 |
|
|
/* _gx_binres_font_header_load PORTABLE C */ |
314 |
|
|
/* 6.3.0 */ |
315 |
|
|
/* AUTHOR */ |
316 |
|
|
/* */ |
317 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
318 |
|
|
/* */ |
319 |
|
|
/* DESCRIPTION */ |
320 |
|
|
/* */ |
321 |
|
|
/* This function reads font header from a binary data buffer. */ |
322 |
|
|
/* */ |
323 |
|
|
/* INPUT */ |
324 |
|
|
/* */ |
325 |
|
|
/* info Binary read control block */ |
326 |
|
|
/* header Returned font header */ |
327 |
|
|
/* */ |
328 |
|
|
/* OUTPUT */ |
329 |
|
|
/* */ |
330 |
|
|
/* Status Completion status */ |
331 |
|
|
/* */ |
332 |
|
|
/* CALLS */ |
333 |
|
|
/* */ |
334 |
|
|
/* None */ |
335 |
|
|
/* */ |
336 |
|
|
/* CALLED BY */ |
337 |
|
|
/* */ |
338 |
|
|
/* GUIX Internal Code */ |
339 |
|
|
/* */ |
340 |
|
|
/* RELEASE HISTORY */ |
341 |
|
|
/* */ |
342 |
|
|
/* DATE NAME DESCRIPTION */ |
343 |
|
|
/* */ |
344 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
345 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
346 |
|
|
/* removed use of memcpy, */ |
347 |
|
|
/* resulting in version 6.1 */ |
348 |
|
|
/* 10-31-2023 Ting Zhu Modified comment(s), */ |
349 |
|
|
/* made the function public, */ |
350 |
|
|
/* resulting in version 6.3.0 */ |
351 |
|
|
/* */ |
352 |
|
|
/**************************************************************************/ |
353 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
354 |
|
1921 |
UINT _gx_binres_font_header_load(GX_BINRES_DATA_INFO *info, GX_FONT_HEADER *header) |
355 |
|
|
{ |
356 |
|
1921 |
GX_BINRES_READ_USHORT(header -> gx_font_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
357 |
|
1921 |
info -> gx_binres_read_offset += sizeof(USHORT); |
358 |
|
|
|
359 |
✓✓ |
1921 |
if(header -> gx_font_header_magic_number != GX_MAGIC_NUMBER) |
360 |
|
|
{ |
361 |
|
5 |
return GX_INVALID_FORMAT; |
362 |
|
|
} |
363 |
|
|
|
364 |
|
1916 |
GX_BINRES_READ_USHORT(header -> gx_font_header_index, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
365 |
|
1916 |
info -> gx_binres_read_offset += sizeof(USHORT); |
366 |
|
|
|
367 |
|
1916 |
GX_BINRES_READ_USHORT(header -> gx_font_header_page_count, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
368 |
|
1916 |
info -> gx_binres_read_offset += sizeof(USHORT); |
369 |
|
|
|
370 |
|
1916 |
GX_BINRES_READ_GX_UBYTE(header -> gx_font_header_deault, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
371 |
|
1916 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
372 |
|
|
|
373 |
|
1916 |
GX_BINRES_READ_GX_UBYTE(header -> gx_font_header_bits, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
374 |
|
1916 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
375 |
|
|
|
376 |
|
1916 |
GX_BINRES_READ_ULONG(header -> gx_font_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
377 |
|
1916 |
info -> gx_binres_read_offset += sizeof(ULONG); |
378 |
|
|
|
379 |
|
1916 |
GX_BINRES_READ_ULONG(header -> gx_font_header_data_offset, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
380 |
|
1916 |
info -> gx_binres_read_offset += sizeof(ULONG); |
381 |
|
|
|
382 |
|
1916 |
return GX_SUCCESS; |
383 |
|
|
} |
384 |
|
|
#endif |
385 |
|
|
|
386 |
|
|
/**************************************************************************/ |
387 |
|
|
/* */ |
388 |
|
|
/* FUNCTION RELEASE */ |
389 |
|
|
/* */ |
390 |
|
|
/* _gx_binres_page_header_load PORTABLE C */ |
391 |
|
|
/* 6.1 */ |
392 |
|
|
/* AUTHOR */ |
393 |
|
|
/* */ |
394 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
395 |
|
|
/* */ |
396 |
|
|
/* DESCRIPTION */ |
397 |
|
|
/* */ |
398 |
|
|
/* This function reads page header from a binary data buffer. */ |
399 |
|
|
/* */ |
400 |
|
|
/* INPUT */ |
401 |
|
|
/* */ |
402 |
|
|
/* info Binary read control block */ |
403 |
|
|
/* header Returned page header */ |
404 |
|
|
/* */ |
405 |
|
|
/* OUTPUT */ |
406 |
|
|
/* */ |
407 |
|
|
/* Status Completion status */ |
408 |
|
|
/* */ |
409 |
|
|
/* CALLS */ |
410 |
|
|
/* */ |
411 |
|
|
/* None */ |
412 |
|
|
/* */ |
413 |
|
|
/* CALLED BY */ |
414 |
|
|
/* */ |
415 |
|
|
/* GUIX Internal Code */ |
416 |
|
|
/* */ |
417 |
|
|
/* RELEASE HISTORY */ |
418 |
|
|
/* */ |
419 |
|
|
/* DATE NAME DESCRIPTION */ |
420 |
|
|
/* */ |
421 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
422 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
423 |
|
|
/* removed use of memcpy, */ |
424 |
|
|
/* resulting in version 6.1 */ |
425 |
|
|
/* */ |
426 |
|
|
/**************************************************************************/ |
427 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
428 |
|
11760 |
static UINT _gx_binres_page_header_load(GX_BINRES_DATA_INFO *info, GX_PAGE_HEADER *header) |
429 |
|
|
{ |
430 |
|
11760 |
ULONG read_data = 0; |
431 |
|
|
|
432 |
|
11760 |
GX_BINRES_READ_USHORT(header -> gx_page_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
433 |
|
11760 |
info -> gx_binres_read_offset += sizeof(USHORT); |
434 |
|
|
|
435 |
✓✓ |
11760 |
if(header -> gx_page_header_magic_number != GX_MAGIC_NUMBER) |
436 |
|
|
{ |
437 |
|
1 |
return GX_INVALID_FORMAT; |
438 |
|
|
} |
439 |
|
|
|
440 |
|
11759 |
GX_BINRES_READ_USHORT(header -> gx_page_header_index, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
441 |
|
11759 |
info -> gx_binres_read_offset += sizeof(USHORT); |
442 |
|
|
|
443 |
|
11759 |
GX_BINRES_READ_GX_UBYTE(header -> gx_page_header_format, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
444 |
|
11759 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
445 |
|
|
|
446 |
|
11759 |
GX_BINRES_READ_GX_UBYTE(header -> gx_page_header_prespace, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
447 |
|
11759 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
448 |
|
|
|
449 |
|
11759 |
GX_BINRES_READ_GX_UBYTE(header -> gx_page_header_postspace, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
450 |
|
11759 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
451 |
|
|
|
452 |
|
11759 |
GX_BINRES_READ_GX_UBYTE(header -> gx_page_header_line_height, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
453 |
|
11759 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
454 |
|
|
|
455 |
|
11759 |
GX_BINRES_READ_GX_UBYTE(header -> gx_page_header_baseline, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
456 |
|
11759 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
457 |
|
|
|
458 |
|
|
/* In the binary resource file, CHAR_CODE is always stored as 4-byte value. */ |
459 |
|
11759 |
GX_BINRES_READ_ULONG(read_data, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
460 |
|
11759 |
info -> gx_binres_read_offset += sizeof(ULONG); |
461 |
|
11759 |
header -> gx_page_header_first_glyph = (GX_CHAR_CODE)read_data; |
462 |
|
|
|
463 |
|
|
/* In the binary resource file, CHAR_CODE is always stored as 4-byte value. */ |
464 |
|
11759 |
GX_BINRES_READ_ULONG(read_data, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
465 |
|
11759 |
info -> gx_binres_read_offset += sizeof(ULONG); |
466 |
|
11759 |
header -> gx_page_header_last_glyph = (GX_CHAR_CODE)read_data; |
467 |
|
|
|
468 |
|
11759 |
GX_BINRES_READ_ULONG(header -> gx_page_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
469 |
|
11759 |
info -> gx_binres_read_offset += sizeof(ULONG); |
470 |
|
|
|
471 |
|
11759 |
return GX_SUCCESS; |
472 |
|
|
} |
473 |
|
|
#endif |
474 |
|
|
|
475 |
|
|
/**************************************************************************/ |
476 |
|
|
/* */ |
477 |
|
|
/* FUNCTION RELEASE */ |
478 |
|
|
/* */ |
479 |
|
|
/* _gx_binres_glyph_header_load PORTABLE C */ |
480 |
|
|
/* 6.1 */ |
481 |
|
|
/* AUTHOR */ |
482 |
|
|
/* */ |
483 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
484 |
|
|
/* */ |
485 |
|
|
/* DESCRIPTION */ |
486 |
|
|
/* */ |
487 |
|
|
/* This function reads glyph header from a binary data buffer. */ |
488 |
|
|
/* */ |
489 |
|
|
/* INPUT */ |
490 |
|
|
/* */ |
491 |
|
|
/* info Binary read control block */ |
492 |
|
|
/* header Returned glyph header */ |
493 |
|
|
/* */ |
494 |
|
|
/* OUTPUT */ |
495 |
|
|
/* */ |
496 |
|
|
/* Status Completion status */ |
497 |
|
|
/* */ |
498 |
|
|
/* CALLS */ |
499 |
|
|
/* */ |
500 |
|
|
/* None */ |
501 |
|
|
/* */ |
502 |
|
|
/* CALLED BY */ |
503 |
|
|
/* */ |
504 |
|
|
/* GUIX Internal Code */ |
505 |
|
|
/* */ |
506 |
|
|
/* RELEASE HISTORY */ |
507 |
|
|
/* */ |
508 |
|
|
/* DATE NAME DESCRIPTION */ |
509 |
|
|
/* */ |
510 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
511 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
512 |
|
|
/* removed use of memcpy, and */ |
513 |
|
|
/* updated with binary */ |
514 |
|
|
/* resource layout change, */ |
515 |
|
|
/* resulting in version 6.1 */ |
516 |
|
|
/* */ |
517 |
|
|
/**************************************************************************/ |
518 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
519 |
|
16343 |
static UINT _gx_binres_glyph_header_load(GX_BINRES_DATA_INFO *info, GX_GLYPH_HEADER *header) |
520 |
|
|
{ |
521 |
|
16343 |
GX_BINRES_READ_USHORT(header -> gx_glyph_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
522 |
|
16343 |
info -> gx_binres_read_offset += sizeof(USHORT); |
523 |
|
|
|
524 |
|
16343 |
GX_BINRES_READ_USHORT(header -> gx_glyph_header_map_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
525 |
|
16343 |
info -> gx_binres_read_offset += sizeof(USHORT); |
526 |
|
|
|
527 |
|
16343 |
GX_BINRES_READ_ULONG(header -> gx_glyph_header_map_offset, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
528 |
|
16343 |
info -> gx_binres_read_offset += sizeof(ULONG); |
529 |
|
|
|
530 |
|
16343 |
GX_BINRES_READ_USHORT(header -> gx_glyph_header_index, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
531 |
|
16343 |
info -> gx_binres_read_offset += sizeof(USHORT); |
532 |
|
|
|
533 |
|
16343 |
GX_BINRES_READ_SHORT(header -> gx_glyph_header_ascent, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
534 |
|
16343 |
info -> gx_binres_read_offset += sizeof(SHORT); |
535 |
|
|
|
536 |
|
16343 |
GX_BINRES_READ_SHORT(header -> gx_glyph_header_descent, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
537 |
|
16343 |
info -> gx_binres_read_offset += sizeof(SHORT); |
538 |
|
|
|
539 |
|
16343 |
GX_BINRES_READ_GX_UBYTE(header -> gx_glyph_header_advance, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
540 |
|
16343 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
541 |
|
|
|
542 |
|
16343 |
GX_BINRES_READ_GX_BYTE(header -> gx_glyph_header_leading, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
543 |
|
16343 |
info -> gx_binres_read_offset += sizeof(GX_BYTE); |
544 |
|
|
|
545 |
|
16343 |
GX_BINRES_READ_GX_UBYTE(header -> gx_glyph_header_width, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
546 |
|
16343 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
547 |
|
|
|
548 |
|
16343 |
GX_BINRES_READ_GX_UBYTE(header -> gx_glyph_header_height, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
549 |
|
16343 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
550 |
|
|
|
551 |
|
16343 |
GX_BINRES_READ_ULONG(header -> gx_glyph_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
552 |
|
16343 |
info -> gx_binres_read_offset += sizeof(ULONG); |
553 |
|
|
|
554 |
|
16343 |
return GX_SUCCESS; |
555 |
|
|
} |
556 |
|
|
#endif |
557 |
|
|
|
558 |
|
|
|
559 |
|
|
/**************************************************************************/ |
560 |
|
|
/* */ |
561 |
|
|
/* FUNCTION RELEASE */ |
562 |
|
|
/* */ |
563 |
|
|
/* _gx_binres_kerning_glyph_header_load PORTABLE C */ |
564 |
|
|
/* 6.1 */ |
565 |
|
|
/* AUTHOR */ |
566 |
|
|
/* */ |
567 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
568 |
|
|
/* */ |
569 |
|
|
/* DESCRIPTION */ |
570 |
|
|
/* */ |
571 |
|
|
/* This function reads glyph header from a binary data buffer. */ |
572 |
|
|
/* */ |
573 |
|
|
/* INPUT */ |
574 |
|
|
/* */ |
575 |
|
|
/* info Binary read control block */ |
576 |
|
|
/* header Returned glyph header */ |
577 |
|
|
/* */ |
578 |
|
|
/* OUTPUT */ |
579 |
|
|
/* */ |
580 |
|
|
/* Status Completion status */ |
581 |
|
|
/* */ |
582 |
|
|
/* CALLS */ |
583 |
|
|
/* */ |
584 |
|
|
/* None */ |
585 |
|
|
/* */ |
586 |
|
|
/* CALLED BY */ |
587 |
|
|
/* */ |
588 |
|
|
/* GUIX Internal Code */ |
589 |
|
|
/* */ |
590 |
|
|
/* RELEASE HISTORY */ |
591 |
|
|
/* */ |
592 |
|
|
/* DATE NAME DESCRIPTION */ |
593 |
|
|
/* */ |
594 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
595 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
596 |
|
|
/* removed use of memcpy, */ |
597 |
|
|
/* resulting in version 6.1 */ |
598 |
|
|
/* */ |
599 |
|
|
/**************************************************************************/ |
600 |
|
|
#ifdef GX_FONT_KERNING_SUPPORT |
601 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
602 |
|
|
static UINT _gx_binres_kerning_glyph_header_load(GX_BINRES_DATA_INFO *info, GX_KERNING_GLYPH_HEADER *header) |
603 |
|
|
{ |
604 |
|
|
_gx_binres_glyph_header_load(info, (GX_GLYPH_HEADER *)header); |
605 |
|
|
|
606 |
|
|
GX_BINRES_READ_USHORT(header -> gx_glyph_header_kerning_table_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
607 |
|
|
info -> gx_binres_read_offset += sizeof(USHORT); |
608 |
|
|
|
609 |
|
|
return GX_SUCCESS; |
610 |
|
|
} |
611 |
|
|
#endif |
612 |
|
|
#endif |
613 |
|
|
|
614 |
|
|
/**************************************************************************/ |
615 |
|
|
/* */ |
616 |
|
|
/* FUNCTION RELEASE */ |
617 |
|
|
/* */ |
618 |
|
|
/* _gx_binres_pixelmap_header_load PORTABLE C */ |
619 |
|
|
/* 6.3.0 */ |
620 |
|
|
/* AUTHOR */ |
621 |
|
|
/* */ |
622 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
623 |
|
|
/* */ |
624 |
|
|
/* DESCRIPTION */ |
625 |
|
|
/* */ |
626 |
|
|
/* This function reads pixelmap header from a binary data buffer. */ |
627 |
|
|
/* */ |
628 |
|
|
/* INPUT */ |
629 |
|
|
/* */ |
630 |
|
|
/* info Binary read control block */ |
631 |
|
|
/* header Returned pixelmap header */ |
632 |
|
|
/* */ |
633 |
|
|
/* OUTPUT */ |
634 |
|
|
/* */ |
635 |
|
|
/* Status Completion status */ |
636 |
|
|
/* */ |
637 |
|
|
/* CALLS */ |
638 |
|
|
/* */ |
639 |
|
|
/* None */ |
640 |
|
|
/* */ |
641 |
|
|
/* CALLED BY */ |
642 |
|
|
/* */ |
643 |
|
|
/* GUIX Internal Code */ |
644 |
|
|
/* */ |
645 |
|
|
/* RELEASE HISTORY */ |
646 |
|
|
/* */ |
647 |
|
|
/* DATE NAME DESCRIPTION */ |
648 |
|
|
/* */ |
649 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
650 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
651 |
|
|
/* removed use of memcpy, */ |
652 |
|
|
/* resulting in version 6.1 */ |
653 |
|
|
/* 10-31-2023 Ting Zhu Modified comment(s), */ |
654 |
|
|
/* added magic number check, */ |
655 |
|
|
/* resulting in version 6.3.0 */ |
656 |
|
|
/* */ |
657 |
|
|
/**************************************************************************/ |
658 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
659 |
|
1378 |
static UINT _gx_binres_pixelmap_header_load(GX_BINRES_DATA_INFO *info, GX_PIXELMAP_HEADER *header) |
660 |
|
|
{ |
661 |
|
1378 |
GX_BINRES_READ_USHORT(header -> gx_pixelmap_header_magic_number, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
662 |
|
1378 |
info -> gx_binres_read_offset += sizeof(USHORT); |
663 |
|
|
|
664 |
✓✓ |
1378 |
if (header -> gx_pixelmap_header_magic_number != GX_MAGIC_NUMBER) |
665 |
|
|
{ |
666 |
|
3 |
return GX_INVALID_FORMAT; |
667 |
|
|
} |
668 |
|
|
|
669 |
|
1375 |
GX_BINRES_READ_USHORT(header -> gx_pixelmap_header_index, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
670 |
|
1375 |
info -> gx_binres_read_offset += sizeof(USHORT); |
671 |
|
|
|
672 |
|
1375 |
GX_BINRES_READ_GX_UBYTE(header -> gx_pixelmap_header_version_major, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
673 |
|
1375 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
674 |
|
|
|
675 |
|
1375 |
GX_BINRES_READ_GX_UBYTE(header -> gx_pixelmap_header_version_minor, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
676 |
|
1375 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
677 |
|
|
|
678 |
|
1375 |
GX_BINRES_READ_GX_UBYTE(header -> gx_pixelmap_header_flags, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
679 |
|
1375 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
680 |
|
|
|
681 |
|
1375 |
GX_BINRES_READ_GX_UBYTE(header -> gx_pixelmap_header_format, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
682 |
|
1375 |
info -> gx_binres_read_offset += sizeof(GX_UBYTE); |
683 |
|
|
|
684 |
|
1375 |
GX_BINRES_READ_ULONG(header -> gx_pixelmap_header_map_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
685 |
|
1375 |
info -> gx_binres_read_offset += sizeof(ULONG); |
686 |
|
|
|
687 |
|
1375 |
GX_BINRES_READ_ULONG(header -> gx_pixelmap_header_aux_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
688 |
|
1375 |
info -> gx_binres_read_offset += sizeof(ULONG); |
689 |
|
|
|
690 |
|
1375 |
GX_BINRES_READ_ULONG(header -> gx_pixelmap_header_transparent_color, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
691 |
|
1375 |
info -> gx_binres_read_offset += sizeof(GX_COLOR); |
692 |
|
|
|
693 |
|
1375 |
GX_BINRES_READ_USHORT(header -> gx_pixelmap_header_width, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
694 |
|
1375 |
info -> gx_binres_read_offset += sizeof(USHORT); |
695 |
|
|
|
696 |
|
1375 |
GX_BINRES_READ_USHORT(header -> gx_pixelmap_header_height, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
697 |
|
1375 |
info -> gx_binres_read_offset += sizeof(USHORT); |
698 |
|
|
|
699 |
|
1375 |
GX_BINRES_READ_ULONG(header -> gx_pixelmap_header_data_size, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
700 |
|
1375 |
info -> gx_binres_read_offset += sizeof(ULONG); |
701 |
|
|
|
702 |
|
1375 |
GX_BINRES_READ_ULONG(header -> gx_pixelmap_header_data_offset, info -> gx_binres_root_address + info -> gx_binres_read_offset); |
703 |
|
1375 |
info -> gx_binres_read_offset += sizeof(ULONG); |
704 |
|
|
|
705 |
|
1375 |
return GX_SUCCESS; |
706 |
|
|
} |
707 |
|
|
#endif |
708 |
|
|
|
709 |
|
|
/**************************************************************************/ |
710 |
|
|
/* */ |
711 |
|
|
/* FUNCTION RELEASE */ |
712 |
|
|
/* */ |
713 |
|
|
/* _gx_binres_font_buffer_size_get PORTABLE C */ |
714 |
|
|
/* 6.3.0 */ |
715 |
|
|
/* AUTHOR */ |
716 |
|
|
/* */ |
717 |
|
|
/* Ting Zhu, Microsoft Corporation */ |
718 |
|
|
/* */ |
719 |
|
|
/* DESCRIPTION */ |
720 |
|
|
/* */ |
721 |
|
|
/* This function calculates the required buffer size needed for */ |
722 |
|
|
/* loading the font from the current position. */ |
723 |
|
|
/* */ |
724 |
|
|
/* INPUT */ |
725 |
|
|
/* */ |
726 |
|
|
/* info Binary resource control block */ |
727 |
|
|
/* buffer_size The required buffer size */ |
728 |
|
|
/* */ |
729 |
|
|
/* OUTPUT */ |
730 |
|
|
/* */ |
731 |
|
|
/* Status Completion status */ |
732 |
|
|
/* */ |
733 |
|
|
/* CALLS */ |
734 |
|
|
/* */ |
735 |
|
|
/* _gx_binres_font_header_load Read font header */ |
736 |
|
|
/* _gx_binres_page_header_load Read font page header */ |
737 |
|
|
/* */ |
738 |
|
|
/* CALLED BY */ |
739 |
|
|
/* */ |
740 |
|
|
/* GUIX Internal Code */ |
741 |
|
|
/* */ |
742 |
|
|
/* RELEASE HISTORY */ |
743 |
|
|
/* */ |
744 |
|
|
/* DATE NAME DESCRIPTION */ |
745 |
|
|
/* */ |
746 |
|
|
/* 10-31-2023 Ting Zhu Initial Version 6.3.0 */ |
747 |
|
|
/* */ |
748 |
|
|
/**************************************************************************/ |
749 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
750 |
|
851 |
UINT _gx_binres_font_buffer_size_get(GX_BINRES_DATA_INFO *info, UINT *buffer_size, GX_BOOL reset_read_offset) |
751 |
|
|
{ |
752 |
|
|
UINT status; |
753 |
|
|
GX_FONT_HEADER font_header; |
754 |
|
|
GX_PAGE_HEADER page_header; |
755 |
|
|
USHORT page_index; |
756 |
|
|
UINT glyph_count; |
757 |
|
851 |
UINT read_offset = 0; |
758 |
|
|
UINT temp; |
759 |
|
851 |
UINT size = 0; |
760 |
|
|
UINT old_offset; |
761 |
|
|
|
762 |
✓✓ |
851 |
if(reset_read_offset) |
763 |
|
|
{ |
764 |
|
3 |
old_offset = info -> gx_binres_read_offset; |
765 |
|
|
} |
766 |
|
|
|
767 |
|
851 |
status = _gx_binres_font_header_load(info, &font_header); |
768 |
|
|
|
769 |
✓✓ |
851 |
if (status != GX_SUCCESS) |
770 |
|
|
{ |
771 |
|
3 |
return status; |
772 |
|
|
} |
773 |
|
|
|
774 |
✓✓ |
848 |
if (font_header.gx_font_header_data_offset) |
775 |
|
|
{ |
776 |
|
|
/* The font data is not follow the header directly, |
777 |
|
|
the data offset gives the position where the font |
778 |
|
|
data located. */ |
779 |
|
|
|
780 |
|
|
/* Record current data offset. */ |
781 |
|
734 |
read_offset = info -> gx_binres_read_offset; |
782 |
|
|
|
783 |
|
|
/* Temporarily reset data offset of access font data. */ |
784 |
|
734 |
info -> gx_binres_read_offset = font_header.gx_font_header_data_offset; |
785 |
|
|
|
786 |
|
|
/* Load font header. */ |
787 |
|
734 |
_gx_binres_font_header_load(info, &font_header); |
788 |
|
|
} |
789 |
|
|
|
790 |
✓✓ |
12254 |
for (page_index = 0; page_index < font_header.gx_font_header_page_count; page_index++) |
791 |
|
|
{ |
792 |
|
|
/* Load page header. */ |
793 |
|
11407 |
status = _gx_binres_page_header_load(info, &page_header); |
794 |
|
|
|
795 |
✓✓ |
11407 |
if(status != GX_SUCCESS) |
796 |
|
|
{ |
797 |
|
1 |
return status; |
798 |
|
|
} |
799 |
|
|
|
800 |
|
11406 |
info -> gx_binres_read_offset += page_header.gx_page_header_data_size; |
801 |
|
|
|
802 |
|
|
#if defined(GX_EXTENDED_UNICODE_SUPPORT) |
803 |
|
|
if (page_header.gx_page_header_last_glyph > GX_MAX_GLYPH_CODE) |
804 |
|
|
{ |
805 |
|
|
return GX_INVALID_FONT; |
806 |
|
|
} |
807 |
|
|
#endif |
808 |
|
|
|
809 |
|
|
/* Max glyph code is 0x10f000, overflow cannot occur. */ |
810 |
|
11406 |
glyph_count = (UINT)(page_header.gx_page_header_last_glyph - page_header.gx_page_header_first_glyph + 1); |
811 |
|
|
|
812 |
|
|
/* Calculate size for loading font page. */ |
813 |
|
11406 |
temp = sizeof(GX_FONT); |
814 |
|
|
|
815 |
|
|
/* Calculate size for loading glyphs. */ |
816 |
✓✓ |
11406 |
if (page_header.gx_page_header_format & GX_FONT_FORMAT_COMPRESSED) |
817 |
|
|
{ |
818 |
|
24 |
temp += sizeof(GX_COMPRESSED_GLYPH) * glyph_count; |
819 |
|
|
} |
820 |
|
|
#if defined(GX_FONT_KERNING_SUPPORT) |
821 |
|
|
else if (page_header.gx_page_header_format & GX_FONT_FORMAT_KERNING) |
822 |
|
|
{ |
823 |
|
|
temp += sizeof(GX_KERNING_GLYPH) * glyph_count; |
824 |
|
|
} |
825 |
|
|
#endif |
826 |
|
|
else |
827 |
|
|
{ |
828 |
|
11382 |
temp += sizeof(GX_GLYPH) * glyph_count; |
829 |
|
|
} |
830 |
|
|
|
831 |
✗✓ |
11406 |
GX_UTILITY_MATH_UINT_ADD(size, temp, size); |
832 |
|
|
} |
833 |
|
|
|
834 |
✓✓ |
847 |
if (read_offset) |
835 |
|
|
{ |
836 |
|
|
/* Restore data offset. */ |
837 |
|
734 |
info -> gx_binres_read_offset = read_offset; |
838 |
|
734 |
read_offset = 0; |
839 |
|
|
} |
840 |
|
|
|
841 |
|
847 |
*buffer_size = size; |
842 |
|
|
|
843 |
✓✓ |
847 |
if (reset_read_offset) |
844 |
|
|
{ |
845 |
|
|
/* Reset offset. */ |
846 |
|
3 |
info -> gx_binres_read_offset = old_offset; |
847 |
|
|
} |
848 |
|
|
|
849 |
|
847 |
return GX_SUCCESS; |
850 |
|
|
} |
851 |
|
|
#endif |
852 |
|
|
|
853 |
|
|
/**************************************************************************/ |
854 |
|
|
/* */ |
855 |
|
|
/* FUNCTION RELEASE */ |
856 |
|
|
/* */ |
857 |
|
|
/* _gx_binres_theme_table_buffer_allocate PORTABLE C */ |
858 |
|
|
/* 6.3.0 */ |
859 |
|
|
/* AUTHOR */ |
860 |
|
|
/* */ |
861 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
862 |
|
|
/* */ |
863 |
|
|
/* DESCRIPTION */ |
864 |
|
|
/* */ |
865 |
|
|
/* This function allocates needed memory buffer for loading theme */ |
866 |
|
|
/* table. */ |
867 |
|
|
/* */ |
868 |
|
|
/* INPUT */ |
869 |
|
|
/* */ |
870 |
|
|
/* info Binary resource control block */ |
871 |
|
|
/* */ |
872 |
|
|
/* OUTPUT */ |
873 |
|
|
/* */ |
874 |
|
|
/* Status Completion status */ |
875 |
|
|
/* */ |
876 |
|
|
/* CALLS */ |
877 |
|
|
/* */ |
878 |
|
|
/* _gx_system_memory_allocator Application defined memory */ |
879 |
|
|
/* allocation function */ |
880 |
|
|
/* _gx_binres_resource_header_load Read resource header */ |
881 |
|
|
/* _gx_binres_theme_header_load Read theme header */ |
882 |
|
|
/* _gx_binres_font_buffer_size_get Get required font buffer size */ |
883 |
|
|
/* */ |
884 |
|
|
/* CALLED BY */ |
885 |
|
|
/* */ |
886 |
|
|
/* GUIX Internal Code */ |
887 |
|
|
/* */ |
888 |
|
|
/* RELEASE HISTORY */ |
889 |
|
|
/* */ |
890 |
|
|
/* DATE NAME DESCRIPTION */ |
891 |
|
|
/* */ |
892 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
893 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
894 |
|
|
/* resulting in version 6.1 */ |
895 |
|
|
/* 10-31-2023 Ting Zhu Modified comment(s), */ |
896 |
|
|
/* improved logic, */ |
897 |
|
|
/* resulting in version 6.3.0 */ |
898 |
|
|
/* */ |
899 |
|
|
/**************************************************************************/ |
900 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
901 |
|
50 |
static UINT _gx_binres_theme_buffer_allocate(GX_BINRES_DATA_INFO *info, INT theme_id) |
902 |
|
|
{ |
903 |
|
50 |
UINT status = GX_SUCCESS; |
904 |
|
|
GX_RESOURCE_HEADER res_header; |
905 |
|
|
GX_THEME_HEADER theme_header; |
906 |
|
|
USHORT theme_index; |
907 |
|
|
USHORT font_index; |
908 |
|
|
UINT temp; |
909 |
|
|
|
910 |
|
|
/* Read resource header. */ |
911 |
|
50 |
info -> gx_binres_read_offset = 0; |
912 |
|
|
|
913 |
|
50 |
_gx_binres_resource_header_load(info, &res_header); |
914 |
|
|
|
915 |
✓✓ |
50 |
if (res_header.gx_resource_header_magic_number != GX_MAGIC_NUMBER) |
916 |
|
|
{ |
917 |
|
1 |
return GX_INVALID_FORMAT; |
918 |
|
|
} |
919 |
|
|
|
920 |
|
49 |
info -> gx_binres_buffer_size = 0; |
921 |
|
|
|
922 |
✓✓ |
69 |
for (theme_index = 0; theme_index < res_header.gx_resource_header_theme_count; theme_index++) |
923 |
|
|
{ |
924 |
|
67 |
_gx_binres_theme_header_load(info, &theme_header); |
925 |
|
|
|
926 |
✓✓ |
67 |
if (theme_header.gx_theme_header_magic_number != GX_MAGIC_NUMBER) |
927 |
|
|
{ |
928 |
|
1 |
return GX_INVALID_FORMAT; |
929 |
|
|
} |
930 |
|
|
|
931 |
✓✓ |
66 |
if (theme_index == theme_id) |
932 |
|
|
{ |
933 |
|
46 |
info -> gx_binres_buffer_size = sizeof(GX_THEME); |
934 |
|
|
|
935 |
|
|
/* Color table buffer size. */ |
936 |
✓✓ |
46 |
if (theme_header.gx_theme_header_color_data_size) |
937 |
|
|
{ |
938 |
|
37 |
info -> gx_binres_read_offset += theme_header.gx_theme_header_color_data_size; |
939 |
|
|
} |
940 |
|
|
|
941 |
|
|
/* Palette table buffer size. */ |
942 |
✓✓ |
46 |
if (theme_header.gx_theme_header_palette_data_size) |
943 |
|
|
{ |
944 |
|
12 |
info -> gx_binres_read_offset += theme_header.gx_theme_header_palette_data_size; |
945 |
|
|
} |
946 |
|
|
|
947 |
|
|
/* Font table buffer size. */ |
948 |
✓✓ |
46 |
if (theme_header.gx_theme_header_font_data_size) |
949 |
|
|
{ |
950 |
|
|
/* Font count is USHORT type, overflow cannot occur. */ |
951 |
|
42 |
info -> gx_binres_buffer_size += sizeof(GX_FONT *) * theme_header.gx_theme_header_font_count; |
952 |
|
|
|
953 |
✓✓ |
885 |
for (font_index = 0; font_index < theme_header.gx_theme_header_font_count; font_index++) |
954 |
|
|
{ |
955 |
|
848 |
status = _gx_binres_font_buffer_size_get(info, &temp, GX_FALSE); |
956 |
|
|
|
957 |
✓✓ |
848 |
if (status != GX_SUCCESS) |
958 |
|
|
{ |
959 |
|
4 |
return status; |
960 |
|
|
} |
961 |
|
|
|
962 |
✓✓ |
844 |
GX_UTILITY_MATH_UINT_ADD(info -> gx_binres_buffer_size, temp, info -> gx_binres_buffer_size); |
963 |
|
|
} |
964 |
|
|
} |
965 |
|
|
|
966 |
|
|
/* Pixelmap table buffer size. */ |
967 |
✓✓ |
41 |
if (theme_header.gx_theme_header_pixelmap_data_size) |
968 |
|
|
{ |
969 |
|
|
/* Pixelmap count is USHORT type, overflow can not occur. */ |
970 |
|
36 |
temp = ((UINT)(theme_header.gx_theme_header_pixelmap_count + 1)) * sizeof(GX_PIXELMAP *); |
971 |
|
36 |
temp += sizeof(GX_PIXELMAP) * theme_header.gx_theme_header_pixelmap_count; |
972 |
|
|
|
973 |
✓✓ |
36 |
GX_UTILITY_MATH_UINT_ADD(info -> gx_binres_buffer_size, temp, info -> gx_binres_buffer_size); |
974 |
|
|
|
975 |
|
35 |
info -> gx_binres_read_offset += theme_header.gx_theme_header_pixelmap_data_size; |
976 |
|
|
} |
977 |
|
|
|
978 |
|
40 |
break; |
979 |
|
|
} |
980 |
|
|
else |
981 |
|
|
{ |
982 |
|
20 |
info -> gx_binres_read_offset += theme_header.gx_theme_header_data_size; |
983 |
|
|
} |
984 |
|
|
} |
985 |
|
|
|
986 |
|
42 |
info -> gx_binres_buffer = (GX_UBYTE *)_gx_system_memory_allocator(info -> gx_binres_buffer_size); |
987 |
|
|
|
988 |
✓✓ |
42 |
if (!info -> gx_binres_buffer) |
989 |
|
|
{ |
990 |
|
2 |
return GX_SYSTEM_MEMORY_ERROR; |
991 |
|
|
} |
992 |
|
|
|
993 |
|
40 |
memset(info -> gx_binres_buffer, 0, info -> gx_binres_buffer_size); |
994 |
|
40 |
info -> gx_binres_buffer_index = 0; |
995 |
|
|
|
996 |
|
|
/* Reset read offset. */ |
997 |
|
40 |
info -> gx_binres_read_offset = 0; |
998 |
|
|
|
999 |
|
40 |
return status; |
1000 |
|
|
} |
1001 |
|
|
#endif |
1002 |
|
|
|
1003 |
|
|
/**************************************************************************/ |
1004 |
|
|
/* */ |
1005 |
|
|
/* FUNCTION RELEASE */ |
1006 |
|
|
/* */ |
1007 |
|
|
/* _gx_binres_glyphs_address_get PORTABLE C */ |
1008 |
|
|
/* 6.1 */ |
1009 |
|
|
/* AUTHOR */ |
1010 |
|
|
/* */ |
1011 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1012 |
|
|
/* */ |
1013 |
|
|
/* DESCRIPTION */ |
1014 |
|
|
/* */ |
1015 |
|
|
/* This function finds the memory address of specified glyph data from */ |
1016 |
|
|
/* a binary data buffer. */ |
1017 |
|
|
/* */ |
1018 |
|
|
/* INPUT */ |
1019 |
|
|
/* */ |
1020 |
|
|
/* info Binary resource control block */ |
1021 |
|
|
/* glyph_count The number of glyphs that the */ |
1022 |
|
|
/* font page contains. */ |
1023 |
|
|
/* returned_glyphs Returned glyph address */ |
1024 |
|
|
/* */ |
1025 |
|
|
/* OUTPUT */ |
1026 |
|
|
/* */ |
1027 |
|
|
/* Status Completion status */ |
1028 |
|
|
/* */ |
1029 |
|
|
/* CALLS */ |
1030 |
|
|
/* */ |
1031 |
|
|
/* _gx_binres_glyph_header_load Read glyph data header */ |
1032 |
|
|
/* */ |
1033 |
|
|
/* CALLED BY */ |
1034 |
|
|
/* */ |
1035 |
|
|
/* GUIX Internal Code */ |
1036 |
|
|
/* */ |
1037 |
|
|
/* RELEASE HISTORY */ |
1038 |
|
|
/* */ |
1039 |
|
|
/* DATE NAME DESCRIPTION */ |
1040 |
|
|
/* */ |
1041 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
1042 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
1043 |
|
|
/* updated with binary */ |
1044 |
|
|
/* resource layout change, */ |
1045 |
|
|
/* resulting in version 6.1 */ |
1046 |
|
|
/* */ |
1047 |
|
|
/**************************************************************************/ |
1048 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
1049 |
|
346 |
static UINT _gx_binres_glyphs_address_get(GX_BINRES_DATA_INFO *info, USHORT glyph_count, GX_CONST GX_GLYPH **returned_glyphs) |
1050 |
|
|
{ |
1051 |
|
|
GX_GLYPH_HEADER header; |
1052 |
|
|
GX_GLYPH *glyphs; |
1053 |
|
346 |
USHORT index = 0; |
1054 |
|
|
|
1055 |
|
346 |
glyphs = (GX_GLYPH *)(info -> gx_binres_buffer + info -> gx_binres_buffer_index); |
1056 |
|
346 |
info -> gx_binres_buffer_index += sizeof(GX_GLYPH) * glyph_count; |
1057 |
|
|
|
1058 |
✓✓ |
16113 |
for (index = 0; index < glyph_count; index++) |
1059 |
|
|
{ |
1060 |
|
15772 |
_gx_binres_glyph_header_load(info, &header); |
1061 |
|
|
|
1062 |
✓✓ |
15772 |
if (header.gx_glyph_header_magic_number != GX_MAGIC_NUMBER) |
1063 |
|
|
{ |
1064 |
|
5 |
return GX_INVALID_FORMAT; |
1065 |
|
|
} |
1066 |
|
|
|
1067 |
|
15767 |
glyphs[index].gx_glyph_advance = header.gx_glyph_header_advance; |
1068 |
|
15767 |
glyphs[index].gx_glyph_ascent = header.gx_glyph_header_ascent; |
1069 |
|
15767 |
glyphs[index].gx_glyph_descent = header.gx_glyph_header_descent; |
1070 |
|
15767 |
glyphs[index].gx_glyph_height = header.gx_glyph_header_height; |
1071 |
|
15767 |
glyphs[index].gx_glyph_leading = header.gx_glyph_header_leading; |
1072 |
|
15767 |
glyphs[index].gx_glyph_width = header.gx_glyph_header_width; |
1073 |
|
|
|
1074 |
|
|
/* Read glyph data. */ |
1075 |
✓✓ |
15767 |
if (header.gx_glyph_header_data_size) |
1076 |
|
|
{ |
1077 |
|
14527 |
glyphs[index].gx_glyph_map = (GX_UBYTE *)(info -> gx_binres_root_address + header.gx_glyph_header_map_offset); |
1078 |
|
14527 |
info -> gx_binres_read_offset += header.gx_glyph_header_data_size; |
1079 |
|
|
} |
1080 |
|
|
else |
1081 |
|
|
{ |
1082 |
|
1240 |
glyphs[index].gx_glyph_map = GX_NULL; |
1083 |
|
|
} |
1084 |
|
|
} |
1085 |
|
|
|
1086 |
|
341 |
*returned_glyphs = glyphs; |
1087 |
|
|
|
1088 |
|
341 |
return GX_SUCCESS; |
1089 |
|
|
} |
1090 |
|
|
#endif |
1091 |
|
|
|
1092 |
|
|
/**************************************************************************/ |
1093 |
|
|
/* */ |
1094 |
|
|
/* FUNCTION RELEASE */ |
1095 |
|
|
/* */ |
1096 |
|
|
/* _gx_binres_kerning_glyphs_address_get PORTABLE C */ |
1097 |
|
|
/* 6.1 */ |
1098 |
|
|
/* AUTHOR */ |
1099 |
|
|
/* */ |
1100 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1101 |
|
|
/* */ |
1102 |
|
|
/* DESCRIPTION */ |
1103 |
|
|
/* */ |
1104 |
|
|
/* This service gets the memory address of specified kerning glyph */ |
1105 |
|
|
/* from a binary data buffer. */ |
1106 |
|
|
/* */ |
1107 |
|
|
/* INPUT */ |
1108 |
|
|
/* */ |
1109 |
|
|
/* info Binary resource control block */ |
1110 |
|
|
/* glyph_count The number of glyphs that the */ |
1111 |
|
|
/* font page contains. */ |
1112 |
|
|
/* returned_glyphs Returned glyph address */ |
1113 |
|
|
/* */ |
1114 |
|
|
/* OUTPUT */ |
1115 |
|
|
/* */ |
1116 |
|
|
/* Status Completion status */ |
1117 |
|
|
/* */ |
1118 |
|
|
/* CALLS */ |
1119 |
|
|
/* */ |
1120 |
|
|
/* _gx_binres_kerning_glyph_header_load */ |
1121 |
|
|
/* */ |
1122 |
|
|
/* CALLED BY */ |
1123 |
|
|
/* */ |
1124 |
|
|
/* Application Code */ |
1125 |
|
|
/* GUIX Internal Code */ |
1126 |
|
|
/* */ |
1127 |
|
|
/* RELEASE HISTORY */ |
1128 |
|
|
/* */ |
1129 |
|
|
/* DATE NAME DESCRIPTION */ |
1130 |
|
|
/* */ |
1131 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
1132 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
1133 |
|
|
/* updated with binary */ |
1134 |
|
|
/* resource layout change, */ |
1135 |
|
|
/* resulting in version 6.1 */ |
1136 |
|
|
/* */ |
1137 |
|
|
/**************************************************************************/ |
1138 |
|
|
#ifdef GX_FONT_KERNING_SUPPORT |
1139 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
1140 |
|
|
static UINT _gx_binres_kerning_glyphs_address_get(GX_BINRES_DATA_INFO *info, USHORT glyph_count, |
1141 |
|
|
GX_CONST GX_KERNING_GLYPH **returned_glyphs) |
1142 |
|
|
{ |
1143 |
|
|
GX_KERNING_GLYPH_HEADER header; |
1144 |
|
|
GX_KERNING_GLYPH *glyphs; |
1145 |
|
|
USHORT index = 0; |
1146 |
|
|
|
1147 |
|
|
glyphs = (GX_KERNING_GLYPH *)(info -> gx_binres_buffer + info -> gx_binres_buffer_index); |
1148 |
|
|
info -> gx_binres_buffer_index += sizeof(GX_KERNING_GLYPH) * glyph_count; |
1149 |
|
|
|
1150 |
|
|
for (index = 0; index < glyph_count; index++) |
1151 |
|
|
{ |
1152 |
|
|
_gx_binres_kerning_glyph_header_load(info, &header); |
1153 |
|
|
|
1154 |
|
|
if (header.gx_glyph_header_magic_number != GX_MAGIC_NUMBER) |
1155 |
|
|
{ |
1156 |
|
|
return GX_INVALID_FORMAT; |
1157 |
|
|
} |
1158 |
|
|
|
1159 |
|
|
glyphs[index].gx_glyph_advance = header.gx_glyph_header_advance; |
1160 |
|
|
glyphs[index].gx_glyph_ascent = header.gx_glyph_header_ascent; |
1161 |
|
|
glyphs[index].gx_glyph_descent = header.gx_glyph_header_descent; |
1162 |
|
|
glyphs[index].gx_glyph_height = header.gx_glyph_header_height; |
1163 |
|
|
glyphs[index].gx_glyph_leading = header.gx_glyph_header_leading; |
1164 |
|
|
glyphs[index].gx_glyph_width = header.gx_glyph_header_width; |
1165 |
|
|
|
1166 |
|
|
/* Read glyph data. */ |
1167 |
|
|
if (header.gx_glyph_header_data_size) |
1168 |
|
|
{ |
1169 |
|
|
glyphs[index].gx_glyph_map = (GX_UBYTE *)(info -> gx_binres_root_address + header.gx_glyph_header_map_offset); |
1170 |
|
|
info -> gx_binres_read_offset += header.gx_glyph_header_data_size; |
1171 |
|
|
} |
1172 |
|
|
else |
1173 |
|
|
{ |
1174 |
|
|
glyphs[index].gx_glyph_map = GX_NULL; |
1175 |
|
|
} |
1176 |
|
|
|
1177 |
|
|
/* Set glyph kerning table. */ |
1178 |
|
|
if (header.gx_glyph_header_kerning_table_size) |
1179 |
|
|
{ |
1180 |
|
|
glyphs[index].gx_kerning_table = (GX_UBYTE *)(info -> gx_binres_root_address + info -> gx_binres_read_offset); |
1181 |
|
|
info -> gx_binres_read_offset += header.gx_glyph_header_kerning_table_size; |
1182 |
|
|
} |
1183 |
|
|
} |
1184 |
|
|
|
1185 |
|
|
*returned_glyphs = glyphs; |
1186 |
|
|
|
1187 |
|
|
return GX_SUCCESS; |
1188 |
|
|
} |
1189 |
|
|
#endif |
1190 |
|
|
#endif |
1191 |
|
|
|
1192 |
|
|
/**************************************************************************/ |
1193 |
|
|
/* */ |
1194 |
|
|
/* FUNCTION RELEASE */ |
1195 |
|
|
/* */ |
1196 |
|
|
/* _gx_binres_compressed_glyphs_address_get PORTABLE C */ |
1197 |
|
|
/* 6.1 */ |
1198 |
|
|
/* AUTHOR */ |
1199 |
|
|
/* */ |
1200 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1201 |
|
|
/* */ |
1202 |
|
|
/* DESCRIPTION */ |
1203 |
|
|
/* */ |
1204 |
|
|
/* This service gets the memory address of specified compressed glyph */ |
1205 |
|
|
/* from a binary data buffer. */ |
1206 |
|
|
/* */ |
1207 |
|
|
/* INPUT */ |
1208 |
|
|
/* */ |
1209 |
|
|
/* info Binary resource control block */ |
1210 |
|
|
/* glyph_count The number of glyphs that the */ |
1211 |
|
|
/* font page contains. */ |
1212 |
|
|
/* returned_glyphs Returned glyph address */ |
1213 |
|
|
/* */ |
1214 |
|
|
/* OUTPUT */ |
1215 |
|
|
/* */ |
1216 |
|
|
/* Status Completion status */ |
1217 |
|
|
/* */ |
1218 |
|
|
/* CALLS */ |
1219 |
|
|
/* */ |
1220 |
|
|
/* _gx_binres_glyph_header_load Read glyph data header */ |
1221 |
|
|
/* */ |
1222 |
|
|
/* CALLED BY */ |
1223 |
|
|
/* */ |
1224 |
|
|
/* GUIX Internal Code */ |
1225 |
|
|
/* */ |
1226 |
|
|
/* RELEASE HISTORY */ |
1227 |
|
|
/* */ |
1228 |
|
|
/* DATE NAME DESCRIPTION */ |
1229 |
|
|
/* */ |
1230 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
1231 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
1232 |
|
|
/* updated with binary */ |
1233 |
|
|
/* resource layout change, */ |
1234 |
|
|
/* resulting in version 6.1 */ |
1235 |
|
|
/* */ |
1236 |
|
|
/**************************************************************************/ |
1237 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
1238 |
|
7 |
static UINT _gx_binres_compressed_glyphs_address_get(GX_BINRES_DATA_INFO *info, USHORT glyph_count, |
1239 |
|
|
GX_CONST GX_COMPRESSED_GLYPH **returned_glyphs) |
1240 |
|
|
{ |
1241 |
|
|
GX_GLYPH_HEADER header; |
1242 |
|
|
GX_COMPRESSED_GLYPH *glyphs; |
1243 |
|
7 |
USHORT index = 0; |
1244 |
|
|
|
1245 |
|
7 |
glyphs = (GX_COMPRESSED_GLYPH *)(info -> gx_binres_buffer + info -> gx_binres_buffer_index); |
1246 |
|
7 |
info -> gx_binres_buffer_index += sizeof(GX_COMPRESSED_GLYPH) * glyph_count; |
1247 |
|
|
|
1248 |
✓✓ |
577 |
for (index = 0; index < glyph_count; index++) |
1249 |
|
|
{ |
1250 |
|
571 |
_gx_binres_glyph_header_load(info, &header); |
1251 |
|
|
|
1252 |
✓✓ |
571 |
if (header.gx_glyph_header_magic_number != GX_MAGIC_NUMBER) |
1253 |
|
|
{ |
1254 |
|
1 |
return GX_INVALID_FORMAT; |
1255 |
|
|
} |
1256 |
|
|
|
1257 |
|
570 |
glyphs[index].gx_glyph_advance = header.gx_glyph_header_advance; |
1258 |
|
570 |
glyphs[index].gx_glyph_ascent = header.gx_glyph_header_ascent; |
1259 |
|
570 |
glyphs[index].gx_glyph_descent = header.gx_glyph_header_descent; |
1260 |
|
570 |
glyphs[index].gx_glyph_height = header.gx_glyph_header_height; |
1261 |
|
570 |
glyphs[index].gx_glyph_leading = header.gx_glyph_header_leading; |
1262 |
|
570 |
glyphs[index].gx_glyph_map_size = header.gx_glyph_header_map_size; |
1263 |
|
570 |
glyphs[index].gx_glyph_width = header.gx_glyph_header_width; |
1264 |
|
|
|
1265 |
|
|
/* Read glyph data. */ |
1266 |
✓✓ |
570 |
if (header.gx_glyph_header_data_size) |
1267 |
|
|
{ |
1268 |
|
566 |
glyphs[index].gx_glyph_map = (GX_UBYTE *)(info -> gx_binres_root_address + header.gx_glyph_header_map_offset); |
1269 |
|
566 |
info -> gx_binres_read_offset += header.gx_glyph_header_data_size; |
1270 |
|
|
} |
1271 |
|
|
else |
1272 |
|
|
{ |
1273 |
|
4 |
glyphs[index].gx_glyph_map = GX_NULL; |
1274 |
|
|
} |
1275 |
|
|
} |
1276 |
|
|
|
1277 |
|
6 |
*returned_glyphs = glyphs; |
1278 |
|
|
|
1279 |
|
6 |
return GX_SUCCESS; |
1280 |
|
|
} |
1281 |
|
|
#endif |
1282 |
|
|
|
1283 |
|
|
/**************************************************************************/ |
1284 |
|
|
/* */ |
1285 |
|
|
/* FUNCTION RELEASE */ |
1286 |
|
|
/* */ |
1287 |
|
|
/* _gx_binres_one_font_load PORTABLE C */ |
1288 |
|
|
/* 6.3.0 */ |
1289 |
|
|
/* AUTHOR */ |
1290 |
|
|
/* */ |
1291 |
|
|
/* Ting Zhu, Microsoft Corporation */ |
1292 |
|
|
/* */ |
1293 |
|
|
/* DESCRIPTION */ |
1294 |
|
|
/* */ |
1295 |
|
|
/* This service loads a font from a binary data buffer. */ |
1296 |
|
|
/* */ |
1297 |
|
|
/* INPUT */ |
1298 |
|
|
/* */ |
1299 |
|
|
/* info Binary resource control block */ |
1300 |
|
|
/* return_font Returned font */ |
1301 |
|
|
/* */ |
1302 |
|
|
/* OUTPUT */ |
1303 |
|
|
/* */ |
1304 |
|
|
/* Status Completion status */ |
1305 |
|
|
/* */ |
1306 |
|
|
/* CALLS */ |
1307 |
|
|
/* */ |
1308 |
|
|
/* _gx_binres_font_header_load Read font header */ |
1309 |
|
|
/* _gx_binres_page_header_load Read font page header */ |
1310 |
|
|
/* _gx_binres_compressed_glyphs_read Read compressed glyph data */ |
1311 |
|
|
/* _gx_binres_glyphs_read Read glyph data */ |
1312 |
|
|
/* */ |
1313 |
|
|
/* CALLED BY */ |
1314 |
|
|
/* */ |
1315 |
|
|
/* GUIX Internal Code */ |
1316 |
|
|
/* */ |
1317 |
|
|
/* RELEASE HISTORY */ |
1318 |
|
|
/* */ |
1319 |
|
|
/* DATE NAME DESCRIPTION */ |
1320 |
|
|
/* */ |
1321 |
|
|
/* 10-31-2023 Ting Zhu Initial Version 6.3.0 */ |
1322 |
|
|
/* */ |
1323 |
|
|
/**************************************************************************/ |
1324 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
1325 |
|
207 |
UINT _gx_binres_one_font_load(GX_BINRES_DATA_INFO *info, GX_FONT **return_font) |
1326 |
|
|
{ |
1327 |
|
207 |
UINT status = GX_SUCCESS; |
1328 |
|
|
GX_FONT_HEADER font_header; |
1329 |
|
|
GX_PAGE_HEADER header; |
1330 |
|
|
GX_FONT *font; |
1331 |
|
207 |
GX_FONT *head_page = GX_NULL; |
1332 |
|
207 |
GX_FONT *pre_page = GX_NULL; |
1333 |
|
|
USHORT index; |
1334 |
|
|
USHORT glyph_count; |
1335 |
|
207 |
UINT read_offset = 0; |
1336 |
|
|
|
1337 |
|
|
/* Read font header. */ |
1338 |
|
207 |
status = _gx_binres_font_header_load(info, &font_header); |
1339 |
|
|
|
1340 |
✗✓ |
207 |
if (status != GX_SUCCESS) |
1341 |
|
|
{ |
1342 |
|
|
return status; |
1343 |
|
|
} |
1344 |
|
|
|
1345 |
✓✓ |
207 |
if (font_header.gx_font_header_deault) |
1346 |
|
|
{ |
1347 |
✓✓✓✓
|
51 |
switch (font_header.gx_font_header_bits) |
1348 |
|
|
{ |
1349 |
|
19 |
case 1: |
1350 |
|
19 |
head_page = (GX_FONT *)&_gx_system_font_mono; |
1351 |
|
19 |
break; |
1352 |
|
|
|
1353 |
|
2 |
case 4: |
1354 |
|
2 |
head_page = (GX_FONT *)&_gx_system_font_4bpp; |
1355 |
|
2 |
break; |
1356 |
|
|
|
1357 |
|
29 |
case 8: |
1358 |
|
29 |
head_page = (GX_FONT *)&_gx_system_font_8bpp; |
1359 |
|
29 |
break; |
1360 |
|
|
} |
1361 |
|
|
} |
1362 |
|
|
else |
1363 |
|
|
{ |
1364 |
✓✓ |
156 |
if (font_header.gx_font_header_data_offset) |
1365 |
|
|
{ |
1366 |
|
|
/* The font data is not follow the header directly, |
1367 |
|
|
the data offset gives the position where the font |
1368 |
|
|
data located. */ |
1369 |
|
|
|
1370 |
|
|
/* Record current data offset. */ |
1371 |
|
129 |
read_offset = info -> gx_binres_read_offset; |
1372 |
|
|
|
1373 |
|
|
/* Temporarily reset data offset to access font data. */ |
1374 |
|
129 |
info -> gx_binres_read_offset = font_header.gx_font_header_data_offset; |
1375 |
|
|
|
1376 |
|
|
/* Read font header. */ |
1377 |
|
129 |
_gx_binres_font_header_load(info, &font_header); |
1378 |
|
|
} |
1379 |
|
|
|
1380 |
✓✓ |
503 |
for (index = 0; index < font_header.gx_font_header_page_count; index++) |
1381 |
|
|
{ |
1382 |
|
|
/* Read page header. */ |
1383 |
|
353 |
status = _gx_binres_page_header_load(info, &header); |
1384 |
|
|
|
1385 |
✗✓ |
353 |
if (status != GX_SUCCESS) |
1386 |
|
|
{ |
1387 |
|
|
return status; |
1388 |
|
|
} |
1389 |
|
|
|
1390 |
|
353 |
font = (GX_FONT *)(info -> gx_binres_buffer + info -> gx_binres_buffer_index); |
1391 |
|
353 |
info -> gx_binres_buffer_index += sizeof(GX_FONT); |
1392 |
|
|
|
1393 |
|
353 |
font -> gx_font_baseline = header.gx_page_header_baseline; |
1394 |
|
353 |
font -> gx_font_first_glyph = header.gx_page_header_first_glyph; |
1395 |
|
353 |
font -> gx_font_format = header.gx_page_header_format; |
1396 |
|
353 |
font -> gx_font_last_glyph = header.gx_page_header_last_glyph; |
1397 |
|
353 |
font -> gx_font_line_height = header.gx_page_header_line_height; |
1398 |
|
353 |
font -> gx_font_postspace = header.gx_page_header_postspace; |
1399 |
|
353 |
font -> gx_font_prespace = header.gx_page_header_prespace; |
1400 |
|
|
|
1401 |
|
|
/* Read glyphs data. */ |
1402 |
|
353 |
glyph_count = (USHORT)(font -> gx_font_last_glyph - font -> gx_font_first_glyph + 1); |
1403 |
|
|
|
1404 |
✓✓ |
353 |
if (font -> gx_font_format & GX_FONT_FORMAT_COMPRESSED) |
1405 |
|
|
{ |
1406 |
|
7 |
status = _gx_binres_compressed_glyphs_address_get(info, glyph_count, &font -> gx_font_glyphs.gx_font_compressed_glyphs); |
1407 |
|
|
} |
1408 |
|
|
#if defined(GX_FONT_KERNING_SUPPORT) |
1409 |
|
|
else if (font -> gx_font_format & GX_FONT_FORMAT_KERNING) |
1410 |
|
|
{ |
1411 |
|
|
status = _gx_binres_kerning_glyphs_address_get(info, glyph_count, &font -> gx_font_glyphs.gx_font_kerning_glyphs); |
1412 |
|
|
} |
1413 |
|
|
#endif /* GX_FONT_KERNING_SUPPORT */ |
1414 |
|
|
else |
1415 |
|
|
{ |
1416 |
|
346 |
status = _gx_binres_glyphs_address_get(info, glyph_count, &font -> gx_font_glyphs.gx_font_normal_glyphs); |
1417 |
|
|
} |
1418 |
|
|
|
1419 |
✓✓ |
353 |
if (status != GX_SUCCESS) |
1420 |
|
|
{ |
1421 |
|
6 |
break; |
1422 |
|
|
} |
1423 |
|
|
|
1424 |
|
347 |
font -> gx_font_next_page = NULL; |
1425 |
|
|
|
1426 |
✓✓ |
347 |
if (!head_page) |
1427 |
|
|
{ |
1428 |
|
150 |
head_page = font; |
1429 |
|
|
} |
1430 |
|
|
|
1431 |
✓✓ |
347 |
if (pre_page) |
1432 |
|
|
{ |
1433 |
|
197 |
pre_page -> gx_font_next_page = font; |
1434 |
|
|
} |
1435 |
|
|
|
1436 |
|
347 |
pre_page = font; |
1437 |
|
|
} |
1438 |
|
|
} |
1439 |
|
|
|
1440 |
✓✓ |
207 |
if (read_offset) |
1441 |
|
|
{ |
1442 |
|
|
/* Restore data offset. */ |
1443 |
|
129 |
info -> gx_binres_read_offset = read_offset; |
1444 |
|
129 |
read_offset = 0; |
1445 |
|
|
} |
1446 |
|
|
|
1447 |
✓✓ |
207 |
if (return_font) |
1448 |
|
|
{ |
1449 |
|
204 |
*return_font = head_page; |
1450 |
|
|
} |
1451 |
|
|
|
1452 |
|
207 |
return status; |
1453 |
|
|
} |
1454 |
|
|
#endif |
1455 |
|
|
/**************************************************************************/ |
1456 |
|
|
/* */ |
1457 |
|
|
/* FUNCTION RELEASE */ |
1458 |
|
|
/* */ |
1459 |
|
|
/* _gx_binres_color_table_load PORTABLE C */ |
1460 |
|
|
/* 6.1 */ |
1461 |
|
|
/* AUTHOR */ |
1462 |
|
|
/* */ |
1463 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1464 |
|
|
/* */ |
1465 |
|
|
/* DESCRIPTION */ |
1466 |
|
|
/* */ |
1467 |
|
|
/* This function loads a color table from a binary data buffer. */ |
1468 |
|
|
/* */ |
1469 |
|
|
/* INPUT */ |
1470 |
|
|
/* */ |
1471 |
|
|
/* info Binary resource control block */ |
1472 |
|
|
/* color_count The number of colors to read */ |
1473 |
|
|
/* returned_color_table Returned color table */ |
1474 |
|
|
/* */ |
1475 |
|
|
/* OUTPUT */ |
1476 |
|
|
/* */ |
1477 |
|
|
/* Status Completion status */ |
1478 |
|
|
/* */ |
1479 |
|
|
/* CALLS */ |
1480 |
|
|
/* */ |
1481 |
|
|
/* _gx_binres_color_header_load Read color data header */ |
1482 |
|
|
/* */ |
1483 |
|
|
/* CALLED BY */ |
1484 |
|
|
/* */ |
1485 |
|
|
/* GUIX Internal Code */ |
1486 |
|
|
/* */ |
1487 |
|
|
/* RELEASE HISTORY */ |
1488 |
|
|
/* */ |
1489 |
|
|
/* DATE NAME DESCRIPTION */ |
1490 |
|
|
/* */ |
1491 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
1492 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
1493 |
|
|
/* resulting in version 6.1 */ |
1494 |
|
|
/* */ |
1495 |
|
|
/**************************************************************************/ |
1496 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
1497 |
|
40 |
static UINT _gx_binres_color_table_load(GX_BINRES_DATA_INFO *info, USHORT color_count, GX_COLOR **returned_color_table) |
1498 |
|
|
{ |
1499 |
|
|
GX_COLOR_HEADER header; |
1500 |
|
40 |
GX_COLOR *color_table = GX_NULL; |
1501 |
|
|
|
1502 |
✓✓ |
40 |
if (!color_count) |
1503 |
|
|
{ |
1504 |
|
7 |
return GX_SUCCESS; |
1505 |
|
|
} |
1506 |
|
|
|
1507 |
|
|
/* Read color table header. */ |
1508 |
|
33 |
_gx_binres_color_header_load(info, &header); |
1509 |
|
|
|
1510 |
✓✓ |
33 |
if (header.gx_color_header_magic_number != GX_MAGIC_NUMBER) |
1511 |
|
|
{ |
1512 |
|
1 |
return GX_INVALID_FORMAT; |
1513 |
|
|
} |
1514 |
|
|
|
1515 |
|
32 |
color_table = (GX_COLOR *)(info -> gx_binres_root_address + info -> gx_binres_read_offset); |
1516 |
|
32 |
info -> gx_binres_read_offset += header.gx_color_header_data_size; |
1517 |
|
|
|
1518 |
|
32 |
*returned_color_table = color_table; |
1519 |
|
|
|
1520 |
|
32 |
return GX_SUCCESS; |
1521 |
|
|
} |
1522 |
|
|
#endif |
1523 |
|
|
|
1524 |
|
|
/**************************************************************************/ |
1525 |
|
|
/* */ |
1526 |
|
|
/* FUNCTION RELEASE */ |
1527 |
|
|
/* */ |
1528 |
|
|
/* _gx_binres_palette_table_load PORTABLE C */ |
1529 |
|
|
/* 6.1 */ |
1530 |
|
|
/* AUTHOR */ |
1531 |
|
|
/* */ |
1532 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1533 |
|
|
/* */ |
1534 |
|
|
/* DESCRIPTION */ |
1535 |
|
|
/* */ |
1536 |
|
|
/* This function loads a palette table from a binary data buffer. */ |
1537 |
|
|
/* */ |
1538 |
|
|
/* INPUT */ |
1539 |
|
|
/* */ |
1540 |
|
|
/* info Binary resource control block */ |
1541 |
|
|
/* color_count The number of colors to read */ |
1542 |
|
|
/* returned_palette_table Returned palette table */ |
1543 |
|
|
/* */ |
1544 |
|
|
/* OUTPUT */ |
1545 |
|
|
/* */ |
1546 |
|
|
/* Status Completion status */ |
1547 |
|
|
/* */ |
1548 |
|
|
/* CALLS */ |
1549 |
|
|
/* */ |
1550 |
|
|
/* _gx_binres_palette_header_load Read palette data header */ |
1551 |
|
|
/* */ |
1552 |
|
|
/* CALLED BY */ |
1553 |
|
|
/* */ |
1554 |
|
|
/* GUIX Internal Code */ |
1555 |
|
|
/* */ |
1556 |
|
|
/* RELEASE HISTORY */ |
1557 |
|
|
/* */ |
1558 |
|
|
/* DATE NAME DESCRIPTION */ |
1559 |
|
|
/* */ |
1560 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
1561 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
1562 |
|
|
/* resulting in version 6.1 */ |
1563 |
|
|
/* */ |
1564 |
|
|
/**************************************************************************/ |
1565 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
1566 |
|
11 |
static UINT _gx_binres_palette_table_load(GX_BINRES_DATA_INFO *info, USHORT color_count, GX_COLOR **returned_palette_table) |
1567 |
|
|
{ |
1568 |
|
|
GX_PALETTE_HEADER header; |
1569 |
|
11 |
GX_COLOR *palette_table = GX_NULL; |
1570 |
|
|
|
1571 |
✓✓ |
11 |
if (!color_count) |
1572 |
|
|
{ |
1573 |
|
1 |
return GX_SUCCESS; |
1574 |
|
|
} |
1575 |
|
|
|
1576 |
|
|
/* Read palette table header. */ |
1577 |
|
10 |
_gx_binres_palette_header_load(info, &header); |
1578 |
|
|
|
1579 |
✓✓ |
10 |
if (header.gx_palette_header_magic_number != GX_MAGIC_NUMBER) |
1580 |
|
|
{ |
1581 |
|
1 |
return GX_INVALID_FORMAT; |
1582 |
|
|
} |
1583 |
|
|
|
1584 |
|
9 |
palette_table = (GX_COLOR *)(info -> gx_binres_root_address + info -> gx_binres_read_offset); |
1585 |
|
9 |
info -> gx_binres_read_offset += header.gx_palette_header_data_size; |
1586 |
|
|
|
1587 |
|
9 |
*returned_palette_table = palette_table; |
1588 |
|
|
|
1589 |
|
9 |
return GX_SUCCESS; |
1590 |
|
|
} |
1591 |
|
|
#endif |
1592 |
|
|
|
1593 |
|
|
/**************************************************************************/ |
1594 |
|
|
/* */ |
1595 |
|
|
/* FUNCTION RELEASE */ |
1596 |
|
|
/* */ |
1597 |
|
|
/* _gx_binres_font_table_load PORTABLE C */ |
1598 |
|
|
/* 6.3.0 */ |
1599 |
|
|
/* AUTHOR */ |
1600 |
|
|
/* */ |
1601 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1602 |
|
|
/* */ |
1603 |
|
|
/* DESCRIPTION */ |
1604 |
|
|
/* */ |
1605 |
|
|
/* This function loads a font table from resource data memory. */ |
1606 |
|
|
/* */ |
1607 |
|
|
/* INPUT */ |
1608 |
|
|
/* */ |
1609 |
|
|
/* info Binary resource control block */ |
1610 |
|
|
/* table_size Font table size */ |
1611 |
|
|
/* returned_font_table Returned font table */ |
1612 |
|
|
/* */ |
1613 |
|
|
/* OUTPUT */ |
1614 |
|
|
/* */ |
1615 |
|
|
/* Status Completion status */ |
1616 |
|
|
/* */ |
1617 |
|
|
/* CALLS */ |
1618 |
|
|
/* */ |
1619 |
|
|
/* _gx_binres_one_font_load Load one font */ |
1620 |
|
|
/* */ |
1621 |
|
|
/* CALLED BY */ |
1622 |
|
|
/* */ |
1623 |
|
|
/* GUIX Internal Code */ |
1624 |
|
|
/* */ |
1625 |
|
|
/* RELEASE HISTORY */ |
1626 |
|
|
/* */ |
1627 |
|
|
/* DATE NAME DESCRIPTION */ |
1628 |
|
|
/* */ |
1629 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
1630 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
1631 |
|
|
/* resulting in version 6.1 */ |
1632 |
|
|
/* 10-31-2023 Ting Zhu Modified comment(s), */ |
1633 |
|
|
/* improved logic, */ |
1634 |
|
|
/* resulting in version 6.3.0 */ |
1635 |
|
|
/* */ |
1636 |
|
|
/**************************************************************************/ |
1637 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
1638 |
|
33 |
static UINT _gx_binres_font_table_load(GX_BINRES_DATA_INFO *info, USHORT table_size, GX_FONT ***returned_font_table) |
1639 |
|
|
{ |
1640 |
|
33 |
UINT status = GX_SUCCESS; |
1641 |
|
33 |
GX_FONT **font_table = GX_NULL; |
1642 |
|
|
USHORT index; |
1643 |
|
|
|
1644 |
|
33 |
font_table = (GX_FONT **)(info -> gx_binres_buffer + info -> gx_binres_buffer_index); |
1645 |
|
33 |
info -> gx_binres_buffer_index += sizeof(GX_FONT *) * table_size; |
1646 |
|
|
|
1647 |
✓✓ |
231 |
for (index = 0; index < table_size; index++) |
1648 |
|
|
{ |
1649 |
|
204 |
status = _gx_binres_one_font_load(info, &font_table[index]); |
1650 |
|
|
|
1651 |
✓✓ |
204 |
if (status != GX_SUCCESS) |
1652 |
|
|
{ |
1653 |
|
6 |
return status; |
1654 |
|
|
} |
1655 |
|
|
} |
1656 |
|
|
|
1657 |
|
27 |
*returned_font_table = font_table; |
1658 |
|
|
|
1659 |
|
27 |
return status; |
1660 |
|
|
} |
1661 |
|
|
#endif |
1662 |
|
|
|
1663 |
|
|
/**************************************************************************/ |
1664 |
|
|
/* */ |
1665 |
|
|
/* FUNCTION RELEASE */ |
1666 |
|
|
/* */ |
1667 |
|
|
/* _gx_binres_one_pixelmap_load PORTABLE C */ |
1668 |
|
|
/* 6.3.0 */ |
1669 |
|
|
/* AUTHOR */ |
1670 |
|
|
/* */ |
1671 |
|
|
/* Ting Zhu, Microsoft Corporation */ |
1672 |
|
|
/* */ |
1673 |
|
|
/* DESCRIPTION */ |
1674 |
|
|
/* */ |
1675 |
|
|
/* This function loads one pixelmap from resource data memory. */ |
1676 |
|
|
/* */ |
1677 |
|
|
/* INPUT */ |
1678 |
|
|
/* */ |
1679 |
|
|
/* info Binary resource control block */ |
1680 |
|
|
/* returned_pixelmap Returned pixelmap table */ |
1681 |
|
|
/* map_id Loaded pixelmap ID */ |
1682 |
|
|
/* */ |
1683 |
|
|
/* OUTPUT */ |
1684 |
|
|
/* */ |
1685 |
|
|
/* Status Completion status */ |
1686 |
|
|
/* */ |
1687 |
|
|
/* CALLS */ |
1688 |
|
|
/* */ |
1689 |
|
|
/* _gx_binres_pixelmap_header_load Read pixelmap header */ |
1690 |
|
|
/* */ |
1691 |
|
|
/* CALLED BY */ |
1692 |
|
|
/* */ |
1693 |
|
|
/* GUIX Internal Code */ |
1694 |
|
|
/* */ |
1695 |
|
|
/* RELEASE HISTORY */ |
1696 |
|
|
/* */ |
1697 |
|
|
/* DATE NAME DESCRIPTION */ |
1698 |
|
|
/* */ |
1699 |
|
|
/* 10-31-2023 Ting Zhu Initial Version 6.3.0 */ |
1700 |
|
|
/* */ |
1701 |
|
|
/**************************************************************************/ |
1702 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
1703 |
|
851 |
UINT _gx_binres_one_pixelmap_load(GX_BINRES_DATA_INFO *info, GX_PIXELMAP **returned_pixelmap, USHORT *map_id) |
1704 |
|
|
{ |
1705 |
|
851 |
UINT status = GX_SUCCESS; |
1706 |
|
|
GX_PIXELMAP_HEADER header; |
1707 |
|
|
ULONG size; |
1708 |
|
851 |
UINT read_offset = 0; |
1709 |
|
|
|
1710 |
|
|
GX_PIXELMAP *pixelmap; |
1711 |
|
|
|
1712 |
|
|
/* Read pixelmap header. */ |
1713 |
|
851 |
status = _gx_binres_pixelmap_header_load(info, &header); |
1714 |
|
|
|
1715 |
✓✓ |
851 |
if (status) |
1716 |
|
|
{ |
1717 |
|
3 |
return status; |
1718 |
|
|
} |
1719 |
|
|
|
1720 |
✓✓ |
848 |
if (header.gx_pixelmap_header_data_offset) |
1721 |
|
|
{ |
1722 |
|
|
/* The pixelmap data is not follow the header directly, |
1723 |
|
|
the data offset gives the position where the pixelmap |
1724 |
|
|
data located. */ |
1725 |
|
|
|
1726 |
|
|
/* Record current data offset. */ |
1727 |
|
527 |
read_offset = info -> gx_binres_read_offset; |
1728 |
|
|
|
1729 |
|
|
/* Temporarily reset data offset to access pixelmap data. */ |
1730 |
|
527 |
info -> gx_binres_read_offset = header.gx_pixelmap_header_data_offset; |
1731 |
|
|
|
1732 |
|
|
/* Read pixelmap header. */ |
1733 |
|
527 |
_gx_binres_pixelmap_header_load(info, &header); |
1734 |
|
|
} |
1735 |
|
|
|
1736 |
|
|
/* Allocate memory for pixelmap. */ |
1737 |
|
848 |
pixelmap = (GX_PIXELMAP *)(info -> gx_binres_buffer + info -> gx_binres_buffer_index); |
1738 |
|
848 |
info -> gx_binres_buffer_index += sizeof(GX_PIXELMAP); |
1739 |
|
|
|
1740 |
|
848 |
pixelmap -> gx_pixelmap_aux_data_size = header.gx_pixelmap_header_aux_data_size; |
1741 |
|
848 |
pixelmap -> gx_pixelmap_data_size = header.gx_pixelmap_header_map_size; |
1742 |
|
848 |
pixelmap -> gx_pixelmap_flags = header.gx_pixelmap_header_flags; |
1743 |
|
848 |
pixelmap -> gx_pixelmap_format = header.gx_pixelmap_header_format; |
1744 |
|
848 |
pixelmap -> gx_pixelmap_width = (GX_VALUE)header.gx_pixelmap_header_width; |
1745 |
|
848 |
pixelmap -> gx_pixelmap_height = (GX_VALUE)header.gx_pixelmap_header_height; |
1746 |
|
848 |
pixelmap -> gx_pixelmap_transparent_color = header.gx_pixelmap_header_transparent_color; |
1747 |
|
848 |
pixelmap -> gx_pixelmap_version_major = header.gx_pixelmap_header_version_major; |
1748 |
|
848 |
pixelmap -> gx_pixelmap_version_minor = header.gx_pixelmap_header_version_minor; |
1749 |
|
|
|
1750 |
|
|
/* Skip padding bytes. */ |
1751 |
|
848 |
info -> gx_binres_read_offset = (info -> gx_binres_read_offset + 3) & (~0x03UL); |
1752 |
|
|
|
1753 |
|
|
/* Read pixelmap data. */ |
1754 |
|
848 |
size = pixelmap -> gx_pixelmap_data_size; |
1755 |
✓✓ |
848 |
if (size) |
1756 |
|
|
{ |
1757 |
|
847 |
pixelmap -> gx_pixelmap_data = (GX_UBYTE *)(info -> gx_binres_root_address + info -> gx_binres_read_offset); |
1758 |
|
847 |
info -> gx_binres_read_offset += size; |
1759 |
|
|
} |
1760 |
|
|
|
1761 |
|
|
/* Read pixelmap aux data. */ |
1762 |
|
848 |
size = pixelmap -> gx_pixelmap_aux_data_size; |
1763 |
✓✓ |
848 |
if (size) |
1764 |
|
|
{ |
1765 |
|
178 |
pixelmap -> gx_pixelmap_aux_data = (GX_UBYTE *)(info -> gx_binres_root_address + info -> gx_binres_read_offset); |
1766 |
|
178 |
info -> gx_binres_read_offset += size; |
1767 |
|
|
} |
1768 |
|
|
|
1769 |
✓✓ |
848 |
if (read_offset) |
1770 |
|
|
{ |
1771 |
|
|
/* Restore data offset. */ |
1772 |
|
527 |
info -> gx_binres_read_offset = read_offset; |
1773 |
|
527 |
read_offset = 0; |
1774 |
|
|
} |
1775 |
|
|
|
1776 |
✓✓ |
848 |
if (returned_pixelmap) |
1777 |
|
|
{ |
1778 |
|
832 |
*returned_pixelmap = pixelmap; |
1779 |
|
|
} |
1780 |
|
|
|
1781 |
✓✓ |
848 |
if (map_id) |
1782 |
|
|
{ |
1783 |
|
832 |
*map_id = header.gx_pixelmap_header_index; |
1784 |
|
|
} |
1785 |
|
|
|
1786 |
|
848 |
return status; |
1787 |
|
|
} |
1788 |
|
|
|
1789 |
|
|
|
1790 |
|
|
/**************************************************************************/ |
1791 |
|
|
/* */ |
1792 |
|
|
/* FUNCTION RELEASE */ |
1793 |
|
|
/* */ |
1794 |
|
|
/* _gx_binres_pixelmap_table_load PORTABLE C */ |
1795 |
|
|
/* 6.3.0 */ |
1796 |
|
|
/* AUTHOR */ |
1797 |
|
|
/* */ |
1798 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1799 |
|
|
/* */ |
1800 |
|
|
/* DESCRIPTION */ |
1801 |
|
|
/* */ |
1802 |
|
|
/* This function loads a pixelmap table from resource data memory. */ |
1803 |
|
|
/* */ |
1804 |
|
|
/* INPUT */ |
1805 |
|
|
/* */ |
1806 |
|
|
/* info Binary resource control block */ |
1807 |
|
|
/* table_size Pixelmap table size */ |
1808 |
|
|
/* returned_pixelmp_table Returned pixelmap table */ |
1809 |
|
|
/* */ |
1810 |
|
|
/* OUTPUT */ |
1811 |
|
|
/* */ |
1812 |
|
|
/* Status Completion status */ |
1813 |
|
|
/* */ |
1814 |
|
|
/* CALLS */ |
1815 |
|
|
/* */ |
1816 |
|
|
/* _gx_binres_one_pixelmap_load Load one pixelmap */ |
1817 |
|
|
/* */ |
1818 |
|
|
/* CALLED BY */ |
1819 |
|
|
/* */ |
1820 |
|
|
/* GUIX Internal Code */ |
1821 |
|
|
/* */ |
1822 |
|
|
/* RELEASE HISTORY */ |
1823 |
|
|
/* */ |
1824 |
|
|
/* DATE NAME DESCRIPTION */ |
1825 |
|
|
/* */ |
1826 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
1827 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
1828 |
|
|
/* resulting in version 6.1 */ |
1829 |
|
|
/* 10-31-2023 Ting Zhu Modified comment(s), */ |
1830 |
|
|
/* improved logic, */ |
1831 |
|
|
/* resulting in version 6.3.0 */ |
1832 |
|
|
/* */ |
1833 |
|
|
/**************************************************************************/ |
1834 |
|
30 |
static UINT _gx_binres_pixelmap_table_load(GX_BINRES_DATA_INFO *info, USHORT table_size, GX_PIXELMAP **pixelmap_table) |
1835 |
|
|
{ |
1836 |
|
30 |
UINT status = GX_SUCCESS; |
1837 |
|
|
USHORT index; |
1838 |
|
|
USHORT map_id; |
1839 |
|
|
GX_PIXELMAP *pixelmap; |
1840 |
|
|
|
1841 |
✓✓ |
862 |
for (index = 1; index < table_size; index++) |
1842 |
|
|
{ |
1843 |
|
835 |
status = _gx_binres_one_pixelmap_load(info, &pixelmap, &map_id); |
1844 |
|
|
|
1845 |
✓✓ |
847 |
while (index < map_id) |
1846 |
|
|
{ |
1847 |
|
12 |
pixelmap_table[index++] = GX_NULL; |
1848 |
|
|
} |
1849 |
|
|
|
1850 |
|
835 |
pixelmap_table[index] = pixelmap; |
1851 |
|
|
|
1852 |
✓✓ |
835 |
if (status) |
1853 |
|
|
{ |
1854 |
|
3 |
return status; |
1855 |
|
|
} |
1856 |
|
|
} |
1857 |
|
|
|
1858 |
|
27 |
return status; |
1859 |
|
|
} |
1860 |
|
|
#endif |
1861 |
|
|
|
1862 |
|
|
/**************************************************************************/ |
1863 |
|
|
/* */ |
1864 |
|
|
/* FUNCTION RELEASE */ |
1865 |
|
|
/* */ |
1866 |
|
|
/* _gx_binres_theme_load PORTABLE C */ |
1867 |
|
|
/* 6.1 */ |
1868 |
|
|
/* AUTHOR */ |
1869 |
|
|
/* */ |
1870 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
1871 |
|
|
/* */ |
1872 |
|
|
/* DESCRIPTION */ |
1873 |
|
|
/* */ |
1874 |
|
|
/* This service loads a theme table from a resource data memory. */ |
1875 |
|
|
/* */ |
1876 |
|
|
/* INPUT */ |
1877 |
|
|
/* */ |
1878 |
|
|
/* root_address Root address of binary */ |
1879 |
|
|
/* resource data */ |
1880 |
|
|
/* theme_id The indentifier of the theme */ |
1881 |
|
|
/* returned_theme Pointer to loaded theme */ |
1882 |
|
|
/* */ |
1883 |
|
|
/* OUTPUT */ |
1884 |
|
|
/* */ |
1885 |
|
|
/* Status Completion status */ |
1886 |
|
|
/* */ |
1887 |
|
|
/* CALLS */ |
1888 |
|
|
/* */ |
1889 |
|
|
/* _gx_binres_theme_buffer_allocate Allocate needed buffer for */ |
1890 |
|
|
/* loading theme table */ |
1891 |
|
|
/* _gx_binres_resource_header_load Read resource header */ |
1892 |
|
|
/* _gx_binres_theme_header_load Read theme header */ |
1893 |
|
|
/* _gx_binres_color_table_load Load color table */ |
1894 |
|
|
/* _gx_binres_palette_table_load Load palette table */ |
1895 |
|
|
/* _gx_binres_font_table_load Load font table */ |
1896 |
|
|
/* _gx_binres_pixelmap_table_load Load pixelmap table */ |
1897 |
|
|
/* _gx_system_memory_free Memory free function */ |
1898 |
|
|
/* */ |
1899 |
|
|
/* CALLED BY */ |
1900 |
|
|
/* */ |
1901 |
|
|
/* Application Code */ |
1902 |
|
|
/* */ |
1903 |
|
|
/* RELEASE HISTORY */ |
1904 |
|
|
/* */ |
1905 |
|
|
/* DATE NAME DESCRIPTION */ |
1906 |
|
|
/* */ |
1907 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
1908 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
1909 |
|
|
/* resulting in version 6.1 */ |
1910 |
|
|
/* */ |
1911 |
|
|
/**************************************************************************/ |
1912 |
|
|
#ifdef GX_BINARY_RESOURCE_SUPPORT |
1913 |
|
50 |
UINT _gx_binres_theme_load(GX_UBYTE *root_address, INT theme_id, GX_THEME **returned_theme) |
1914 |
|
|
{ |
1915 |
|
|
UINT status; |
1916 |
|
|
GX_BINRES_DATA_INFO info; |
1917 |
|
|
GX_RESOURCE_HEADER header; |
1918 |
|
|
GX_THEME_HEADER theme_header; |
1919 |
|
|
GX_THEME *theme; |
1920 |
|
|
INT index; |
1921 |
|
|
|
1922 |
|
50 |
memset(&info, 0, sizeof(GX_BINRES_DATA_INFO)); |
1923 |
|
50 |
memset(&theme_header, 0, sizeof(GX_THEME_HEADER)); |
1924 |
|
|
|
1925 |
|
50 |
info.gx_binres_root_address = (GX_UBYTE *)root_address; |
1926 |
|
|
|
1927 |
|
|
/* Allocate memory that needed for theme table. */ |
1928 |
|
50 |
status = _gx_binres_theme_buffer_allocate(&info, theme_id); |
1929 |
|
|
|
1930 |
|
|
/* Read binary resource header. */ |
1931 |
|
|
|
1932 |
✓✓ |
50 |
if (status == GX_SUCCESS) |
1933 |
|
|
{ |
1934 |
|
40 |
status = _gx_binres_resource_header_load(&info, &header); |
1935 |
|
|
} |
1936 |
|
|
|
1937 |
|
|
/* Read theme table. */ |
1938 |
✓✓ |
50 |
if (status == GX_SUCCESS) |
1939 |
|
|
{ |
1940 |
|
40 |
for (index = 0;; index++) |
1941 |
|
|
{ |
1942 |
|
|
|
1943 |
|
|
/* Read theme header. */ |
1944 |
|
59 |
_gx_binres_theme_header_load(&info, &theme_header); |
1945 |
|
|
|
1946 |
✓✓ |
59 |
if (index == theme_id) |
1947 |
|
|
{ |
1948 |
|
40 |
theme = (GX_THEME *)(info.gx_binres_buffer + info.gx_binres_buffer_index); |
1949 |
|
40 |
info.gx_binres_buffer_index += sizeof(GX_THEME); |
1950 |
|
|
|
1951 |
|
40 |
theme -> theme_color_table_size = theme_header.gx_theme_header_color_count; |
1952 |
|
40 |
theme -> theme_palette_size = theme_header.gx_theme_header_palette_count; |
1953 |
|
40 |
theme -> theme_font_table_size = theme_header.gx_theme_header_font_count; |
1954 |
|
40 |
theme -> theme_pixelmap_table_size = (USHORT)(theme_header.gx_theme_header_pixelmap_count + 1); |
1955 |
|
40 |
theme -> theme_vertical_scrollbar_appearance = theme_header.gx_theme_header_vscroll_appearance; |
1956 |
|
40 |
theme -> theme_horizontal_scrollbar_appearance = theme_header.gx_theme_header_hscroll_appearance; |
1957 |
|
40 |
theme -> theme_vertical_scroll_style = theme_header.gx_theme_header_hscroll_style; |
1958 |
|
40 |
theme -> theme_horizontal_scroll_style = theme_header.gx_theme_header_hscroll_style; |
1959 |
|
|
|
1960 |
|
|
/* Read color table. */ |
1961 |
|
40 |
status = _gx_binres_color_table_load(&info, |
1962 |
|
40 |
theme_header.gx_theme_header_color_count, |
1963 |
|
|
&theme -> theme_color_table); |
1964 |
|
|
|
1965 |
|
|
/* Read palette table. */ |
1966 |
✓✓✓✓
|
40 |
if ((status == GX_SUCCESS) && theme_header.gx_theme_header_palette_data_size) |
1967 |
|
|
{ |
1968 |
|
11 |
status = _gx_binres_palette_table_load(&info, |
1969 |
|
11 |
theme_header.gx_theme_header_palette_count, |
1970 |
|
|
&theme -> theme_palette); |
1971 |
|
|
} |
1972 |
|
|
|
1973 |
|
|
/* Read font table. */ |
1974 |
✓✓✓✓ ✓✓ |
40 |
if ((status == GX_SUCCESS) && theme_header.gx_theme_header_font_data_size && theme_header.gx_theme_header_font_count) |
1975 |
|
|
{ |
1976 |
|
33 |
status = _gx_binres_font_table_load(&info, |
1977 |
|
33 |
theme_header.gx_theme_header_font_count, |
1978 |
|
|
&theme -> theme_font_table); |
1979 |
|
|
} |
1980 |
|
|
|
1981 |
|
|
/* Read pixelmap table. */ |
1982 |
✓✓✓✓ ✓✓ |
40 |
if ((status == GX_SUCCESS) && theme_header.gx_theme_header_pixelmap_data_size && theme_header.gx_theme_header_pixelmap_count) |
1983 |
|
|
{ |
1984 |
|
|
/* Allocate pixelmap table size. */ |
1985 |
|
30 |
theme -> theme_pixelmap_table = (GX_PIXELMAP **)(info.gx_binres_buffer + info.gx_binres_buffer_index); |
1986 |
|
30 |
info.gx_binres_buffer_index += sizeof(GX_PIXELMAP *) * (UINT)(theme_header.gx_theme_header_pixelmap_count + 1); |
1987 |
|
|
|
1988 |
|
|
/* Load pixelmap table. */ |
1989 |
|
30 |
status = _gx_binres_pixelmap_table_load(&info, |
1990 |
|
30 |
theme -> theme_pixelmap_table_size, |
1991 |
|
|
theme -> theme_pixelmap_table); |
1992 |
|
|
} |
1993 |
|
|
|
1994 |
✓✓ |
40 |
if (status == GX_SUCCESS) |
1995 |
|
|
{ |
1996 |
|
29 |
*returned_theme = theme; |
1997 |
|
|
} |
1998 |
|
|
else |
1999 |
|
|
{ |
2000 |
|
|
/* Free allocated buffer if theme loading failed. */ |
2001 |
|
11 |
_gx_system_memory_free(info.gx_binres_buffer); |
2002 |
|
|
|
2003 |
|
11 |
*returned_theme = GX_NULL; |
2004 |
|
|
} |
2005 |
|
|
|
2006 |
|
40 |
break; |
2007 |
|
|
} |
2008 |
|
|
else |
2009 |
|
|
{ |
2010 |
|
19 |
info.gx_binres_read_offset += theme_header.gx_theme_header_data_size; |
2011 |
|
|
} |
2012 |
|
|
} |
2013 |
|
|
} |
2014 |
|
|
|
2015 |
|
50 |
return status; |
2016 |
|
|
} |
2017 |
|
|
#endif |
2018 |
|
|
|