@ -403,6 +403,11 @@ int main(int arg, char **argv)
# define STBTT_sqrt(x) sqrt(x)
# define STBTT_sqrt(x) sqrt(x)
# endif
# endif
# ifndef STBTT_fabs
# include <math.h>
# define STBTT_fabs(x) fabs(x)
# endif
// #define your own functions "STBTT_malloc" / "STBTT_free" to avoid malloc.h
// #define your own functions "STBTT_malloc" / "STBTT_free" to avoid malloc.h
# ifndef STBTT_malloc
# ifndef STBTT_malloc
# include <stdlib.h>
# include <stdlib.h>
@ -1986,7 +1991,7 @@ static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill,
}
}
y_crossing + = dy * ( x2 - ( x1 + 1 ) ) ;
y_crossing + = dy * ( x2 - ( x1 + 1 ) ) ;
STBTT_assert ( fabs ( area ) < = 1.01f ) ;
STBTT_assert ( STBTT_ fabs( area ) < = 1.01f ) ;
scanline [ x2 ] + = area + sign * ( 1 - ( ( x2 - x2 ) + ( x_bottom - x2 ) ) / 2 ) * ( sy1 - y_crossing ) ;
scanline [ x2 ] + = area + sign * ( 1 - ( ( x2 - x2 ) + ( x_bottom - x2 ) ) / 2 ) * ( sy1 - y_crossing ) ;
@ -2120,7 +2125,7 @@ static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e,
int m ;
int m ;
sum + = scanline2 [ i ] ;
sum + = scanline2 [ i ] ;
k = scanline [ i ] + sum ;
k = scanline [ i ] + sum ;
k = ( float ) fabs ( k ) * 255 + 0.5f ;
k = ( float ) STBTT_ fabs( k ) * 255 + 0.5f ;
m = ( int ) k ;
m = ( int ) k ;
if ( m > 255 ) m = 255 ;
if ( m > 255 ) m = 255 ;
result - > pixels [ j * result - > stride + i ] = ( unsigned char ) m ;
result - > pixels [ j * result - > stride + i ] = ( unsigned char ) m ;