aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/raster
diff options
context:
space:
mode:
Diffstat (limited to 'freetype/src/raster')
-rw-r--r--freetype/src/raster/ftmisc.h21
-rw-r--r--freetype/src/raster/ftraster.c11
-rw-r--r--freetype/src/raster/ftrend1.c13
3 files changed, 33 insertions, 12 deletions
diff --git a/freetype/src/raster/ftmisc.h b/freetype/src/raster/ftmisc.h
index 7773924fe..703155a42 100644
--- a/freetype/src/raster/ftmisc.h
+++ b/freetype/src/raster/ftmisc.h
@@ -115,6 +115,27 @@
return ( s > 0 ) ? d : -d;
}
+
+ static FT_Long
+ FT_MulDiv_No_Round( FT_Long a,
+ FT_Long b,
+ FT_Long c )
+ {
+ FT_Int s;
+ FT_Long d;
+
+
+ s = 1;
+ if ( a < 0 ) { a = -a; s = -1; }
+ if ( b < 0 ) { b = -b; s = -s; }
+ if ( c < 0 ) { c = -c; s = -s; }
+
+ d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c
+ : 0x7FFFFFFFL );
+
+ return ( s > 0 ) ? d : -d;
+ }
+
#endif /* __FTMISC_H__ */
diff --git a/freetype/src/raster/ftraster.c b/freetype/src/raster/ftraster.c
index f85845ec6..7d5bcaef5 100644
--- a/freetype/src/raster/ftraster.c
+++ b/freetype/src/raster/ftraster.c
@@ -60,7 +60,7 @@
#include <ft2build.h>
#include "ftraster.h"
-#include FT_INTERNAL_CALC_H /* for FT_MulDiv only */
+#include FT_INTERNAL_CALC_H /* for FT_MulDiv and FT_MulDiv_No_Round */
#include "rastpic.h"
@@ -255,7 +255,8 @@
/* On the other hand, SMulDiv means `Slow MulDiv', and is used typically */
/* for clipping computations. It simply uses the FT_MulDiv() function */
/* defined in `ftcalc.h'. */
-#define SMulDiv FT_MulDiv
+#define SMulDiv FT_MulDiv
+#define SMulDiv_No_Round FT_MulDiv_No_Round
/* The rasterizer is a very general purpose component; please leave */
/* the following redefinitions there (you never know your target */
@@ -1150,14 +1151,14 @@
if ( Dx > 0 )
{
- Ix = SMulDiv( ras.precision, Dx, Dy);
+ Ix = SMulDiv_No_Round( ras.precision, Dx, Dy );
Rx = ( ras.precision * Dx ) % Dy;
Dx = 1;
}
else
{
- Ix = SMulDiv( ras.precision, -Dx, Dy) * -1;
- Rx = ( ras.precision * -Dx ) % Dy;
+ Ix = -SMulDiv_No_Round( ras.precision, -Dx, Dy );
+ Rx = ( ras.precision * -Dx ) % Dy;
Dx = -1;
}
diff --git a/freetype/src/raster/ftrend1.c b/freetype/src/raster/ftrend1.c
index 28b1b5897..859cb7d86 100644
--- a/freetype/src/raster/ftrend1.c
+++ b/freetype/src/raster/ftrend1.c
@@ -244,10 +244,10 @@
}
- FT_DEFINE_RENDERER(ft_raster1_renderer_class,
-
+ FT_DEFINE_RENDERER( ft_raster1_renderer_class,
+
FT_MODULE_RENDERER,
- sizeof( FT_RendererRec ),
+ sizeof ( FT_RendererRec ),
"raster1",
0x10000L,
@@ -275,11 +275,10 @@
/* to register it by hand in your application. It should only be */
/* used for backwards-compatibility with FT 1.x anyway. */
/* */
- FT_DEFINE_RENDERER(ft_raster5_renderer_class,
-
-
+ FT_DEFINE_RENDERER( ft_raster5_renderer_class,
+
FT_MODULE_RENDERER,
- sizeof( FT_RendererRec ),
+ sizeof ( FT_RendererRec ),
"raster5",
0x10000L,