ref: 72a0dd247d80541041da5aacad7d5bcc0d9e52ba
parent: c0f9c4aaddcf0a4078e8ce87808ff94b7dba377d
author: David Turner <[email protected]>
date: Mon Feb 12 10:24:51 EST 2007
some simplifications of the TrueType interpreter projection code (preliminaries to various interpreter fixes)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2007-02-12 David Turner <[email protected]>
+ * src/truetype/ttinterp.h, src/truetype/ttinterp.c: simplify
+ projection and dual-projection code interface
+
* include/freetype/internal/ftmemory.h, src/base/ftutils.c,
src/bfd/bfddrivr.c, src/bdf/bdflib.c, src/pcf/pcfread.c,
src/cff/cffdrivr.c, src/cff/cffload.c, src/cff/cffobjs.c,
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -163,9 +163,6 @@
#define INS_Goto_CodeRange( range, ip ) \
Ins_Goto_CodeRange( EXEC_ARG_ range, ip )
-#define CUR_Func_project( x, y ) \
- CUR.func_project( EXEC_ARG_ x, y )
-
#define CUR_Func_move( z, p, d ) \
CUR.func_move( EXEC_ARG_ z, p, d )
@@ -172,9 +169,6 @@
#define CUR_Func_move_orig( z, p, d ) \
CUR.func_move_orig( EXEC_ARG_ z, p, d )
-#define CUR_Func_dualproj( x, y ) \
- CUR.func_dualproj( EXEC_ARG_ x, y )
-
#define CUR_Func_round( d, c ) \
CUR.func_round( EXEC_ARG_ d, c )
@@ -212,6 +206,19 @@
Move_Zp2_Point( EXEC_ARG_ a, b, c, t )
+# define CUR_Func_project( v1, v2 ) \
+ CUR.func_project( EXEC_ARG_ (v1)->x - (v2)->x, (v1)->y - (v2)->y )
+
+# define CUR_Func_dualproj( v1, v2 ) \
+ CUR.func_dualproj( EXEC_ARG_ (v1)->x - (v2)->x, (v1)->y - (v2)->y )
+
+# define CUR_fast_project(v) \
+ CUR.func_project( EXEC_ARG_ (v)->x, (v)->y )
+
+# define CUR_fast_dualproj(v) \
+ CUR.func_dualproj( EXEC_ARG_ (v)->x, (v)->y )
+
+
/*************************************************************************/
/* */
/* Instruction dispatch function, as used by the interpreter. */
@@ -2150,18 +2157,17 @@
/* The distance in F26dot6 format. */
/* */
static FT_F26Dot6
- Project( EXEC_OP_ FT_Vector* v1,
- FT_Vector* v2 )
- {
+ Project( EXEC_OP_ FT_Pos dx,
+ FT_Pos dy )
+{
#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
FT_ASSERT( !CUR.face->unpatented_hinting );
#endif
- return TT_DotFix14( v1->x - v2->x,
- v1->y - v2->y,
+ return TT_DotFix14( dx, dy,
CUR.GS.projVector.x,
CUR.GS.projVector.y );
- }
+}
/*************************************************************************/
/* */
@@ -2180,16 +2186,14 @@
/* The distance in F26dot6 format. */
/* */
static FT_F26Dot6
- Dual_Project( EXEC_OP_ FT_Vector* v1,
- FT_Vector* v2 )
+ Dual_Project( EXEC_OP_ FT_Pos dx,
+ FT_Pos dy )
{
- return TT_DotFix14( v1->x - v2->x,
- v1->y - v2->y,
+ return TT_DotFix14( dx, dy,
CUR.GS.dualVector.x,
CUR.GS.dualVector.y );
}
-
/*************************************************************************/
/* */
/* <Function> */
@@ -2207,15 +2211,14 @@
/* The distance in F26dot6 format. */
/* */
static FT_F26Dot6
- Project_x( EXEC_OP_ FT_Vector* v1,
- FT_Vector* v2 )
+ Project_x( EXEC_OP_ FT_Pos dx,
+ FT_Pos dy )
{
FT_UNUSED_EXEC;
- return ( v1->x - v2->x );
+ return dx;
}
-
/*************************************************************************/
/* */
/* <Function> */
@@ -2233,15 +2236,14 @@
/* The distance in F26dot6 format. */
/* */
static FT_F26Dot6
- Project_y( EXEC_OP_ FT_Vector* v1,
- FT_Vector* v2 )
+ Project_y( EXEC_OP_ FT_Pos dx,
+ FT_Pos dy )
{
FT_UNUSED_EXEC;
- return ( v1->y - v2->y );
+ return dy;
}
-
/*************************************************************************/
/* */
/* <Function> */
@@ -4701,9 +4703,9 @@
else
{
if ( CUR.opcode & 1 )
- R = CUR_Func_dualproj( CUR.zp2.org + L, NULL_Vector );
+ R = CUR_fast_dualproj( &CUR.zp2.org[L] );
else
- R = CUR_Func_project( CUR.zp2.cur + L, NULL_Vector );
+ R = CUR_fast_project( &CUR.zp2.cur[L] );
}
args[0] = R;
@@ -4736,7 +4738,7 @@
return;
}
- K = CUR_Func_project( CUR.zp2.cur + L, NULL_Vector );
+ K = CUR_fast_project( &CUR.zp2.cur[L] );
CUR_Func_move( &CUR.zp2, L, args[1] - K );
@@ -5623,7 +5625,7 @@
/* twilight zone? ? */
if ( ( CUR.opcode & 1 ) != 0 )
{
- cur_dist = CUR_Func_project( CUR.zp0.cur + point, NULL_Vector );
+ cur_dist = CUR_fast_project( &CUR.zp0.cur[point] );
distance = CUR_Func_round( cur_dist,
CUR.tt_metrics.compensations[0] ) - cur_dist;
}
@@ -5694,7 +5696,7 @@
CUR.zp0.cur[point] = CUR.zp0.org[point];
}
- org_dist = CUR_Func_project( CUR.zp0.cur + point, NULL_Vector );
+ org_dist = CUR_fast_project( &CUR.zp0.cur[point] );
if ( ( CUR.opcode & 1 ) != 0 ) /* rounding and control cutin flag */
{
@@ -6179,18 +6181,18 @@
vec2.x = TT_MULFIX( vec2.x, CUR.metrics.x_scale );
vec2.y = TT_MULFIX( vec2.y, CUR.metrics.y_scale );
- org_a = CUR_Func_dualproj( &vec1, NULL_Vector );
- org_b = CUR_Func_dualproj( &vec2, NULL_Vector );
+ org_a = CUR_fast_dualproj( &vec1 );
+ org_b = CUR_fast_dualproj( &vec2 );
#else
- org_a = CUR_Func_dualproj( CUR.zp0.org + CUR.GS.rp1, NULL_Vector );
- org_b = CUR_Func_dualproj( CUR.zp1.org + CUR.GS.rp2, NULL_Vector );
+ org_a = CUR_fast_dualproj( &CUR.zp0.org[CUR.GS.rp1] );
+ org_b = CUR_fast_dualproj( &CUR.zp1.org[CUR.GS.rp2] );
#endif /* FIX_BYTECODE */
- cur_a = CUR_Func_project( CUR.zp0.cur + CUR.GS.rp1, NULL_Vector );
- cur_b = CUR_Func_project( CUR.zp1.cur + CUR.GS.rp2, NULL_Vector );
+ cur_a = CUR_fast_project( &CUR.zp0.cur[CUR.GS.rp1] );
+ cur_b = CUR_fast_project( &CUR.zp1.cur[CUR.GS.rp2] );
}
while ( CUR.GS.loop > 0 )
@@ -6218,15 +6220,15 @@
vec.x = TT_MULFIX( vec.x, CUR.metrics.x_scale );
vec.y = TT_MULFIX( vec.y, CUR.metrics.y_scale );
- org_x = CUR_Func_dualproj( &vec, NULL_Vector );
+ org_x = CUR_fast_dualproj( &vec );
#else
- org_x = CUR_Func_dualproj( CUR.zp2.org + point, NULL_Vector );
+ org_x = CUR_fast_dualproj( &CUR.zp2.org[point] );
#endif /* FIX_BYTECODE */
- cur_x = CUR_Func_project ( CUR.zp2.cur + point, NULL_Vector );
+ cur_x = CUR_fast_project ( &CUR.zp2.cur[point] );
if ( ( org_a <= org_b && org_x <= org_a ) ||
( org_a > org_b && org_x >= org_a ) )
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -19,7 +19,6 @@
#ifndef __TTINTERP_H__
#define __TTINTERP_H__
-
#include <ft2build.h>
#include "ttobjs.h"
@@ -79,8 +78,8 @@
/* Distance projection along one of the projection vectors */
typedef FT_F26Dot6
- (*TT_Project_Func)( EXEC_OP_ FT_Vector* v1,
- FT_Vector* v2 );
+ (*TT_Project_Func)( EXEC_OP_ FT_Pos dx,
+ FT_Pos dy );
/* reading a cvt value. Take care of non-square pixels if necessary */
typedef FT_F26Dot6