forked from minhngoc25a/freetype2
Revert "[sdf] Added total memory allocation log."
This reverts commit d97e060891af0cc59af6fefa84484bec0d1794a4.
This commit is contained in:
parent
531d51eb2a
commit
dfdbc34108
|
@ -1,13 +1,3 @@
|
||||||
2020-07-16 Anuj Verma <anujv@iitbhilai.ac.in>
|
|
||||||
|
|
||||||
[sdf] Added total memory allocation log.
|
|
||||||
|
|
||||||
* src/sdf/ftsdf.c (*): Replaced `FT_QNEW' and `FT_ALLOC_MULT'
|
|
||||||
to custom macros in order to track memory allocations
|
|
||||||
throughout the process of generating SDF. It basically
|
|
||||||
add the memory being allocated to a static global variable
|
|
||||||
and at the end outputs it at the end.
|
|
||||||
|
|
||||||
2020-07-15 Anuj Verma <anujv@iitbhilai.ac.in>
|
2020-07-15 Anuj Verma <anujv@iitbhilai.ac.in>
|
||||||
|
|
||||||
* src/sdf/ftsdfrend.c (sdf_property_set): Minor fix.
|
* src/sdf/ftsdfrend.c (sdf_property_set): Minor fix.
|
||||||
|
|
|
@ -6,48 +6,6 @@
|
||||||
|
|
||||||
#include "ftsdferrs.h"
|
#include "ftsdferrs.h"
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* macros to track intermediate memory allocations
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
||||||
|
|
||||||
/* These macros are used to track and output the total */
|
|
||||||
/* memory allocation once the SDF is generated. */
|
|
||||||
|
|
||||||
static FT_Long s_total_memory_allocated;
|
|
||||||
|
|
||||||
#define SDF_MEM_TRACK_START() s_total_memory_allocated = 0
|
|
||||||
|
|
||||||
#define SDF_MEM_TRACK_END() \
|
|
||||||
FT_TRACE0(( "[sdf] Total intermediate memory allocated = " \
|
|
||||||
"%ld bytes\n", s_total_memory_allocated )); \
|
|
||||||
s_total_memory_allocated = 0
|
|
||||||
|
|
||||||
/* We only use these two macros to allocate memory in */
|
|
||||||
/* the module. */
|
|
||||||
|
|
||||||
#define SDF_ALLOC_MULT( ptr, count, item_size ) \
|
|
||||||
s_total_memory_allocated += count * item_size, \
|
|
||||||
FT_ALLOC_MULT( ptr, count, item_size )
|
|
||||||
|
|
||||||
#define SDF_QNEW( ptr ) \
|
|
||||||
s_total_memory_allocated += sizeof( *ptr ), \
|
|
||||||
!FT_QNEW( ptr )
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define SDF_MEM_TRACK_START()
|
|
||||||
#define SDF_MEM_TRACK_END()
|
|
||||||
|
|
||||||
#define SDF_ALLOC_MULT( ptr, count, item_size ) \
|
|
||||||
FT_ALLOC_MULT( ptr, count, item_size )
|
|
||||||
|
|
||||||
#define SDF_QNEW( ptr ) !FT_QNEW( ptr )
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* definitions
|
* definitions
|
||||||
|
@ -279,7 +237,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( SDF_QNEW( ptr ) )
|
if ( !FT_QNEW( ptr ) )
|
||||||
{
|
{
|
||||||
*ptr = null_edge;
|
*ptr = null_edge;
|
||||||
*edge = ptr;
|
*edge = ptr;
|
||||||
|
@ -316,7 +274,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( SDF_QNEW( ptr ) )
|
if ( !FT_QNEW( ptr ) )
|
||||||
{
|
{
|
||||||
*ptr = null_contour;
|
*ptr = null_contour;
|
||||||
*contour = ptr;
|
*contour = ptr;
|
||||||
|
@ -368,7 +326,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( SDF_QNEW( ptr ) )
|
if ( !FT_QNEW( ptr ) )
|
||||||
{
|
{
|
||||||
*ptr = null_shape;
|
*ptr = null_shape;
|
||||||
ptr->memory = memory;
|
ptr->memory = memory;
|
||||||
|
@ -2631,7 +2589,7 @@
|
||||||
rows = bitmap->rows;
|
rows = bitmap->rows;
|
||||||
buffer = (FT_Short*)bitmap->buffer;
|
buffer = (FT_Short*)bitmap->buffer;
|
||||||
|
|
||||||
if ( SDF_ALLOC_MULT( dists, width, rows * sizeof(*dists) ) )
|
if ( FT_ALLOC_MULT( dists, width, rows * sizeof(*dists) ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
FT_MEM_ZERO( dists, width * rows * sizeof(*dists) );
|
FT_MEM_ZERO( dists, width * rows * sizeof(*dists) );
|
||||||
|
@ -3109,8 +3067,6 @@
|
||||||
SDF_Params internal_params;
|
SDF_Params internal_params;
|
||||||
|
|
||||||
|
|
||||||
SDF_MEM_TRACK_START();
|
|
||||||
|
|
||||||
/* check for valid arguments */
|
/* check for valid arguments */
|
||||||
if ( !sdf_raster || !sdf_params )
|
if ( !sdf_raster || !sdf_params )
|
||||||
{
|
{
|
||||||
|
@ -3194,8 +3150,6 @@
|
||||||
if ( shape )
|
if ( shape )
|
||||||
sdf_shape_done( &shape );
|
sdf_shape_done( &shape );
|
||||||
|
|
||||||
SDF_MEM_TRACK_END();
|
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue