[sdf] Temporary change.

Added new property to dynamically change the
optimization to be used to generate the SDF.
This can be used to compare the performance of
different optimization techniques without going
and recompiling the program.
And will also be used in the demo to check the
performance.
This commit is contained in:
Anuj Verma 2020-07-14 17:20:05 +05:30 committed by anujverma
parent dd5276601c
commit d40fc55dad
5 changed files with 61 additions and 2 deletions

View File

@ -1,3 +1,15 @@
2020-07-14 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Temporary change.
Added new property to dynamically change the
optimization to be used to generate the SDF.
This can be used to compare the performance of
different optimization techniques without going
and recompiling the program.
And will also be used in the demo to check the
performance.
2020-07-13 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added more properties.

View File

@ -3129,8 +3129,23 @@
FT_CALL( sdf_outline_decompose( outline, shape ) );
FT_CALL( sdf_generate_subdivision( internal_params, shape, sdf_params->spread,
sdf_params->root.target ) );
/* TEMPORARY */
if ( sdf_params->optimization == OPTIMIZATION_BB )
FT_CALL( sdf_generate_bounding_box( internal_params,
shape, sdf_params->spread,
sdf_params->root.target ) );
else if ( sdf_params->optimization == OPTIMIZATION_SUB )
FT_CALL( sdf_generate_subdivision( internal_params,
shape, sdf_params->spread,
sdf_params->root.target ) );
else if ( sdf_params->optimization == OPTIMIZATION_CG )
FT_CALL( sdf_generate_coarse_grid( internal_params,
shape, sdf_params->spread,
sdf_params->root.target ) );
else
FT_CALL( sdf_generate( internal_params,
shape, sdf_params->spread,
sdf_params->root.target ) );
if ( shape )
sdf_shape_done( &shape );

View File

@ -17,6 +17,16 @@ FT_BEGIN_HEADER
/* maximum spread supported by the rasterizer. */
#define MAX_SPREAD 32
/* TEMPORARY */
typedef enum Optimizations_ {
OPTIMIZATION_NONE = 0, /* default: check all points against all edges */
OPTIMIZATION_BB = 1, /* use bounding box to check nearby grid points */
OPTIMIZATION_SUB = 2, /* subdivide then use bounding box */
OPTIMIZATION_CG = 3, /* use coarse grid to only check relevant edges */
} Optimizations;
/* --------- */
/**************************************************************************
*
* @struct:
@ -38,6 +48,9 @@ FT_BEGIN_HEADER
FT_Bool flip_sign;
FT_Bool flip_y;
/* TEMPORARY */
FT_Int optimization;
} SDF_Raster_Params;
FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_sdf_raster;

View File

@ -79,6 +79,16 @@
FT_TRACE7(( "[sdf] sdf_property_set: "
"updated property `flip_y' to %d\n", val ));
}
/* TEMPORARY */
else if ( ft_strcmp( property_name, "optimization" ) == 0 )
{
FT_Int val = *(const FT_Int*)value;
render->optimization = val ? 1 : 0;
FT_TRACE7(( "[sdf] sdf_property_set: "
"updated property `optimization' to %d\n", val ));
}
else
{
FT_TRACE0(( "[sdf] sdf_property_set: "
@ -167,6 +177,9 @@
sdf_render->flip_sign = 0;
sdf_render->flip_y = 0;
/* TEMPORARY */
sdf_render->optimization = OPTIMIZATION_NONE;
return FT_Err_Ok;
}
@ -280,6 +293,9 @@
params.flip_sign = sdf_module->flip_sign;
params.flip_y = sdf_module->flip_y;
/* TEMPORARY */
params.optimization = sdf_module->optimization;
/* render the outline */
error = render->raster_render( render->raster, (const FT_Raster_Params*)&params );

View File

@ -29,6 +29,9 @@ FT_BEGIN_HEADER
FT_Bool flip_sign;
FT_Bool flip_y;
/* TEMPORARY */
FT_Int optimization;
} SDF_Renderer_Module, *SDF_Renderer;