Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: src/pshinter/pshalgo.c

Issue 89753003: Update freetype to latest version of ASOP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src/third_party/freetype.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pshinter/pshalgo.h ('k') | src/pshinter/pshglob.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /***************************************************************************/ 1 /***************************************************************************/
2 /* */ 2 /* */
3 /* pshalgo.c */ 3 /* pshalgo.c */
4 /* */ 4 /* */
5 /* PostScript hinting algorithm (body). */ 5 /* PostScript hinting algorithm (body). */
6 /* */ 6 /* */
7 /* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 */ 7 /* Copyright 2001-2010, 2012, 2013 by */
8 /* by */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* */ 9 /* */
11 /* 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 */
12 /* modified and distributed under the terms of the FreeType project */ 11 /* modified and distributed under the terms of the FreeType project */
13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
14 /* this file you indicate that you have read the license and */ 13 /* this file you indicate that you have read the license and */
15 /* understand and accept it fully. */ 14 /* understand and accept it fully. */
16 /* */ 15 /* */
17 /***************************************************************************/ 16 /***************************************************************************/
18 17
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 394
396 395
397 #ifdef DEBUG_HINTER 396 #ifdef DEBUG_HINTER
398 397
399 static void 398 static void
400 ps_simple_scale( PSH_Hint_Table table, 399 ps_simple_scale( PSH_Hint_Table table,
401 FT_Fixed scale, 400 FT_Fixed scale,
402 FT_Fixed delta, 401 FT_Fixed delta,
403 FT_Int dimension ) 402 FT_Int dimension )
404 { 403 {
405 PSH_Hint hint; 404 FT_UInt count;
406 FT_UInt count;
407 405
408 406
409 for ( count = 0; count < table->max_hints; count++ ) 407 for ( count = 0; count < table->max_hints; count++ )
410 { 408 {
411 hint = table->hints + count; 409 PSH_Hint hint = table->hints + count;
410
412 411
413 hint->cur_pos = FT_MulFix( hint->org_pos, scale ) + delta; 412 hint->cur_pos = FT_MulFix( hint->org_pos, scale ) + delta;
414 hint->cur_len = FT_MulFix( hint->org_len, scale ); 413 hint->cur_len = FT_MulFix( hint->org_len, scale );
415 414
416 if ( ps_debug_hint_func ) 415 if ( ps_debug_hint_func )
417 ps_debug_hint_func( hint, dimension ); 416 ps_debug_hint_func( hint, dimension );
418 } 417 }
419 } 418 }
420 419
421 #endif /* DEBUG_HINTER */ 420 #endif /* DEBUG_HINTER */
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 * = FT_FLOOR(stem_center-32+32) 555 * = FT_FLOOR(stem_center-32+32)
557 * = FT_FLOOR(stem_center) 556 * = FT_FLOOR(stem_center)
558 * new_len = 64 557 * new_len = 64
559 */ 558 */
560 pos = FT_PIX_FLOOR( pos + ( len >> 1 ) ); 559 pos = FT_PIX_FLOOR( pos + ( len >> 1 ) );
561 len = 64; 560 len = 64;
562 } 561 }
563 else if ( len > 0 ) 562 else if ( len > 0 )
564 { 563 {
565 /* This is a very small stem; we simply align it to the 564 /* This is a very small stem; we simply align it to the
566 * pixel grid, trying to find the minimal displacement. 565 * pixel grid, trying to find the minimum displacement.
567 * 566 *
568 * left = pos 567 * left = pos
569 * right = pos + len 568 * right = pos + len
570 * left_nearest_edge = ROUND(pos) 569 * left_nearest_edge = ROUND(pos)
571 * right_nearest_edge = ROUND(right) 570 * right_nearest_edge = ROUND(right)
572 * 571 *
573 * if ( ABS(left_nearest_edge - left) <= 572 * if ( ABS(left_nearest_edge - left) <=
574 * ABS(right_nearest_edge - right) ) 573 * ABS(right_nearest_edge - right) )
575 * new_pos = left 574 * new_pos = left
576 * else 575 * else
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 1154
1156 1155
1157 static int 1156 static int
1158 psh_compute_dir( FT_Pos dx, 1157 psh_compute_dir( FT_Pos dx,
1159 FT_Pos dy ) 1158 FT_Pos dy )
1160 { 1159 {
1161 FT_Pos ax, ay; 1160 FT_Pos ax, ay;
1162 int result = PSH_DIR_NONE; 1161 int result = PSH_DIR_NONE;
1163 1162
1164 1163
1165 ax = ( dx >= 0 ) ? dx : -dx; 1164 ax = FT_ABS( dx );
1166 ay = ( dy >= 0 ) ? dy : -dy; 1165 ay = FT_ABS( dy );
1167 1166
1168 if ( ay * 12 < ax ) 1167 if ( ay * 12 < ax )
1169 { 1168 {
1170 /* |dy| <<< |dx| means a near-horizontal segment */ 1169 /* |dy| <<< |dx| means a near-horizontal segment */
1171 result = ( dx >= 0 ) ? PSH_DIR_RIGHT : PSH_DIR_LEFT; 1170 result = ( dx >= 0 ) ? PSH_DIR_RIGHT : PSH_DIR_LEFT;
1172 } 1171 }
1173 else if ( ax * 12 < ay ) 1172 else if ( ax * 12 < ay )
1174 { 1173 {
1175 /* |dx| <<< |dy| means a near-vertical segment */ 1174 /* |dx| <<< |dy| means a near-vertical segment */
1176 result = ( dy >= 0 ) ? PSH_DIR_UP : PSH_DIR_DOWN; 1175 result = ( dy >= 0 ) ? PSH_DIR_UP : PSH_DIR_DOWN;
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 PSH_Glyph glyph = &glyphrec; 2186 PSH_Glyph glyph = &glyphrec;
2188 FT_Error error; 2187 FT_Error error;
2189 #ifdef DEBUG_HINTER 2188 #ifdef DEBUG_HINTER
2190 FT_Memory memory; 2189 FT_Memory memory;
2191 #endif 2190 #endif
2192 FT_Int dimension; 2191 FT_Int dimension;
2193 2192
2194 2193
2195 /* something to do? */ 2194 /* something to do? */
2196 if ( outline->n_points == 0 || outline->n_contours == 0 ) 2195 if ( outline->n_points == 0 || outline->n_contours == 0 )
2197 return PSH_Err_Ok; 2196 return FT_Err_Ok;
2198 2197
2199 #ifdef DEBUG_HINTER 2198 #ifdef DEBUG_HINTER
2200 2199
2201 memory = globals->memory; 2200 memory = globals->memory;
2202 2201
2203 if ( ps_debug_glyph ) 2202 if ( ps_debug_glyph )
2204 { 2203 {
2205 psh_glyph_done( ps_debug_glyph ); 2204 psh_glyph_done( ps_debug_glyph );
2206 FT_FREE( ps_debug_glyph ); 2205 FT_FREE( ps_debug_glyph );
2207 } 2206 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 2296
2298 #ifndef DEBUG_HINTER 2297 #ifndef DEBUG_HINTER
2299 psh_glyph_done( glyph ); 2298 psh_glyph_done( glyph );
2300 #endif 2299 #endif
2301 2300
2302 return error; 2301 return error;
2303 } 2302 }
2304 2303
2305 2304
2306 /* END */ 2305 /* END */
OLDNEW
« no previous file with comments | « src/pshinter/pshalgo.h ('k') | src/pshinter/pshglob.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698