forked from minhngoc25a/freetype2
[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:
parent
fa7251ba35
commit
8bf9da21e0
|
@ -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>
|
2020-07-09 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
[sdf] Added functions to subdivide a cubic curve.
|
[sdf] Added functions to subdivide a cubic curve.
|
||||||
|
|
|
@ -2722,6 +2722,38 @@
|
||||||
return error;
|
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
|
* interface functions
|
||||||
|
@ -2840,9 +2872,7 @@
|
||||||
|
|
||||||
FT_CALL( sdf_outline_decompose( outline, shape ) );
|
FT_CALL( sdf_outline_decompose( outline, shape ) );
|
||||||
|
|
||||||
split_sdf_shape( shape );
|
FT_CALL( sdf_generate_subdivision( shape, sdf_params->spread,
|
||||||
|
|
||||||
FT_CALL( sdf_generate_bounding_box( shape, sdf_params->spread,
|
|
||||||
sdf_params->root.target ) );
|
sdf_params->root.target ) );
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
|
|
Loading…
Reference in New Issue