[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master 4c7d279 2/2: [ftbench] Add new test for creatin
From: |
Werner LEMBERG |
Subject: |
[freetype2-demos] master 4c7d279 2/2: [ftbench] Add new test for creating face and loading glyph together. |
Date: |
Sat, 14 Oct 2017 05:40:18 -0400 (EDT) |
branch: master
commit 4c7d2796de8d43f2b102684cef1fae262ba07e2a
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
[ftbench] Add new test for creating face and loading glyph together.
This will be test `k'.
* src/ftbench.c (FT_BENCH_NEW_FACE_AND_LOAD_GLYPH): New enum value.
(bench_desc): Updated.
(test_new_face_and_load_glyph): New function.
(main): Handle it.
(test_image_cache, test_sbit_cache): Tag unused variables.
* src/ftbench.1: Updated.
---
ChangeLog | 15 ++++++++++++
src/ftbench.1 | 73 +++++++++++++++++++++++++++++++++--------------------------
src/ftbench.c | 44 +++++++++++++++++++++++++++++++++++
3 files changed, 100 insertions(+), 32 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b8386de..07bd47e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2017-10-14 Werner Lemberg <address@hidden>
+ [ftbench] Add new test for creating face and loading glyph together.
+
+ This will be test `k'.
+
+ * src/ftbench.c (FT_BENCH_NEW_FACE_AND_LOAD_GLYPH): New enum value.
+ (bench_desc): Updated.
+ (test_new_face_and_load_glyph): New function.
+ (main): Handle it.
+
+ (test_image_cache, test_sbit_cache): Tag unused variables.
+
+ * src/ftbench.1: Updated.
+
+2017-10-14 Werner Lemberg <address@hidden>
+
[ftbench] New option `-j' to specify last glyph index.
* src/ftbench.c (last_index): New global variable.
diff --git a/src/ftbench.1 b/src/ftbench.1
index cd6fefa..3b2ef2d 100644
--- a/src/ftbench.1
+++ b/src/ftbench.1
@@ -27,6 +27,40 @@ This program is part of the FreeType demos package.
.SH OPTIONS
.
.TP
+.BI \-b \ tests
+Perform chosen tests:
+.
+.RS
+.TS
+tab (@);
+rB l.
address@hidden glyphs (FT_Load_Glyph)
address@hidden advance widths (FT_Get_Advances)
address@hidden glyphs (FT_Render_Glyph)
address@hidden glyphs (FT_Get_Glyph)
address@hidden glyph cboxes (FT_Glyph_Get_CBox)
address@hidden glyph indices (FT_Get_Char_Index)
address@hidden CMap (FT_Get_{First,Next}_Char)
address@hidden a new face (FT_New_Face or FT_New_Memory_Face)
address@hidden glyphs (FT_GlyphSlot_Embolden)
address@hidden glyph bboxes (FT_Outline_Get_BBox)
address@hidden a new face and load glyphs
+.TE
+.RE
+.
+.IP
+(default is
+.BR abcdefghijk ,
+this is, all tests).
+.
+.IP
+The number of used glyphs per test (within a single iteration) is given by
+options
+.B \-i
+and
+.BR \-j .
+.
+.TP
.B \-C
Compare with cached version if available.
.
@@ -68,7 +102,13 @@ without an argument to get the actual list.
.BI \-i \ idx
Start with glyph index
.I idx
-(default is 0, which means to process all glyphs).
+(default is 0).
+.
+.TP
+.BI \-j \ idx
+End with glyph index
+.I idx
+(default is the number of glyphs minus one).
.
.TP
.BI \-m \ m
@@ -125,37 +165,6 @@ Use at most
seconds per test (default is 2).
.
.TP
-.BI \-b \ tests
-Perform chosen tests:
-.
-.RS
-.TS
-tab (@);
-rB l.
address@hidden glyphs (FT_Load_Glyph)
address@hidden advance widths (FT_Get_Advances)
address@hidden glyphs (FT_Render_Glyph)
address@hidden glyphs (FT_Get_Glyph)
address@hidden glyph cboxes (FT_Glyph_Get_CBox)
address@hidden glyph indices (FT_Get_Char_Index)
address@hidden CMap (FT_Get_{First,Next}_Char)
address@hidden a new face (FT_New_Face or FT_New_Memory_Face)
address@hidden glyphs (FT_GlyphSlot_Embolden)
address@hidden glyph bboxes (FT_Outline_Get_BBox)
-.TE
-.RE
-.
-.IP
-(default is
-.BR abcdefghij ,
-this is, all tests).
-.
-.IP
-The number of used glyphs per test (within a single iteration) is given by
-option
-.BR \-i .
-.
-.TP
.B \-v
Show version.
.
diff --git a/src/ftbench.c b/src/ftbench.c
index d618cb2..c6b2b3c 100644
--- a/src/ftbench.c
+++ b/src/ftbench.c
@@ -106,6 +106,7 @@
FT_BENCH_NEW_FACE,
FT_BENCH_EMBOLDEN,
FT_BENCH_GET_BBOX,
+ FT_BENCH_NEW_FACE_AND_LOAD_GLYPH,
N_FT_BENCH
};
@@ -122,6 +123,8 @@
"open a new face (FT_New_Face)",
"embolden (FT_GlyphSlot_Embolden)",
"get glyph bbox (FT_Outline_Get_BBox)",
+
+ "open face and load glyph",
NULL
};
@@ -525,6 +528,7 @@
unsigned int i;
int done = 0;
+ FT_UNUSED( face );
FT_UNUSED( user_data );
@@ -561,6 +565,7 @@
unsigned int i;
int done = 0;
+ FT_UNUSED( face );
FT_UNUSED( user_data );
@@ -633,6 +638,39 @@
}
+ static int
+ test_new_face_and_load_glyph( btimer_t* timer,
+ FT_Face face,
+ void* user_data )
+ {
+ FT_Face bench_face;
+
+ unsigned int i;
+ int done = 0;
+
+ FT_UNUSED( face );
+ FT_UNUSED( user_data );
+
+
+ TIMER_START( timer );
+
+ if ( !get_face( &bench_face ) )
+ {
+ for ( i = first_index; i <= last_index; i++ )
+ {
+ if ( !FT_Load_Glyph( bench_face, i, load_flags ) )
+ done++;
+ }
+
+ FT_Done_Face( bench_face );
+ }
+
+ TIMER_STOP( timer );
+
+ return done;
+ }
+
+
/*
* main
*/
@@ -1307,6 +1345,12 @@
else
printf( " %-25s disabled (size = 0)\n", test.title );
break;
+
+ case FT_BENCH_NEW_FACE_AND_LOAD_GLYPH:
+ test.title = "Create face & load glyph(s)";
+ test.bench = test_new_face_and_load_glyph;
+ benchmark( face, &test, max_iter, max_time );
+ break;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master 4c7d279 2/2: [ftbench] Add new test for creating face and loading glyph together.,
Werner LEMBERG <=