Commit a777e5c2 authored by Marco Pesenti Gritti's avatar Marco Pesenti Gritti

2005-09-16 Marco Pesenti Gritti <mpg@redhat.com>

        * configure.ac:
        * goo/Makefile.am:
        * splash/Makefile.am:
        * splash/SplashFTFont.cc:
        * splash/SplashMath.h:
        * splash/SplashTypes.h:

        Merge support for fixed point
parent 00457c5f
2005-09-16 Marco Pesenti Gritti <mpg@redhat.com>
* configure.ac:
* goo/Makefile.am:
* splash/Makefile.am:
* splash/SplashFTFont.cc:
* splash/SplashMath.h:
* splash/SplashTypes.h:
Merge support for fixed point
2005-09-16 Marco Pesenti Gritti <mpg@redhat.com>
* poppler/ArthurOutputDev.cc:
......
......@@ -23,6 +23,10 @@ AC_DEFINE([OPI_SUPPORT], [1], [Generate OPI comments in PS output.])
AC_DEFINE([MULTITHREADED], [1], [Enable multithreading support.])
AC_DEFINE([TEXTOUT_WORD_LIST], [1], [Enable word list support.])
AC_ARG_ENABLE(fixedpoint,
[ --enable-fixedpoint use fixed point (instead of floating point) arithmetic],
AC_DEFINE(USE_FIXEDPOINT, [], [Use fixed point arithmetic]))
dnl ##### Path to xpdfrc.
dnl This ugly kludge to get the sysconfdir path is needed because
dnl autoconf doesn't actually set the prefix variable until later.
......
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/goo \
$(FREETYPE_CFLAGS)
noinst_LTLIBRARIES = libsplash.la
......
......@@ -116,10 +116,17 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA):
}
// compute the transform matrix
#if USE_FIXEDPOINT
matrix.xx = (FT_Fixed)((mat[0] / size).getRaw());
matrix.yx = (FT_Fixed)((mat[1] / size).getRaw());
matrix.xy = (FT_Fixed)((mat[2] / size).getRaw());
matrix.yy = (FT_Fixed)((mat[3] / size).getRaw());
#else
matrix.xx = (FT_Fixed)((mat[0] / size) * 65536);
matrix.yx = (FT_Fixed)((mat[1] / size) * 65536);
matrix.xy = (FT_Fixed)((mat[2] / size) * 65536);
matrix.yy = (FT_Fixed)((mat[3] / size) * 65536);
#endif
}
SplashFTFont::~SplashFTFont() {
......
......@@ -7,31 +7,59 @@
#ifndef SPLASHMATH_H
#define SPLASHMATH_H
#if USE_FIXEDPONT
#include "FixedPoint.h"
#else
#include <math.h>
#endif
#include "SplashTypes.h"
static inline SplashCoord splashAbs(SplashCoord x) {
#if USE_FIXEDPOINT
return FixedPoint::abs(x);
#else
return fabs(x);
#endif
}
static inline int splashFloor(SplashCoord x) {
return (int)floor(x);
#if USE_FIXEDPOINT
return FixedPoint::floor(x);
#else
return (int)floor(x);
#endif
}
static inline int splashCeil(SplashCoord x) {
#if USE_FIXEDPOINT
return FixedPoint::ceil(x);
#else
return (int)ceil(x);
#endif
}
static inline int splashRound(SplashCoord x) {
#if USE_FIXEDPOINT
return FixedPoint::round(x);
#else
return (int)floor(x + 0.5);
#endif
}
static inline SplashCoord splashSqrt(SplashCoord x) {
#if USE_FIXEDPOINT
return FixedPoint::sqrt(x);
#else
return sqrt(x);
#endif
}
static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) {
#if USE_FIXEDPOINT
return FixedPoint::pow(x, y);
#else
return pow(x, y);
#endif
}
static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0,
......@@ -39,7 +67,11 @@ static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0,
SplashCoord dx, dy;
dx = x1 - x0;
dy = y1 - y0;
#if USE_FIXEDPOINT
return FixedPoint::sqrt(dx * dx + dy * dy);
#else
return sqrt(dx * dx + dy * dy);
#endif
}
#endif
......@@ -13,7 +13,12 @@
// coordinates
//------------------------------------------------------------------------
#if USE_FIXEDPOINT
#include "FixedPoint.h"
typedef FixedPoint SplashCoord;
#else
typedef double SplashCoord;
#endif
//------------------------------------------------------------------------
// colors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment