[sdf] Completed the coarse grid optimization.

* src/sdf/ftsdf.c (sdf_generate_coarse_grid): Fixed
  an issue with position calculation and upside down
  images.
This commit is contained in:
Anuj Verma 2020-07-11 08:53:28 +05:30 committed by anujverma
parent 992609a1db
commit 80c5bed575
2 changed files with 19 additions and 13 deletions

View File

@ -1,3 +1,11 @@
2020-07-11 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Completed the coarse grid optimization.
* src/sdf/ftsdf.c (sdf_generate_coarse_grid): Fixed
an issue with position calculation and upside down
images.
2020-07-10 Anuj Verma <anujv@iitbhilai.ac.in>
[sdf] Partially completed the coarse grid optimization.

View File

@ -45,7 +45,7 @@
/* then they will be checked for corner if they have ambiguity. */
#define CORNER_CHECK_EPSILON 32
#define CG_DIMEN 8
#define CG_DIMEN 10
/**************************************************************************
*
@ -2816,8 +2816,8 @@
FT_26D6_Vec cpoint;
coarse_grid[cindex] = NULL;
cpoint.x = FT_INT_26D6( i ) + FT_INT_26D6( c_width / 2 );
cpoint.y = FT_INT_26D6( j ) + FT_INT_26D6( c_rows / 2 );
cpoint.x = FT_INT_26D6( i * c_width ) + FT_INT_26D6( c_width / 2 );
cpoint.y = FT_INT_26D6( j * c_rows ) + FT_INT_26D6( c_rows / 2 );
while ( cont )
{
@ -2831,18 +2831,16 @@
FT_CALL( sdf_edge_get_min_distance( edge, cpoint, &dist ) );
if ( dist.distance > cg_sq )
if ( dist.distance < cg_sq )
{
edge = edge->next;
continue;
FT_CALL( sdf_edge_new( memory, &temp ) );
ft_memcpy( temp, edge, sizeof( *edge ) );
temp->next = coarse_grid[cindex];
coarse_grid[cindex] = temp;
}
FT_CALL( sdf_edge_new( memory, &temp ) );
ft_memcpy( temp, edge, sizeof( *edge ) );
temp->next = coarse_grid[cindex];
coarse_grid[cindex] = temp;
edge = edge->next;
}
@ -2904,7 +2902,7 @@
min_dist.distance /= 64;
buffer[ y * width + x ] = min_dist.distance;
buffer[ ( rows - y - 1 ) * width + x ] = min_dist.distance;
}
}