OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftgloadr.c */ | 3 /* ftgloadr.c */ |
4 /* */ | 4 /* */ |
5 /* The FreeType glyph loader (body). */ | 5 /* The FreeType glyph loader (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2002, 2003, 2004, 2005, 2006, 2010 by */ | 7 /* Copyright 2002-2006, 2010, 2013 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 | 18 |
19 #include <ft2build.h> | 19 #include <ft2build.h> |
| 20 #include FT_INTERNAL_DEBUG_H |
20 #include FT_INTERNAL_GLYPH_LOADER_H | 21 #include FT_INTERNAL_GLYPH_LOADER_H |
21 #include FT_INTERNAL_MEMORY_H | 22 #include FT_INTERNAL_MEMORY_H |
22 #include FT_INTERNAL_OBJECTS_H | 23 #include FT_INTERNAL_OBJECTS_H |
23 | 24 |
24 #undef FT_COMPONENT | 25 #undef FT_COMPONENT |
25 #define FT_COMPONENT trace_gloader | 26 #define FT_COMPONENT trace_gloader |
26 | 27 |
27 | 28 |
28 /*************************************************************************/ | 29 /*************************************************************************/ |
29 /*************************************************************************/ | 30 /*************************************************************************/ |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 213 |
213 /* check points & tags */ | 214 /* check points & tags */ |
214 new_max = base->n_points + current->n_points + n_points; | 215 new_max = base->n_points + current->n_points + n_points; |
215 old_max = loader->max_points; | 216 old_max = loader->max_points; |
216 | 217 |
217 if ( new_max > old_max ) | 218 if ( new_max > old_max ) |
218 { | 219 { |
219 new_max = FT_PAD_CEIL( new_max, 8 ); | 220 new_max = FT_PAD_CEIL( new_max, 8 ); |
220 | 221 |
221 if ( new_max > FT_OUTLINE_POINTS_MAX ) | 222 if ( new_max > FT_OUTLINE_POINTS_MAX ) |
222 return FT_Err_Array_Too_Large; | 223 return FT_THROW( Array_Too_Large ); |
223 | 224 |
224 if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) || | 225 if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) || |
225 FT_RENEW_ARRAY( base->tags, old_max, new_max ) ) | 226 FT_RENEW_ARRAY( base->tags, old_max, new_max ) ) |
226 goto Exit; | 227 goto Exit; |
227 | 228 |
228 if ( loader->use_extra ) | 229 if ( loader->use_extra ) |
229 { | 230 { |
230 if ( FT_RENEW_ARRAY( loader->base.extra_points, | 231 if ( FT_RENEW_ARRAY( loader->base.extra_points, |
231 old_max * 2, new_max * 2 ) ) | 232 old_max * 2, new_max * 2 ) ) |
232 goto Exit; | 233 goto Exit; |
(...skipping 11 matching lines...) Expand all Loading... |
244 | 245 |
245 /* check contours */ | 246 /* check contours */ |
246 old_max = loader->max_contours; | 247 old_max = loader->max_contours; |
247 new_max = base->n_contours + current->n_contours + | 248 new_max = base->n_contours + current->n_contours + |
248 n_contours; | 249 n_contours; |
249 if ( new_max > old_max ) | 250 if ( new_max > old_max ) |
250 { | 251 { |
251 new_max = FT_PAD_CEIL( new_max, 4 ); | 252 new_max = FT_PAD_CEIL( new_max, 4 ); |
252 | 253 |
253 if ( new_max > FT_OUTLINE_CONTOURS_MAX ) | 254 if ( new_max > FT_OUTLINE_CONTOURS_MAX ) |
254 return FT_Err_Array_Too_Large; | 255 return FT_THROW( Array_Too_Large ); |
255 | 256 |
256 if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) ) | 257 if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) ) |
257 goto Exit; | 258 goto Exit; |
258 | 259 |
259 adjust = 1; | 260 adjust = 1; |
260 loader->max_contours = new_max; | 261 loader->max_contours = new_max; |
261 } | 262 } |
262 | 263 |
263 if ( adjust ) | 264 if ( adjust ) |
264 FT_GlyphLoader_Adjust_Points( loader ); | 265 FT_GlyphLoader_Adjust_Points( loader ); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 312 |
312 current->outline.n_points = 0; | 313 current->outline.n_points = 0; |
313 current->outline.n_contours = 0; | 314 current->outline.n_contours = 0; |
314 current->num_subglyphs = 0; | 315 current->num_subglyphs = 0; |
315 | 316 |
316 FT_GlyphLoader_Adjust_Points ( loader ); | 317 FT_GlyphLoader_Adjust_Points ( loader ); |
317 FT_GlyphLoader_Adjust_Subglyphs( loader ); | 318 FT_GlyphLoader_Adjust_Subglyphs( loader ); |
318 } | 319 } |
319 | 320 |
320 | 321 |
321 /* add current glyph to the base image - and prepare for another */ | 322 /* add current glyph to the base image -- and prepare for another */ |
322 FT_BASE_DEF( void ) | 323 FT_BASE_DEF( void ) |
323 FT_GlyphLoader_Add( FT_GlyphLoader loader ) | 324 FT_GlyphLoader_Add( FT_GlyphLoader loader ) |
324 { | 325 { |
325 FT_GlyphLoad base; | 326 FT_GlyphLoad base; |
326 FT_GlyphLoad current; | 327 FT_GlyphLoad current; |
327 | 328 |
328 FT_UInt n_curr_contours; | 329 FT_UInt n_curr_contours; |
329 FT_UInt n_base_points; | 330 FT_UInt n_base_points; |
330 FT_UInt n; | 331 FT_UInt n; |
331 | 332 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 out->n_contours = (short)num_contours; | 393 out->n_contours = (short)num_contours; |
393 | 394 |
394 FT_GlyphLoader_Adjust_Points( target ); | 395 FT_GlyphLoader_Adjust_Points( target ); |
395 } | 396 } |
396 | 397 |
397 return error; | 398 return error; |
398 } | 399 } |
399 | 400 |
400 | 401 |
401 /* END */ | 402 /* END */ |
OLD | NEW |