shithub: freetype+ttf2subf

Download patch

ref: 0e536676ba968e974bf2f39376319044e2b23f3e
parent: bcca86af30967d7d93590f2241b84d02f083d54e
author: Alexei Podtelezhnikov <[email protected]>
date: Mon Feb 18 15:41:56 EST 2013

[tools] Update BBox testing tool.

* src/tools/test_bbox.c: Add another cubic outline with exact BBox.
(REPEAT): Increase the number of benchmarking cycles.
(profile_outline): Tweak output formatting.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-02-18  Alexei Podtelezhnikov  <[email protected]>
+
+	[tools] Update BBox testing tool.
+
+	* src/tools/test_bbox.c: Add another cubic outline with exact BBox.
+	(REPEAT): Increase the number of benchmarking cycles.
+	(profile_outline): Tweak output formatting.
+
 2013-02-02  Werner Lemberg  <[email protected]>
 
 	Fix Savannah bug #38235.
--- a/src/tools/test_bbox.c
+++ b/src/tools/test_bbox.c
@@ -88,6 +88,26 @@
   };
 
 
+  /* dummy outline #3 with bbox of [0 100 128 128] precisely */
+  static FT_Vector  dummy_vec_3[4] =
+  {
+    XVEC( 100.0, 127.0 ),
+    XVEC( 200.0, 127.0 ),
+    XVEC(   0.0, 136.0 ),
+    XVEC(   0.0, 100.0 )
+  };
+
+  static FT_Outline  dummy_outline_3 =
+  {
+    1,
+    4,
+    dummy_vec_3,
+    dummy_tag_1,
+    dummy_contour_1,
+    0
+  };
+
+
   static void
   dump_outline( FT_Outline*  outline )
   {
@@ -125,12 +145,14 @@
       FT_Outline_Get_CBox( outline, &bbox );
 
     time0 = get_time() - time0;
-    printf( "time = %5.2f cbox = [%.2f %.2f %.2f %.2f]\n",
+    printf( "time = %6.3f cbox = [%8.4f %8.4f %8.4f %8.4f]\n",
              ((double)time0/10000.0),
              XVAL( bbox.xMin ),
              XVAL( bbox.yMin ),
              XVAL( bbox.xMax ),
              XVAL( bbox.yMax ) );
+    printf( "cbox_hex = [%08X %08X %08X %08X]\n",
+             bbox.xMin, bbox.yMin, bbox.xMax, bbox.yMax );
 
 
     time0 = get_time();
@@ -138,15 +160,17 @@
       FT_Outline_Get_BBox( outline, &bbox );
 
     time0 = get_time() - time0;
-    printf( "time = %5.2f bbox = [%.2f %.2f %.2f %.2f]\n",
+    printf( "time = %6.3f bbox = [%8.4f %8.4f %8.4f %8.4f]\n",
              ((double)time0/10000.0),
              XVAL( bbox.xMin ),
              XVAL( bbox.yMin ),
              XVAL( bbox.xMax ),
              XVAL( bbox.yMax ) );
+    printf( "bbox_hex = [%08X %08X %08X %08X]\n",
+             bbox.xMin, bbox.yMin, bbox.xMax, bbox.yMax );
   }
 
-#define REPEAT  100000L
+#define REPEAT  1000000L
 
   int  main( int  argc, char**  argv )
   {
@@ -155,6 +179,10 @@
 
     printf( "outline #2\n" );
     profile_outline( &dummy_outline_2, REPEAT );
+
+    printf( "outline #3\n" );
+    profile_outline( &dummy_outline_3, REPEAT );
+
     return 0;
   }