[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master bd88a9d: * src/ftbench.c (test_stroke): Impleme
From: |
Alexei Podtelezhnikov |
Subject: |
[freetype2-demos] master bd88a9d: * src/ftbench.c (test_stroke): Implement stroker test. |
Date: |
Mon, 23 Sep 2019 22:41:44 -0400 (EDT) |
branch: master
commit bd88a9d393b69ac8eb4e99845fa1885b1c1d8db9
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>
* src/ftbench.c (test_stroke): Implement stroker test.
(FT_BENCH_STROKE, bench_desc, main): Register it.
---
ChangeLog | 5 +++++
src/ftbench.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5fbc1db..9333b64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-23 Alexei Podtelezhnikov <address@hidden>
+
+ * src/ftbench.c (test_stroke): Implement stroker test.
+ (FT_BENCH_STROKE, bench_desc, main): Register it.
+
2019-09-20 Werner Lemberg <address@hidden>
* graph/x11/grx11.c (gr_x11_surface_init): Initialize `xswa'.
diff --git a/src/ftbench.c b/src/ftbench.c
index b95e5e3..b2800fd 100644
--- a/src/ftbench.c
+++ b/src/ftbench.c
@@ -29,6 +29,7 @@
#include FT_SYNTHESIS_H
#include FT_ADVANCES_H
#include FT_OUTLINE_H
+#include FT_STROKER_H
#include FT_BBOX_H
#include FT_MODULE_H
#include FT_DRIVER_H
@@ -99,12 +100,13 @@
FT_BENCH_LOAD_ADVANCES,
FT_BENCH_RENDER,
FT_BENCH_GET_GLYPH,
- FT_BENCH_GET_CBOX,
FT_BENCH_CMAP,
FT_BENCH_CMAP_ITER,
FT_BENCH_NEW_FACE,
FT_BENCH_EMBOLDEN,
+ FT_BENCH_STROKE,
FT_BENCH_GET_BBOX,
+ FT_BENCH_GET_CBOX,
FT_BENCH_NEW_FACE_AND_LOAD_GLYPH,
N_FT_BENCH
};
@@ -116,12 +118,13 @@
"load advance widths (FT_Get_Advances)",
"render a glyph (FT_Render_Glyph)",
"load a glyph (FT_Get_Glyph)",
- "get glyph cbox (FT_Glyph_Get_CBox)",
"get glyph indices (FT_Get_Char_Index)",
"iterate CMap (FT_Get_{First,Next}_Char)",
"open a new face (FT_New_Face)",
"embolden (FT_GlyphSlot_Embolden)",
+ "stroke (FT_Glyph_Stroke)",
"get glyph bbox (FT_Outline_Get_BBox)",
+ "get glyph cbox (FT_Glyph_Get_CBox)",
"open face and load glyph",
NULL
@@ -363,6 +366,45 @@
static int
+ test_stroke( btimer_t* timer,
+ FT_Face face,
+ void* user_data )
+ {
+ FT_Glyph glyph;
+ FT_Stroker stroker;
+ unsigned int i;
+ int done = 0;
+
+ FT_UNUSED( user_data );
+
+
+ FT_Stroker_New( lib, &stroker );
+ FT_Stroker_Set( stroker, face->size->metrics.y_ppem,
+ FT_STROKER_LINECAP_ROUND,
+ FT_STROKER_LINEJOIN_ROUND,
+ 0 );
+
+ for ( i = first_index; i <= last_index; i++ )
+ {
+ if ( FT_Load_Glyph( face, i, load_flags ) )
+ continue;
+
+ if ( FT_Get_Glyph( face->glyph, &glyph ) )
+ continue;
+
+ TIMER_START( timer );
+ FT_Glyph_Stroke( &glyph, stroker, 1 );
+ TIMER_STOP( timer );
+
+ FT_Done_Glyph( glyph );
+ done++;
+ }
+
+ return done;
+ }
+
+
+ static int
test_get_glyph( btimer_t* timer,
FT_Face face,
void* user_data )
@@ -1358,6 +1400,15 @@
printf( " %-25s disabled (size = 0)\n", test.title );
break;
+ case FT_BENCH_STROKE:
+ test.title = "Stroke";
+ test.bench = test_stroke;
+ if ( size )
+ benchmark( face, &test, max_iter, max_time );
+ 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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master bd88a9d: * src/ftbench.c (test_stroke): Implement stroker test.,
Alexei Podtelezhnikov <=