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