forked from minhngoc25a/freetype2
[sdf] Fixed compilation under gnumake.
This commit is contained in:
parent
96883decbb
commit
38df99a1b4
|
@ -1,4 +1,17 @@
|
||||||
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
|
2020-06-30 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
|
[sdf] Fixed compilation under gnumake.
|
||||||
|
|
||||||
|
* src/sdf/rules.mk (DRV_OBJ_ => DRV_OBJS_): Fixed varialbe
|
||||||
|
name so that the sdf can compile.
|
||||||
|
|
||||||
|
* src/sdf/module.mk: Fixed spacing.
|
||||||
|
|
||||||
|
* src/sdf/*.c: Fixed all compiler warnings.
|
||||||
|
|
||||||
|
* [GSoC]ChangLog: Fixed dates.
|
||||||
|
|
||||||
|
2020-06-29 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
[sdf] Added function to resolve corners in case of
|
[sdf] Added function to resolve corners in case of
|
||||||
ambiguity.
|
ambiguity.
|
||||||
|
@ -10,7 +23,7 @@
|
||||||
|
|
||||||
* src/sdf/ftsdf.c: Typo neartest_point -> nearest_point.
|
* src/sdf/ftsdf.c: Typo neartest_point -> nearest_point.
|
||||||
|
|
||||||
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
|
2020-06-29 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
[sdf] The module can now generate signed distance
|
[sdf] The module can now generate signed distance
|
||||||
fields for outline with only lines.
|
fields for outline with only lines.
|
||||||
|
@ -28,7 +41,7 @@
|
||||||
|
|
||||||
* src/sdf/ftsdfrend.c (ft_sdf_render): Fixed alignment issues.
|
* src/sdf/ftsdfrend.c (ft_sdf_render): Fixed alignment issues.
|
||||||
|
|
||||||
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
|
2020-06-28 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
[sdf] Added function to find shortest distance from
|
[sdf] Added function to find shortest distance from
|
||||||
a point to a line.
|
a point to a line.
|
||||||
|
@ -42,7 +55,7 @@
|
||||||
* src/sdf/ftsdf.c (SDF_Signed_Distance): Use squared
|
* src/sdf/ftsdf.c (SDF_Signed_Distance): Use squared
|
||||||
distance instead of actual distance for performance.
|
distance instead of actual distance for performance.
|
||||||
|
|
||||||
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
|
2020-06-28 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
* src/sdf/ftsdf.c (SDF_Iterator_IO): Removed.
|
* src/sdf/ftsdf.c (SDF_Iterator_IO): Removed.
|
||||||
|
|
||||||
|
@ -51,7 +64,7 @@
|
||||||
Manually iterate through the lists instead of `FT_List_Iterate' to
|
Manually iterate through the lists instead of `FT_List_Iterate' to
|
||||||
avoid io structs and looks a bit cleaner.
|
avoid io structs and looks a bit cleaner.
|
||||||
|
|
||||||
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
|
2020-06-28 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
[sdf] Added basic outline of the functions required to
|
[sdf] Added basic outline of the functions required to
|
||||||
generate sdf.
|
generate sdf.
|
||||||
|
@ -72,7 +85,7 @@
|
||||||
distance.
|
distance.
|
||||||
|
|
||||||
|
|
||||||
2020-06-26 Anuj Verma <anujv@iitbhilai.ac.in>
|
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
[sdf] Added `SDF_Raster_Params' struct which extends
|
[sdf] Added `SDF_Raster_Params' struct which extends
|
||||||
`FT_Raster_Params' and has a few extra fields. This is done
|
`FT_Raster_Params' and has a few extra fields. This is done
|
||||||
|
@ -91,7 +104,7 @@
|
||||||
* src//sdf/ftsdfrend.c (ft_sdf_render): Setup the `SDF_Raster_Params'
|
* src//sdf/ftsdfrend.c (ft_sdf_render): Setup the `SDF_Raster_Params'
|
||||||
and pass it to the rasterizer instead of `FT_Raster_Params'.
|
and pass it to the rasterizer instead of `FT_Raster_Params'.
|
||||||
|
|
||||||
2020-06-26 Anuj Verma <anujv@iitbhilai.ac.in>
|
2020-06-27 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
* include/freetype/ftimage.h (FT_RASTER_FLAG_): Added
|
* include/freetype/ftimage.h (FT_RASTER_FLAG_): Added
|
||||||
a new raster flag `FT_RASTER_FLAG_SDF'. The `ftsdf'
|
a new raster flag `FT_RASTER_FLAG_SDF'. The `ftsdf'
|
||||||
|
|
|
@ -155,8 +155,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
FT_QNEW( ptr );
|
if ( !FT_QNEW( ptr ) )
|
||||||
if ( error == FT_Err_Ok )
|
|
||||||
{
|
{
|
||||||
*ptr = null_edge;
|
*ptr = null_edge;
|
||||||
*edge = ptr;
|
*edge = ptr;
|
||||||
|
@ -205,8 +204,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
FT_QNEW( ptr );
|
if ( !FT_QNEW( ptr ) )
|
||||||
if ( error == FT_Err_Ok )
|
|
||||||
{
|
{
|
||||||
*ptr = null_contour;
|
*ptr = null_contour;
|
||||||
*contour = ptr;
|
*contour = ptr;
|
||||||
|
@ -260,8 +258,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
FT_QNEW( ptr );
|
if ( !FT_QNEW( ptr ) )
|
||||||
if ( error == FT_Err_Ok )
|
|
||||||
{
|
{
|
||||||
*ptr = null_shape;
|
*ptr = null_shape;
|
||||||
ptr->memory = memory;
|
ptr->memory = memory;
|
||||||
|
@ -320,8 +317,7 @@
|
||||||
if ( error != FT_Err_Ok )
|
if ( error != FT_Err_Ok )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
FT_QNEW( node );
|
if ( FT_QNEW( node ) )
|
||||||
if ( error != FT_Err_Ok )
|
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
contour->last_pos = *to;
|
contour->last_pos = *to;
|
||||||
|
@ -362,8 +358,7 @@
|
||||||
if ( error != FT_Err_Ok )
|
if ( error != FT_Err_Ok )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
FT_QNEW( node );
|
if ( FT_QNEW( node ) )
|
||||||
if ( error != FT_Err_Ok )
|
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
edge->edge_type = SDF_EDGE_LINE;
|
edge->edge_type = SDF_EDGE_LINE;
|
||||||
|
@ -405,8 +400,7 @@
|
||||||
if ( error != FT_Err_Ok )
|
if ( error != FT_Err_Ok )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
FT_QNEW( node );
|
if ( FT_QNEW( node ) )
|
||||||
if ( error != FT_Err_Ok )
|
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
edge->edge_type = SDF_EDGE_CONIC;
|
edge->edge_type = SDF_EDGE_CONIC;
|
||||||
|
@ -450,8 +444,7 @@
|
||||||
if ( error != FT_Err_Ok )
|
if ( error != FT_Err_Ok )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
FT_QNEW( node );
|
if ( FT_QNEW( node ) )
|
||||||
if ( error != FT_Err_Ok )
|
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
edge->edge_type = SDF_EDGE_CUBIC;
|
edge->edge_type = SDF_EDGE_CUBIC;
|
||||||
|
@ -1007,7 +1000,7 @@
|
||||||
static FT_Error
|
static FT_Error
|
||||||
sdf_generate( const SDF_Shape* shape,
|
sdf_generate( const SDF_Shape* shape,
|
||||||
FT_UInt spread,
|
FT_UInt spread,
|
||||||
FT_Bitmap* bitmap )
|
const FT_Bitmap* bitmap )
|
||||||
{
|
{
|
||||||
FT_Error error = FT_Err_Ok;
|
FT_Error error = FT_Err_Ok;
|
||||||
FT_UInt width = 0;
|
FT_UInt width = 0;
|
||||||
|
@ -1030,8 +1023,8 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = bitmap->width;
|
width = bitmap->width;
|
||||||
rows = bitmap->rows;
|
rows = bitmap->rows;
|
||||||
buffer = (FT_Short*)bitmap->buffer;
|
buffer = (FT_Short*)bitmap->buffer;
|
||||||
|
|
||||||
sp_sq = FT_INT_16D16( spread * spread );
|
sp_sq = FT_INT_16D16( spread * spread );
|
||||||
|
@ -1054,13 +1047,16 @@
|
||||||
/* `grid_point' is the current pixel position */
|
/* `grid_point' is the current pixel position */
|
||||||
/* our task is to find the shortest distance */
|
/* our task is to find the shortest distance */
|
||||||
/* from this point to the entire shape. */
|
/* from this point to the entire shape. */
|
||||||
FT_26D6_Vec grid_point = { FT_INT_26D6( x ),
|
FT_26D6_Vec grid_point = zero_vector;
|
||||||
FT_INT_26D6( y ) };
|
SDF_Signed_Distance min_dist = max_sdf;
|
||||||
SDF_Signed_Distance min_dist = max_sdf;
|
|
||||||
FT_ListRec contour_list;
|
FT_ListRec contour_list;
|
||||||
FT_UInt index;
|
FT_UInt index;
|
||||||
FT_Short value;
|
FT_Short value;
|
||||||
|
|
||||||
|
|
||||||
|
grid_point.x = FT_INT_26D6( x );
|
||||||
|
grid_point.y = FT_INT_26D6( y );
|
||||||
|
|
||||||
/* This `grid_point' is at the corner, but we */
|
/* This `grid_point' is at the corner, but we */
|
||||||
/* use the center of the pixel. */
|
/* use the center of the pixel. */
|
||||||
grid_point.x += FT_INT_26D6( 1 ) / 2;
|
grid_point.x += FT_INT_26D6( 1 ) / 2;
|
||||||
|
|
|
@ -37,12 +37,12 @@
|
||||||
const void* value,
|
const void* value,
|
||||||
FT_Bool value_is_string )
|
FT_Bool value_is_string )
|
||||||
{
|
{
|
||||||
FT_UNUSED( value_is_string );
|
FT_Error error = FT_Err_Ok;
|
||||||
|
|
||||||
FT_Error error = FT_Err_Ok;
|
|
||||||
SDF_Renderer render = SDF_RENDERER( FT_RENDERER( module ) );
|
SDF_Renderer render = SDF_RENDERER( FT_RENDERER( module ) );
|
||||||
|
|
||||||
|
|
||||||
|
FT_UNUSED( value_is_string );
|
||||||
|
|
||||||
if ( ft_strcmp( property_name, "spread" ) == 0 )
|
if ( ft_strcmp( property_name, "spread" ) == 0 )
|
||||||
{
|
{
|
||||||
FT_Int val = *(const FT_Int*)value;
|
FT_Int val = *(const FT_Int*)value;
|
||||||
|
@ -95,7 +95,6 @@
|
||||||
error = FT_THROW( Missing_Property );
|
error = FT_THROW( Missing_Property );
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +216,7 @@
|
||||||
/* ignore the pitch, pixel mode and set custom */
|
/* ignore the pitch, pixel mode and set custom */
|
||||||
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY16;
|
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY16;
|
||||||
bitmap->pitch = bitmap->width * 2;
|
bitmap->pitch = bitmap->width * 2;
|
||||||
bitmap->num_grays = 65536;
|
bitmap->num_grays = 65535;
|
||||||
|
|
||||||
/* allocate new buffer */
|
/* allocate new buffer */
|
||||||
if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
|
if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
|
||||||
|
|
|
@ -4,7 +4,7 @@ FTMODULE_H_COMMANDS += SDF_RENDERER
|
||||||
|
|
||||||
define SDF_RENDERER
|
define SDF_RENDERER
|
||||||
$(OPEN_DRIVER) FT_Renderer_Class, ft_sdf_renderer_class $(CLOSE_DRIVER)
|
$(OPEN_DRIVER) FT_Renderer_Class, ft_sdf_renderer_class $(CLOSE_DRIVER)
|
||||||
$(ECHO_DRIVER)sdf $(ECHO_DRIVER_DESC) signed distance field renderer $(ECHO_DRIVER_DONE)
|
$(ECHO_DRIVER)sdf $(ECHO_DRIVER_DESC)signed distance field renderer$(ECHO_DRIVER_DONE)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
#EOF
|
#EOF
|
||||||
|
|
|
@ -54,5 +54,5 @@ $(OBJ_DIR)/%.$O: $(SDF_DIR)/%.c $(FREETYPE_H) $(SDF_DRV_H)
|
||||||
|
|
||||||
# update main driver list
|
# update main driver list
|
||||||
#
|
#
|
||||||
DRV_OBJ_S += $(SDF_DRV_OBJ_S)
|
DRV_OBJS_S += $(SDF_DRV_OBJ_S)
|
||||||
DRV_OBJ_M += $(SDF_DRV_OBJ_M)
|
DRV_OBJS_M += $(SDF_DRV_OBJ_M)
|
||||||
|
|
Loading…
Reference in New Issue