6 #include <time.h> /* for clock() */
8 /* SunOS 4.1.* does not define CLOCKS_PER_SEC, so include <sys/param.h> */
9 /* to get the HZ macro which is the equivalent. */
10 #if defined(__sun__) && !defined(SVR4) && !defined(__SVR4)
11 #include <sys/param.h>
12 #define CLOCKS_PER_SEC HZ
18 return clock() * 10000L / CLOCKS_PER_SEC
;
24 /* test bbox computations */
27 #define XX(x) ((FT_Pos)(x*XSCALE))
28 #define XVEC(x,y) { XX(x), XX(y) }
29 #define XVAL(x) ((x)/(1.0*XSCALE))
31 /* dummy outline #1 */
32 static FT_Vector dummy_vec_1
[4] =
35 XVEC( 408.9111, 535.3164 ),
36 XVEC( 455.8887, 634.396 ),
37 XVEC( -37.8765, 786.2207 ),
38 XVEC( 164.6074, 535.3164 )
40 { (FT_Int32
)0x0198E93DL
, (FT_Int32
)0x021750FFL
}, /* 408.9111, 535.3164 */
41 { (FT_Int32
)0x01C7E312L
, (FT_Int32
)0x027A6560L
}, /* 455.8887, 634.3960 */
42 { (FT_Int32
)0xFFDA1F9EL
, (FT_Int32
)0x0312387FL
}, /* -37.8765, 786.2207 */
43 { (FT_Int32
)0x00A49B7EL
, (FT_Int32
)0x021750FFL
} /* 164.6074, 535.3164 */
47 static char dummy_tag_1
[4] =
55 static short dummy_contour_1
[1] =
60 static FT_Outline dummy_outline_1
=
71 /* dummy outline #2 */
72 static FT_Vector dummy_vec_2
[4] =
80 static FT_Outline dummy_outline_2
=
91 /* dummy outline #3 with bbox of [0 100 128 128] precisely */
92 static FT_Vector dummy_vec_3
[4] =
100 static FT_Outline dummy_outline_3
=
112 dump_outline( FT_Outline
* outline
)
116 /* compute and display cbox */
117 FT_Outline_Get_CBox( outline
, &bbox
);
118 printf( "cbox = [%.2f %.2f %.2f %.2f]\n",
124 /* compute and display bbox */
125 FT_Outline_Get_BBox( outline
, &bbox
);
126 printf( "bbox = [%.2f %.2f %.2f %.2f]\n",
136 profile_outline( FT_Outline
* outline
,
144 for ( count
= repeat
; count
> 0; count
-- )
145 FT_Outline_Get_CBox( outline
, &bbox
);
147 time0
= get_time() - time0
;
148 printf( "time = %6.3f cbox = [%8.4f %8.4f %8.4f %8.4f]\n",
149 ((double)time0
/10000.0),
154 printf( "cbox_hex = [%08X %08X %08X %08X]\n",
155 bbox
.xMin
, bbox
.yMin
, bbox
.xMax
, bbox
.yMax
);
159 for ( count
= repeat
; count
> 0; count
-- )
160 FT_Outline_Get_BBox( outline
, &bbox
);
162 time0
= get_time() - time0
;
163 printf( "time = %6.3f bbox = [%8.4f %8.4f %8.4f %8.4f]\n",
164 ((double)time0
/10000.0),
169 printf( "bbox_hex = [%08X %08X %08X %08X]\n",
170 bbox
.xMin
, bbox
.yMin
, bbox
.xMax
, bbox
.yMax
);
173 #define REPEAT 1000000L
175 int main( int argc
, char** argv
)
177 printf( "outline #1\n" );
178 profile_outline( &dummy_outline_1
, REPEAT
);
180 printf( "outline #2\n" );
181 profile_outline( &dummy_outline_2
, REPEAT
);
183 printf( "outline #3\n" );
184 profile_outline( &dummy_outline_3
, REPEAT
);