[sdf] Added subdivision optimization.

* src/sdf/ftsdfrend.c (sdf_generate_subdivision): The
  function generate SDF just like the `sdf_generate'
  function, but subdivide the curve into a number of
  lines and then use the `sdf_generate_bounding_box'
  function to generate SDF.
This commit is contained in:
Anuj Verma 2020-07-09 09:27:27 +05:30 committed by anujverma
parent fa7251ba35
commit 8bf9da21e0
2 changed files with 43 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2020-07-09 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added subdivision optimization.
* src/sdf/ftsdfrend.c (sdf_generate_subdivision): The
function generate SDF just like the `sdf_generate'
function, but subdivide the curve into a number of
lines and then use the `sdf_generate_bounding_box'
function to generate SDF.
2020-07-09 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Added functions to subdivide a cubic curve.

View File

@ -2722,6 +2722,38 @@
return error;
}
/**************************************************************************
*
* @Function:
* sdf_generate_bounding_box
*
* @Description:
* This function subdivide the shape into a number of straight lines
* and then simply use the above `sdf_generate_bounding_box' to generate
* the SDF.
* Note: After calling this function the `shape' will no longer have the
* original edges, it will only contain lines.
*
* @Input:
* [TODO]
*
* @Return:
* [TODO]
*/
static FT_Error
sdf_generate_subdivision( const SDF_Shape* shape,
FT_UInt spread,
const FT_Bitmap* bitmap )
{
FT_Error error = FT_Err_Ok;
FT_CALL( split_sdf_shape( shape ) );
FT_CALL( sdf_generate_bounding_box( shape, spread, bitmap ) );
Exit:
return error;
}
/**************************************************************************
*
* interface functions
@ -2840,9 +2872,7 @@
FT_CALL( sdf_outline_decompose( outline, shape ) );
split_sdf_shape( shape );
FT_CALL( sdf_generate_bounding_box( shape, sdf_params->spread,
FT_CALL( sdf_generate_subdivision( shape, sdf_params->spread,
sdf_params->root.target ) );
Exit: