summaryrefslogtreecommitdiff
path: root/splash
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2019-08-20 21:00:40 +0300
committerAdrian Bunk <bunk@stusta.de>2019-08-20 21:00:40 +0300
commit5b81ab6ce06f60daa63029a3eb12cd31d6852799 (patch)
treebeccba619d6fddb93119bbd175678e5ed599f9a0 /splash
parentd70f77ee6a1bdee8b17f08f3066c0cd685853d21 (diff)
Remove USE_FIXEDPOINT support
This was already non-compiling for some time. Closes #821
Diffstat (limited to 'splash')
-rw-r--r--splash/Splash.cc30
-rw-r--r--splash/SplashFTFont.cc69
-rw-r--r--splash/SplashMath.h53
-rw-r--r--splash/SplashTypes.h5
-rw-r--r--splash/SplashXPath.cc22
5 files changed, 7 insertions, 172 deletions
diff --git a/splash/Splash.cc b/splash/Splash.cc
index 654608cf..074dfe6e 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -2214,11 +2214,7 @@ SplashPath *Splash::flattenPath(SplashPath *path, SplashCoord *matrix,
int i;
fPath = new SplashPath();
-#ifdef USE_FIXEDPOINT
- flatness2 = flatness;
-#else
flatness2 = flatness * flatness;
-#endif
i = 0;
while (i < path->length) {
flag = path->flags[i];
@@ -2283,21 +2279,13 @@ void Splash::flattenCurve(SplashCoord x0, SplashCoord y0,
// line)
transform(matrix, (xl0 + xr3) * 0.5, (yl0 + yr3) * 0.5, &mx, &my);
transform(matrix, xx1, yy1, &tx, &ty);
-#ifdef USE_FIXEDPOINT
- d1 = splashDist(tx, ty, mx, my);
-#else
dx = tx - mx;
dy = ty - my;
d1 = dx*dx + dy*dy;
-#endif
transform(matrix, xx2, yy2, &tx, &ty);
-#ifdef USE_FIXEDPOINT
- d2 = splashDist(tx, ty, mx, my);
-#else
dx = tx - mx;
dy = ty - my;
d2 = dx*dx + dy*dy;
-#endif
// if the curve is flat enough, or no more subdivisions are
// allowed, add the straight line segment
@@ -6087,19 +6075,10 @@ SplashPath *pathIn, *dashPath, *pathOut;
++k1) ;
// compute the deltas for segment (i1, j0)
-#ifdef USE_FIXEDPOINT
- // the 1/d value can be small, which introduces significant
- // inaccuracies in fixed point mode
- d = splashDist(pathIn->pts[i1].x, pathIn->pts[i1].y,
- pathIn->pts[j0].x, pathIn->pts[j0].y);
- dx = (pathIn->pts[j0].x - pathIn->pts[i1].x) / d;
- dy = (pathIn->pts[j0].y - pathIn->pts[i1].y) / d;
-#else
d = (SplashCoord)1 / splashDist(pathIn->pts[i1].x, pathIn->pts[i1].y,
pathIn->pts[j0].x, pathIn->pts[j0].y);
dx = d * (pathIn->pts[j0].x - pathIn->pts[i1].x);
dy = d * (pathIn->pts[j0].y - pathIn->pts[i1].y);
-#endif
wdx = (SplashCoord)0.5 * w * dx;
wdy = (SplashCoord)0.5 * w * dy;
@@ -6188,19 +6167,10 @@ SplashPath *pathIn, *dashPath, *pathOut;
if (!last || closed) {
// compute the deltas for segment (j1, k0)
-#ifdef USE_FIXEDPOINT
- // the 1/d value can be small, which introduces significant
- // inaccuracies in fixed point mode
- d = splashDist(pathIn->pts[j1].x, pathIn->pts[j1].y,
- pathIn->pts[k0].x, pathIn->pts[k0].y);
- dxNext = (pathIn->pts[k0].x - pathIn->pts[j1].x) / d;
- dyNext = (pathIn->pts[k0].y - pathIn->pts[j1].y) / d;
-#else
d = (SplashCoord)1 / splashDist(pathIn->pts[j1].x, pathIn->pts[j1].y,
pathIn->pts[k0].x, pathIn->pts[k0].y);
dxNext = d * (pathIn->pts[k0].x - pathIn->pts[j1].x);
dyNext = d * (pathIn->pts[k0].y - pathIn->pts[j1].y);
-#endif
wdxNext = (SplashCoord)0.5 * w * dxNext;
wdyNext = (SplashCoord)0.5 * w * dyNext;
diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc
index 22c672af..1eafd3ee 100644
--- a/splash/SplashFTFont.cc
+++ b/splash/SplashFTFont.cc
@@ -65,9 +65,6 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
FT_Face face;
int div;
int x, y;
-#ifdef USE_FIXEDPOINT
- SplashCoord scale;
-#endif
face = fontFileA->face;
if (FT_New_Size(face, &sizeObj)) {
@@ -91,60 +88,6 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
div = face->bbox.xMax > 20000 ? 65536 : 1;
-#ifdef USE_FIXEDPOINT
- scale = (SplashCoord)1 / (SplashCoord)face->units_per_EM;
-
- // transform the four corners of the font bounding box -- the min
- // and max values form the bounding box of the transformed font
- x = (int)(mat[0] * (scale * (face->bbox.xMin / div)) +
- mat[2] * (scale * (face->bbox.yMin / div)));
- xMin = xMax = x;
- y = (int)(mat[1] * (scale * (face->bbox.xMin / div)) +
- mat[3] * (scale * (face->bbox.yMin / div)));
- yMin = yMax = y;
- x = (int)(mat[0] * (scale * (face->bbox.xMin / div)) +
- mat[2] * (scale * (face->bbox.yMax / div)));
- if (x < xMin) {
- xMin = x;
- } else if (x > xMax) {
- xMax = x;
- }
- y = (int)(mat[1] * (scale * (face->bbox.xMin / div)) +
- mat[3] * (scale * (face->bbox.yMax / div)));
- if (y < yMin) {
- yMin = y;
- } else if (y > yMax) {
- yMax = y;
- }
- x = (int)(mat[0] * (scale * (face->bbox.xMax / div)) +
- mat[2] * (scale * (face->bbox.yMin / div)));
- if (x < xMin) {
- xMin = x;
- } else if (x > xMax) {
- xMax = x;
- }
- y = (int)(mat[1] * (scale * (face->bbox.xMax / div)) +
- mat[3] * (scale * (face->bbox.yMin / div)));
- if (y < yMin) {
- yMin = y;
- } else if (y > yMax) {
- yMax = y;
- }
- x = (int)(mat[0] * (scale * (face->bbox.xMax / div)) +
- mat[2] * (scale * (face->bbox.yMax / div)));
- if (x < xMin) {
- xMin = x;
- } else if (x > xMax) {
- xMax = x;
- }
- y = (int)(mat[1] * (scale * (face->bbox.xMax / div)) +
- mat[3] * (scale * (face->bbox.yMax / div)));
- if (y < yMin) {
- yMin = y;
- } else if (y > yMax) {
- yMax = y;
- }
-#else // USE_FIXEDPOINT
// transform the four corners of the font bounding box -- the min
// and max values form the bounding box of the transformed font
x = (int)((mat[0] * face->bbox.xMin + mat[2] * face->bbox.yMin) /
@@ -195,7 +138,6 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
} else if (y > yMax) {
yMax = y;
}
-#endif // USE_FIXEDPOINT
// This is a kludge: some buggy PDF generators embed fonts with
// zero bounding boxes.
if (xMax == xMin) {
@@ -208,16 +150,6 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
}
// compute the transform matrix
-#ifdef USE_FIXEDPOINT
- matrix.xx = (FT_Fixed)((mat[0] / size).get16Dot16());
- matrix.yx = (FT_Fixed)((mat[1] / size).get16Dot16());
- matrix.xy = (FT_Fixed)((mat[2] / size).get16Dot16());
- matrix.yy = (FT_Fixed)((mat[3] / size).get16Dot16());
- textMatrix.xx = (FT_Fixed)((textMat[0] / (textScale * size)).get16Dot16());
- textMatrix.yx = (FT_Fixed)((textMat[1] / (textScale * size)).get16Dot16());
- textMatrix.xy = (FT_Fixed)((textMat[2] / (textScale * size)).get16Dot16());
- textMatrix.yy = (FT_Fixed)((textMat[3] / (textScale * size)).get16Dot16());
-#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);
@@ -226,7 +158,6 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA,
textMatrix.yx = (FT_Fixed)((textMat[1] / (textScale * size)) * 65536);
textMatrix.xy = (FT_Fixed)((textMat[2] / (textScale * size)) * 65536);
textMatrix.yy = (FT_Fixed)((textMat[3] / (textScale * size)) * 65536);
-#endif
isOk = true;
}
diff --git a/splash/SplashMath.h b/splash/SplashMath.h
index 8edcf188..bbbce367 100644
--- a/splash/SplashMath.h
+++ b/splash/SplashMath.h
@@ -24,17 +24,11 @@
#include "poppler-config.h"
-#ifdef USE_FIXEDPOINT
-#include "goo/FixedPoint.h"
-#else
#include <math.h>
-#endif
#include "SplashTypes.h"
static inline SplashCoord splashAbs(SplashCoord x) {
-#if defined(USE_FIXEDPOINT)
- return FixedPoint::abs(x);
-#elif defined(USE_FLOAT)
+#if defined(USE_FLOAT)
return fabsf(x);
#else
return fabs(x);
@@ -42,9 +36,7 @@ static inline SplashCoord splashAbs(SplashCoord x) {
}
static inline int splashFloor(SplashCoord x) {
-#if defined(USE_FIXEDPOINT)
- return FixedPoint::floor(x);
-#elif defined(USE_FLOAT)
+#if defined(USE_FLOAT)
return (int)floorf(x);
#elif defined(__GNUC__) && defined(__i386__)
// floor() and (int)() are implemented separately, which results
@@ -89,9 +81,7 @@ static inline int splashFloor(SplashCoord x) {
}
static inline int splashCeil(SplashCoord x) {
-#if defined(USE_FIXEDPOINT)
- return FixedPoint::ceil(x);
-#elif defined(USE_FLOAT)
+#if defined(USE_FLOAT)
return (int)ceilf(x);
#elif defined(__GNUC__) && defined(__i386__)
// ceil() and (int)() are implemented separately, which results
@@ -135,9 +125,7 @@ static inline int splashCeil(SplashCoord x) {
}
static inline int splashRound(SplashCoord x) {
-#if defined(USE_FIXEDPOINT)
- return FixedPoint::round(x);
-#elif defined(__GNUC__) && defined(__i386__)
+#if defined(__GNUC__) && defined(__i386__)
// this could use round-to-nearest mode and avoid the "+0.5",
// but that produces slightly different results (because i+0.5
// sometimes rounds up and sometimes down using the even rule)
@@ -181,17 +169,11 @@ static inline int splashRound(SplashCoord x) {
}
static inline SplashCoord splashAvg(SplashCoord x, SplashCoord y) {
-#ifdef USE_FIXEDPOINT
- return FixedPoint::avg(x, y);
-#else
return 0.5 * (x + y);
-#endif
}
static inline SplashCoord splashSqrt(SplashCoord x) {
-#if defined(USE_FIXEDPOINT)
- return FixedPoint::sqrt(x);
-#elif defined(USE_FLOAT)
+#if defined(USE_FLOAT)
return sqrtf(x);
#else
return sqrt(x);
@@ -199,9 +181,7 @@ static inline SplashCoord splashSqrt(SplashCoord x) {
}
static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) {
-#if defined(USE_FIXEDPOINT)
- return FixedPoint::pow(x, y);
-#elif defined(USE_FLOAT)
+#if defined(USE_FLOAT)
return powf(x, y);
#else
return pow(x, y);
@@ -213,34 +193,13 @@ static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0,
SplashCoord dx, dy;
dx = x1 - x0;
dy = y1 - y0;
-#ifdef USE_FIXEDPOINT
- // this handles the situation where dx*dx or dy*dy is too large to
- // fit in the 16.16 fixed point format
- SplashCoord dxa, dya, d;
- dxa = splashAbs(dx);
- dya = splashAbs(dy);
- if (dxa == 0 && dya == 0) {
- return 0;
- } else if (dxa > dya) {
- d = dya / dxa;
- return dxa * FixedPoint::sqrt(d*d + 1);
- } else {
- d = dxa / dya;
- return dya * FixedPoint::sqrt(d*d + 1);
- }
-#else
return splashSqrt(dx * dx + dy * dy);
-#endif
}
static inline bool splashCheckDet(SplashCoord m11, SplashCoord m12,
SplashCoord m21, SplashCoord m22,
SplashCoord epsilon) {
-#ifdef USE_FIXEDPOINT
- return FixedPoint::checkDet(m11, m12, m21, m22, epsilon);
-#else
return fabs(m11 * m22 - m12 * m21) >= epsilon;
-#endif
}
#endif
diff --git a/splash/SplashTypes.h b/splash/SplashTypes.h
index 812225a1..deb91881 100644
--- a/splash/SplashTypes.h
+++ b/splash/SplashTypes.h
@@ -31,10 +31,7 @@
// coordinates
//------------------------------------------------------------------------
-#if defined(USE_FIXEDPOINT)
-#include "goo/FixedPoint.h"
-typedef FixedPoint SplashCoord;
-#elif defined(USE_FLOAT)
+#if defined(USE_FLOAT)
typedef float SplashCoord;
#else
typedef double SplashCoord;
diff --git a/splash/SplashXPath.cc b/splash/SplashXPath.cc
index 3a939882..cfa065dc 100644
--- a/splash/SplashXPath.cc
+++ b/splash/SplashXPath.cc
@@ -293,11 +293,7 @@ void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0,
SplashCoord dx, dy, mx, my, d1, d2, flatness2;
int p1, p2, p3;
-#ifdef USE_FIXEDPOINT
- flatness2 = flatness;
-#else
flatness2 = flatness * flatness;
-#endif
// initial segment
p1 = 0;
@@ -337,17 +333,12 @@ void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0,
// line)
mx = (xl0 + xr3) * 0.5;
my = (yl0 + yr3) * 0.5;
-#ifdef USE_FIXEDPOINT
- d1 = splashDist(xx1, yy1, mx, my);
- d2 = splashDist(xx2, yy2, mx, my);
-#else
dx = xx1 - mx;
dy = yy1 - my;
d1 = dx*dx + dy*dy;
dx = xx2 - mx;
dy = yy2 - my;
d2 = dx*dx + dy*dy;
-#endif
// if the curve is flat enough, or no more subdivisions are
// allowed, add the straight line segment
@@ -417,21 +408,8 @@ void SplashXPath::addSegment(SplashCoord x0, SplashCoord y0,
segs[length].dxdy = segs[length].dydx = 0;
segs[length].flags |= splashXPathVert;
} else {
-#ifdef USE_FIXEDPOINT
- if (FixedPoint::divCheck(x1 - x0, y1 - y0, &segs[length].dxdy)) {
- segs[length].dydx = (SplashCoord)1 / segs[length].dxdy;
- } else {
- segs[length].dxdy = segs[length].dydx = 0;
- if (splashAbs(x1 - x0) > splashAbs(y1 - y0)) {
- segs[length].flags |= splashXPathHoriz;
- } else {
- segs[length].flags |= splashXPathVert;
- }
- }
-#else
segs[length].dxdy = (x1 - x0) / (y1 - y0);
segs[length].dydx = (SplashCoord)1 / segs[length].dxdy;
-#endif
}
if (y0 > y1) {
segs[length].flags |= splashXPathFlip;