diff options
Diffstat (limited to 'Build/source/libs/poppler/poppler-src/splash')
25 files changed, 173 insertions, 1057 deletions
diff --git a/Build/source/libs/poppler/poppler-src/splash/Makefile.am b/Build/source/libs/poppler/poppler-src/splash/Makefile.am deleted file mode 100644 index 5c265d6360c..00000000000 --- a/Build/source/libs/poppler/poppler-src/splash/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -noinst_LTLIBRARIES = libsplash.la - -if ENABLE_XPDF_HEADERS - -poppler_splash_includedir = $(includedir)/poppler/splash -poppler_splash_include_HEADERS = \ - Splash.h \ - SplashBitmap.h \ - SplashClip.h \ - SplashErrorCodes.h \ - SplashFTFont.h \ - SplashFTFontEngine.h \ - SplashFTFontFile.h \ - SplashFont.h \ - SplashFontEngine.h \ - SplashFontFile.h \ - SplashFontFileID.h \ - SplashGlyphBitmap.h \ - SplashMath.h \ - SplashPath.h \ - SplashPattern.h \ - SplashScreen.h \ - SplashState.h \ - SplashT1Font.h \ - SplashT1FontEngine.h \ - SplashT1FontFile.h \ - SplashTypes.h \ - SplashXPath.h \ - SplashXPathScanner.h - -endif - -libsplash_la_SOURCES = \ - Splash.cc \ - SplashBitmap.cc \ - SplashClip.cc \ - SplashFTFont.cc \ - SplashFTFontEngine.cc \ - SplashFTFontFile.cc \ - SplashFont.cc \ - SplashFontEngine.cc \ - SplashFontFile.cc \ - SplashFontFileID.cc \ - SplashPath.cc \ - SplashPattern.cc \ - SplashScreen.cc \ - SplashState.cc \ - SplashT1Font.cc \ - SplashT1FontEngine.cc \ - SplashT1FontFile.cc \ - SplashXPath.cc \ - SplashXPathScanner.cc - -# SplashBitmap includes JpegWriter.h, TiffWriter.h, PNGWriter.h -if BUILD_LIBJPEG -libjpeg_includes = $(LIBJPEG_CFLAGS) -endif - -if BUILD_LIBTIFF -libtiff_includes = $(LIBTIFF_CFLAGS) -endif - -if BUILD_LIBPNG -libpng_includes = $(LIBPNG_CFLAGS) -endif - -libsplash_la_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/goo \ - $(libjpeg_includes) \ - $(libtiff_includes) \ - $(libpng_includes) \ - $(FREETYPE_CFLAGS) diff --git a/Build/source/libs/poppler/poppler-src/splash/Splash.cc b/Build/source/libs/poppler/poppler-src/splash/Splash.cc index 46b8ce292c2..129d01f02ce 100644 --- a/Build/source/libs/poppler/poppler-src/splash/Splash.cc +++ b/Build/source/libs/poppler/poppler-src/splash/Splash.cc @@ -11,13 +11,13 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2005-2016 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005-2017 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com> // Copyright (C) 2010-2016 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2011-2013, 2015 William Bader <williambader@hotmail.com> // Copyright (C) 2012 Markus Trippelsdorf <markus@trippelsdorf.de> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2012 Matthias Kramm <kramm@quiss.org> // // To see a description of the changes please see the Changelog file that @@ -171,7 +171,7 @@ SplashPipeResultColorCtrl Splash::pipeResultColorNoAlphaBlend[] = { splashPipeResultColorNoAlphaBlendRGB, splashPipeResultColorNoAlphaBlendRGB, splashPipeResultColorNoAlphaBlendRGB -#if SPLASH_CMYK +#ifdef SPLASH_CMYK , splashPipeResultColorNoAlphaBlendCMYK, splashPipeResultColorNoAlphaBlendDeviceN @@ -184,7 +184,7 @@ SplashPipeResultColorCtrl Splash::pipeResultColorAlphaNoBlend[] = { splashPipeResultColorAlphaNoBlendRGB, splashPipeResultColorAlphaNoBlendRGB, splashPipeResultColorAlphaNoBlendRGB -#if SPLASH_CMYK +#ifdef SPLASH_CMYK , splashPipeResultColorAlphaNoBlendCMYK, splashPipeResultColorAlphaNoBlendDeviceN @@ -197,7 +197,7 @@ SplashPipeResultColorCtrl Splash::pipeResultColorAlphaBlend[] = { splashPipeResultColorAlphaBlendRGB, splashPipeResultColorAlphaBlendRGB, splashPipeResultColorAlphaBlendRGB -#if SPLASH_CMYK +#ifdef SPLASH_CMYK , splashPipeResultColorAlphaBlendCMYK, splashPipeResultColorAlphaBlendDeviceN @@ -311,7 +311,7 @@ inline void Splash::pipeInit(SplashPipe *pipe, int x, int y, pipe->run = &Splash::pipeRunSimpleXBGR8; } else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) { pipe->run = &Splash::pipeRunSimpleBGR8; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK } else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) { pipe->run = &Splash::pipeRunSimpleCMYK8; } else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) { @@ -332,7 +332,7 @@ inline void Splash::pipeInit(SplashPipe *pipe, int x, int y, pipe->run = &Splash::pipeRunAAXBGR8; } else if (bitmap->mode == splashModeBGR8 && pipe->destAlphaPtr) { pipe->run = &Splash::pipeRunAABGR8; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK } else if (bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) { pipe->run = &Splash::pipeRunAACMYK8; } else if (bitmap->mode == splashModeDeviceN8 && pipe->destAlphaPtr) { @@ -349,7 +349,7 @@ void Splash::pipeRun(SplashPipe *pipe) { SplashColorPtr cSrc; Guchar cResult0, cResult1, cResult2, cResult3; int t; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK int cp, mask; Guchar cResult[SPOT_NCOMPS+4]; #endif @@ -365,7 +365,7 @@ void Splash::pipeRun(SplashPipe *pipe) { pipeIncX(pipe); return; } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (bitmap->mode == splashModeCMYK8 || bitmap->mode == splashModeDeviceN8) { if (state->fillOverprint && state->overprintMode && pipe->pattern->isCMYK()) { Guint mask = 15; @@ -423,7 +423,7 @@ void Splash::pipeRun(SplashPipe *pipe) { *pipe->destColorPtr++ = state->rgbTransferG[pipe->cSrc[1]]; *pipe->destColorPtr++ = state->rgbTransferR[pipe->cSrc[0]]; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: if (state->overprintMask & 1) { pipe->destColorPtr[0] = (state->overprintAdditive) ? @@ -482,12 +482,12 @@ void Splash::pipeRun(SplashPipe *pipe) { destColorPtr += (alpha0X+pipe->x) * 3; break; case splashModeXBGR8: -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: #endif destColorPtr += (alpha0X+pipe->x) * 4; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeDeviceN8: destColorPtr += (alpha0X+pipe->x) * (SPOT_NCOMPS + 4); break; @@ -519,7 +519,7 @@ void Splash::pipeRun(SplashPipe *pipe) { cDest[1] = destColorPtr[1]; cDest[2] = destColorPtr[0]; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: cDest[0] = destColorPtr[0]; cDest[1] = destColorPtr[1]; @@ -566,7 +566,7 @@ void Splash::pipeRun(SplashPipe *pipe) { } else { t = (aDest * 255) / pipe->shape - aDest; switch (bitmap->mode) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeDeviceN8: for (cp = 0; cp < SPOT_NCOMPS + 4; cp++) cSrcNonIso[cp] = clip255(pipe->cSrc[cp] + @@ -580,12 +580,14 @@ void Splash::pipeRun(SplashPipe *pipe) { #endif case splashModeXBGR8: cSrcNonIso[3] = 255; + // fallthrough case splashModeRGB8: case splashModeBGR8: cSrcNonIso[2] = clip255(pipe->cSrc[2] + ((pipe->cSrc[2] - cDest[2]) * t) / 255); cSrcNonIso[1] = clip255(pipe->cSrc[1] + ((pipe->cSrc[1] - cDest[1]) * t) / 255); + // fallthrough case splashModeMono1: case splashModeMono8: cSrcNonIso[0] = clip255(pipe->cSrc[0] + @@ -605,7 +607,7 @@ void Splash::pipeRun(SplashPipe *pipe) { //----- blend function if (state->blendFunc) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (bitmap->mode == splashModeDeviceN8) { for (int k = 4; k < 4 + SPOT_NCOMPS; k++) { cBlend[k] = 0; @@ -652,7 +654,7 @@ void Splash::pipeRun(SplashPipe *pipe) { cResult2 = state->rgbTransferB[div255((255 - aDest) * cSrc[2] + aDest * cBlend[2])]; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashPipeResultColorNoAlphaBlendCMYK: cResult0 = state->cmykTransferC[div255((255 - aDest) * cSrc[0] + aDest * cBlend[0])]; @@ -692,7 +694,7 @@ void Splash::pipeRun(SplashPipe *pipe) { aSrc * cSrc[2]) / alphaI]; } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashPipeResultColorAlphaNoBlendCMYK: if (alphaI == 0) { cResult0 = 0; @@ -752,7 +754,7 @@ void Splash::pipeRun(SplashPipe *pipe) { alphaI]; } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashPipeResultColorAlphaBlendCMYK: if (alphaI == 0) { cResult0 = 0; @@ -826,7 +828,7 @@ void Splash::pipeRun(SplashPipe *pipe) { *pipe->destColorPtr++ = cResult1; *pipe->destColorPtr++ = cResult0; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: if (state->overprintMask & 1) { pipe->destColorPtr[0] = (state->overprintAdditive) ? @@ -943,7 +945,7 @@ void Splash::pipeRunSimpleBGR8(SplashPipe *pipe) { ++pipe->x; } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK // special case: // !pipe->pattern && pipe->noTransparency && !state->blendFunc && // bitmap->mode == splashModeCMYK8 && pipe->destAlphaPtr) { @@ -1204,7 +1206,7 @@ void Splash::pipeRunAABGR8(SplashPipe *pipe) { ++pipe->x; } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK // special case: // !pipe->pattern && !pipe->noTransparency && !state->softMask && // pipe->usesShape && !pipe->alpha0Ptr && !state->blendFunc && @@ -1343,7 +1345,7 @@ inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) { case splashModeXBGR8: pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x]; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: pipe->destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x]; break; @@ -1388,7 +1390,7 @@ inline void Splash::pipeIncX(SplashPipe *pipe) { case splashModeXBGR8: pipe->destColorPtr += 4; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: pipe->destColorPtr += 4; break; @@ -1965,7 +1967,7 @@ void Splash::clear(SplashColorPtr color, Guchar alpha) { } } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: if (color[0] == color[1] && color[1] == color[2] && color[2] == color[3]) { if (bitmap->rowSize < 0) { @@ -2186,7 +2188,7 @@ SplashPath *Splash::flattenPath(SplashPath *path, SplashCoord *matrix, int i; fPath = new SplashPath(); -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT flatness2 = flatness; #else flatness2 = flatness * flatness; @@ -2255,7 +2257,7 @@ 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); -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT d1 = splashDist(tx, ty, mx, my); #else dx = tx - mx; @@ -2263,7 +2265,7 @@ void Splash::flattenCurve(SplashCoord x0, SplashCoord y0, d1 = dx*dx + dy*dy; #endif transform(matrix, xx2, yy2, &tx, &ty); -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT d2 = splashDist(tx, ty, mx, my); #else dx = tx - mx; @@ -3710,7 +3712,7 @@ SplashError Splash::drawImage(SplashImageSource src, SplashICCTransform tf, void ok = srcMode == splashModeBGR8; nComps = 3; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: ok = srcMode == splashModeCMYK8; nComps = 4; @@ -4134,7 +4136,7 @@ SplashError Splash::arbitraryTransformImage(SplashImageSource src, SplashICCTran static GBool isImageInterpolationRequired(int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, GBool interpolate) { - if (interpolate) + if (interpolate || srcWidth == 0 || srcHeight == 0) return gTrue; /* When scale factor is >= 400% we don't interpolate. See bugs #25268, #9860 */ @@ -4152,7 +4154,7 @@ SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData, SplashBitmap *dest; dest = new SplashBitmap(scaledWidth, scaledHeight, 1, srcMode, srcAlpha, gTrue, bitmap->getSeparationList()); - if (dest->getDataPtr() != NULL) { + if (dest->getDataPtr() != NULL && srcHeight > 0 && srcWidth > 0) { if (scaledHeight < srcHeight) { if (scaledWidth < srcWidth) { scaleImageYdXd(src, srcData, srcMode, nComps, srcAlpha, @@ -4190,7 +4192,7 @@ void Splash::scaleImageYdXd(SplashImageSource src, void *srcData, Guchar *lineBuf, *alphaLineBuf; Guint *pixBuf, *alphaPixBuf; Guint pix0, pix1, pix2; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK Guint pix3; Guint pix[SPOT_NCOMPS+4], cp; #endif @@ -4348,7 +4350,7 @@ void Splash::scaleImageYdXd(SplashImageSource src, void *srcData, *destPtr++ = (Guchar)pix0; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: // compute the final pixel @@ -4533,7 +4535,7 @@ void Splash::scaleImageYdXu(SplashImageSource src, void *srcData, *destPtr++ = (Guchar)pix[0]; } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: for (i = 0; i < xStep; ++i) { *destPtr++ = (Guchar)pix[0]; @@ -4683,7 +4685,7 @@ void Splash::scaleImageYuXd(SplashImageSource src, void *srcData, *destPtr++ = (Guchar)pix[0]; } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: for (i = 0; i < yStep; ++i) { destPtr = destPtr0 + (i * scaledWidth + x) * nComps; @@ -4836,7 +4838,7 @@ void Splash::scaleImageYuXu(SplashImageSource src, void *srcData, } } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: for (i = 0; i < yStep; ++i) { for (j = 0; j < xStep; ++j) { @@ -4997,7 +4999,7 @@ void Splash::scaleImageYuXuBilinear(SplashImageSource src, void *srcData, *destPtr++ = (Guchar)pix[1]; *destPtr++ = (Guchar)pix[0]; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: *destPtr++ = (Guchar)pix[0]; *destPtr++ = (Guchar)pix[1]; @@ -5324,7 +5326,7 @@ void Splash::compositeBackground(SplashColorPtr color) { SplashColorPtr p; Guchar *q; Guchar alpha, alpha1, c, color0, color1, color2; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK Guchar color3; Guchar colorsp[SPOT_NCOMPS+4], cp; #endif @@ -5426,7 +5428,7 @@ void Splash::compositeBackground(SplashColorPtr color) { } } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: color0 = color[0]; color1 = color[1]; @@ -5535,7 +5537,7 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) case splashModeXBGR8: colorComps=4; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: colorComps=4; break; @@ -5876,7 +5878,7 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc, } } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: for (y = 0; y < h; ++y) { p = &bitmap->data[(yDest + y) * bitmap->rowSize + 4 * xDest]; @@ -6025,7 +6027,7 @@ SplashPath *pathIn, *dashPath, *pathOut; ++k1) ; // compute the deltas for segment (i1, j0) -#if USE_FIXEDPOINT +#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, @@ -6126,7 +6128,7 @@ SplashPath *pathIn, *dashPath, *pathOut; if (!last || closed) { // compute the deltas for segment (j1, k0) -#if USE_FIXEDPOINT +#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, diff --git a/Build/source/libs/poppler/poppler-src/splash/Splash.h b/Build/source/libs/poppler/poppler-src/splash/Splash.h index 3ca15c38bce..907e4c3b6ee 100644 --- a/Build/source/libs/poppler/poppler-src/splash/Splash.h +++ b/Build/source/libs/poppler/poppler-src/splash/Splash.h @@ -15,7 +15,7 @@ // Copyright (C) 2007, 2011 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2010-2013, 2015 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -62,7 +62,7 @@ typedef void (*SplashICCTransform)(void *data, SplashBitmap *bitmap); //------------------------------------------------------------------------ enum SplashPipeResultColorCtrl { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK splashPipeResultColorNoAlphaBlendCMYK, splashPipeResultColorNoAlphaBlendDeviceN, #endif @@ -70,13 +70,13 @@ enum SplashPipeResultColorCtrl { splashPipeResultColorNoAlphaBlendMono, splashPipeResultColorAlphaNoBlendMono, splashPipeResultColorAlphaNoBlendRGB, -#if SPLASH_CMYK +#ifdef SPLASH_CMYK splashPipeResultColorAlphaNoBlendCMYK, splashPipeResultColorAlphaNoBlendDeviceN, #endif splashPipeResultColorAlphaBlendMono, splashPipeResultColorAlphaBlendRGB -#if SPLASH_CMYK +#ifdef SPLASH_CMYK , splashPipeResultColorAlphaBlendCMYK, splashPipeResultColorAlphaBlendDeviceN @@ -298,7 +298,7 @@ private: void pipeRunSimpleRGB8(SplashPipe *pipe); void pipeRunSimpleXBGR8(SplashPipe *pipe); void pipeRunSimpleBGR8(SplashPipe *pipe); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK void pipeRunSimpleCMYK8(SplashPipe *pipe); void pipeRunSimpleDeviceN8(SplashPipe *pipe); #endif @@ -307,7 +307,7 @@ private: void pipeRunAARGB8(SplashPipe *pipe); void pipeRunAAXBGR8(SplashPipe *pipe); void pipeRunAABGR8(SplashPipe *pipe); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK void pipeRunAACMYK8(SplashPipe *pipe); void pipeRunAADeviceN8(SplashPipe *pipe); #endif diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.cc b/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.cc index e9b2be421c8..5acee7d0bd6 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.cc +++ b/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.cc @@ -15,7 +15,7 @@ // Copyright (C) 2007 Ilmari Heikkinen <ilmari.heikkinen@gmail.com> // Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2010, 2012 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2010, 2012, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2010 Harry Roberts <harry.roberts@midnight-labs.org> // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2010, 2015 William Bader <williambader@hotmail.com> @@ -90,7 +90,7 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA, rowSize = -1; } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: if (width > 0 && width <= INT_MAX / 4) { rowSize = width * 4; @@ -247,7 +247,7 @@ SplashError SplashBitmap::writePNMFile(FILE *f) { } break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: case splashModeDeviceN8: // PNM doesn't support CMYK @@ -308,7 +308,7 @@ void SplashBitmap::getPixel(int x, int y, SplashColorPtr pixel) { pixel[1] = p[1]; pixel[2] = p[0]; break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: p = &data[y * rowSize + 4 * x]; pixel[0] = p[0]; @@ -337,7 +337,7 @@ SplashColorPtr SplashBitmap::takeData() { return data2; } -SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI, const char *compressionString) { +SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI, WriteImgParams* params) { FILE *f; SplashError e; @@ -345,13 +345,24 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, char *fileN return splashErrOpenFile; } - e = writeImgFile(format, f, hDPI, vDPI, compressionString); - + e = writeImgFile(format, f, hDPI, vDPI, params); + fclose(f); return e; } -SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI, const char *compressionString) { +void SplashBitmap::setJpegParams(ImgWriter *writer, WriteImgParams* params) +{ +#ifdef ENABLE_LIBJPEG + if (params) { + static_cast<JpegWriter*>(writer)->setProgressive(params->jpegProgressive); + if (params->jpegQuality >= 0) + static_cast<JpegWriter*>(writer)->setQuality(params->jpegQuality); + } +#endif +} + +SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI, WriteImgParams* params) { ImgWriter *writer; SplashError e; @@ -365,13 +376,15 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in #endif #ifdef ENABLE_LIBJPEG - #if SPLASH_CMYK + #ifdef SPLASH_CMYK case splashFormatJpegCMYK: writer = new JpegWriter(JpegWriter::CMYK); + setJpegParams(writer, params); break; #endif case splashFormatJpeg: writer = new JpegWriter(); + setJpegParams(writer, params); break; #endif @@ -390,7 +403,7 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in case splashModeBGR8: writer = new TiffWriter(TiffWriter::RGB); break; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: case splashModeDeviceN8: writer = new TiffWriter(TiffWriter::CMYK); @@ -400,8 +413,8 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in fprintf(stderr, "TiffWriter: Mode %d not supported\n", mode); writer = new TiffWriter(); } - if (writer) { - ((TiffWriter *)writer)->setCompressionString(compressionString); + if (writer && params) { + ((TiffWriter *)writer)->setCompressionString(params->tiffCompression.getCString()); } break; #endif @@ -430,7 +443,7 @@ void SplashBitmap::getRGBLine(int yl, SplashColorPtr line) { m = byteToDbl(col[1]); y = byteToDbl(col[2]); k = byteToDbl(col[3]); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (separationList->getLength() > 0) { for (int i = 0; i < separationList->getLength(); i++) { if (col[i+4] > 0) { @@ -476,7 +489,7 @@ void SplashBitmap::getXBGRLine(int yl, SplashColorPtr line, ConversionMode conve m = byteToDbl(col[1]); y = byteToDbl(col[2]); k = byteToDbl(col[3]); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK if (separationList->getLength() > 0) { for (int i = 0; i < separationList->getLength(); i++) { if (col[i+4] > 0) { @@ -580,7 +593,7 @@ GBool SplashBitmap::convertToXBGR(ConversionMode conversionMode) { return newdata != NULL; } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK void SplashBitmap::getCMYKLine(int yl, SplashColorPtr line) { SplashColor col; @@ -624,7 +637,7 @@ void SplashBitmap::getCMYKLine(int yl, SplashColorPtr line) { SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI, SplashColorMode imageWriterFormat) { if (mode != splashModeRGB8 && mode != splashModeMono8 && mode != splashModeMono1 && mode != splashModeXBGR8 && mode != splashModeBGR8 -#if SPLASH_CMYK +#ifdef SPLASH_CMYK && mode != splashModeCMYK8 && mode != splashModeDeviceN8 #endif ) { @@ -637,7 +650,7 @@ SplashError SplashBitmap::writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int } switch (mode) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK case splashModeCMYK8: if (writer->supportCMYK()) { SplashColorPtr row; diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.h b/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.h index 6858f90f357..ccd3e7d955c 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashBitmap.h @@ -15,7 +15,7 @@ // Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> // Copyright (C) 2009, 2012 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2010 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2010, 2017 Adrian Johnson <ajohnson@redneon.com> // Copyright (C) 2010 Harry Roberts <harry.roberts@midnight-labs.org> // Copyright (C) 2010 Christian Feuersänger <cfeuersaenger@googlemail.com> // Copyright (C) 2010 William Bader <williambader@hotmail.com> @@ -72,9 +72,16 @@ public: SplashError writePNMFile(char *fileName); SplashError writePNMFile(FILE *f); SplashError writeAlphaPGMFile(char *fileName); - - SplashError writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI, const char *compressionString = ""); - SplashError writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI, const char *compressionString = ""); + + struct WriteImgParams + { + int jpegQuality = -1; + GBool jpegProgressive = gFalse; + GooString tiffCompression; + }; + + SplashError writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI, WriteImgParams* params = nullptr); + SplashError writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI, WriteImgParams* params = nullptr); SplashError writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI, SplashColorMode imageWriterFormat); enum ConversionMode @@ -89,7 +96,7 @@ public: void getPixel(int x, int y, SplashColorPtr pixel); void getRGBLine(int y, SplashColorPtr line); void getXBGRLine(int y, SplashColorPtr line, ConversionMode conversionMode = conversionOpaque); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK void getCMYKLine(int y, SplashColorPtr line); #endif Guchar getAlpha(int x, int y); @@ -112,6 +119,8 @@ private: GooList *separationList; // list of spot colorants and their mapping functions friend class Splash; + + void setJpegParams(ImgWriter *writer, WriteImgParams* params); }; #endif diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashFTFont.cc b/Build/source/libs/poppler/poppler-src/splash/SplashFTFont.cc index b785826d66b..91226da0421 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashFTFont.cc +++ b/Build/source/libs/poppler/poppler-src/splash/SplashFTFont.cc @@ -17,6 +17,7 @@ // Copyright (C) 2010 Suzuki Toshiya <mpsuzuki@hiroshima-u.ac.jp> // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> // Copyright (C) 2012 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -25,8 +26,6 @@ #include <config.h> -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - #ifdef USE_GCC_PRAGMAS #pragma implementation #endif @@ -65,7 +64,7 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA, FT_Face face; int div; int x, y; -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT SplashCoord scale; #endif @@ -87,7 +86,7 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA, div = face->bbox.xMax > 20000 ? 65536 : 1; -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT scale = (SplashCoord)1 / (SplashCoord)face->units_per_EM; // transform the four corners of the font bounding box -- the min @@ -204,7 +203,7 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA, } // compute the transform matrix -#if USE_FIXEDPOINT +#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()); @@ -509,5 +508,3 @@ static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2, p->needClose = gTrue; return 0; } - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashFTFont.h b/Build/source/libs/poppler/poppler-src/splash/SplashFTFont.h index 98cb29dfbba..5f0d197669b 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashFTFont.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashFTFont.h @@ -14,6 +14,7 @@ // Copyright (C) 2007-2009, 2011 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -25,8 +26,6 @@ #include "poppler-config.h" -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - #ifdef USE_GCC_PRAGMAS #pragma interface #endif @@ -50,19 +49,19 @@ public: virtual ~SplashFTFont(); // Munge xFrac and yFrac before calling SplashFont::getGlyph. - virtual GBool getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); + GBool getGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) override; // Rasterize a glyph. The <xFrac> and <yFrac> values are the same // as described for getGlyph. - virtual GBool makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); + GBool makeGlyph(int c, int xFrac, int yFrac, + SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) override; // Return the path for a glyph. - virtual SplashPath *getGlyphPath(int c); + SplashPath *getGlyphPath(int c) override; // Return the advance of a glyph. (in 0..1 range) - virtual double getGlyphAdvance(int c); + double getGlyphAdvance(int c) override; private: @@ -75,6 +74,4 @@ private: GBool enableSlightHinting; }; -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - #endif diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashFTFontEngine.cc b/Build/source/libs/poppler/poppler-src/splash/SplashFTFontEngine.cc index 9fef8f007d1..9b20f4a17ab 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashFTFontEngine.cc +++ b/Build/source/libs/poppler/poppler-src/splash/SplashFTFontEngine.cc @@ -15,6 +15,7 @@ // Copyright (C) 2009, 2011, 2012 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com> // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -23,8 +24,6 @@ #include <config.h> -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - #ifdef USE_GCC_PRAGMAS #pragma implementation #endif @@ -176,5 +175,3 @@ SplashFontFile *SplashFTFontEngine::loadTrueTypeFont(SplashFontFileID *idA, faceIndex); return ret; } - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashFTFontEngine.h b/Build/source/libs/poppler/poppler-src/splash/SplashFTFontEngine.h index 11bbea74a80..899458bc5a7 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashFTFontEngine.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashFTFontEngine.h @@ -16,6 +16,7 @@ // Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -25,8 +26,6 @@ #ifndef SPLASHFTFONTENGINE_H #define SPLASHFTFONTENGINE_H -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - #ifdef USE_GCC_PRAGMAS #pragma interface #endif @@ -76,6 +75,4 @@ private: friend class SplashFTFont; }; -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - #endif diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashFTFontFile.cc b/Build/source/libs/poppler/poppler-src/splash/SplashFTFontFile.cc index f0dcf50384b..3c070b70178 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashFTFontFile.cc +++ b/Build/source/libs/poppler/poppler-src/splash/SplashFTFontFile.cc @@ -12,7 +12,8 @@ // under GPL version 2 or later // // Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2014 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2014, 2017 Adrian Johnson <ajohnson@redneon.com> +// Copyright (C) 2017 Oliver Sander <oliver.sander@tu-dresden.de> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -21,8 +22,6 @@ #include <config.h> -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - #ifdef USE_GCC_PRAGMAS #pragma implementation #endif @@ -145,4 +144,6 @@ SplashFont *SplashFTFontFile::makeFont(SplashCoord *mat, return font; } -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H +int *SplashFTFontFile::getCodeToGID() { + return codeToGID; +} diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashFTFontFile.h b/Build/source/libs/poppler/poppler-src/splash/SplashFTFontFile.h index d642af0a0ab..5931be3fe73 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashFTFontFile.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashFTFontFile.h @@ -12,6 +12,8 @@ // under GPL version 2 or later // // Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> +// Copyright (C) 2017 Oliver Sander <oliver.sander@tu-dresden.de> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -21,8 +23,6 @@ #ifndef SPLASHFTFONTFILE_H #define SPLASHFTFONTFILE_H -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - #ifdef USE_GCC_PRAGMAS #pragma interface #endif @@ -55,12 +55,15 @@ public: int codeToGIDLenA, int faceIndexA=0); - virtual ~SplashFTFontFile(); + ~SplashFTFontFile(); // Create a new SplashFTFont, i.e., a scaled instance of this font // file. - virtual SplashFont *makeFont(SplashCoord *mat, - SplashCoord *textMat); + SplashFont *makeFont(SplashCoord *mat, + SplashCoord *textMat) override; + + // Provide access to the code-to-GID map + int* getCodeToGID(); private: @@ -81,6 +84,4 @@ private: friend class SplashFTFont; }; -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - #endif diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashFontEngine.cc b/Build/source/libs/poppler/poppler-src/splash/SplashFontEngine.cc index 73ef8de0877..62e5a0199bf 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashFontEngine.cc +++ b/Build/source/libs/poppler/poppler-src/splash/SplashFontEngine.cc @@ -18,6 +18,7 @@ // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2015 Dmytro Morgun <lztoad@gmail.com> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -30,10 +31,6 @@ #pragma implementation #endif -#if HAVE_T1LIB_H -#include <t1lib.h> -#endif - #include <stdlib.h> #include <stdio.h> #ifdef HAVE_UNISTD_H @@ -42,7 +39,6 @@ #include "goo/gmem.h" #include "goo/GooString.h" #include "SplashMath.h" -#include "SplashT1FontEngine.h" #include "SplashFTFontEngine.h" #include "SplashFontFile.h" #include "SplashFontFileID.h" @@ -66,14 +62,9 @@ extern "C" int unlink(char *filename); //------------------------------------------------------------------------ SplashFontEngine::SplashFontEngine( -#if HAVE_T1LIB_H - GBool enableT1lib, -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H GBool enableFreeType, GBool enableFreeTypeHinting, GBool enableSlightHinting, -#endif GBool aa) { int i; @@ -81,20 +72,11 @@ SplashFontEngine::SplashFontEngine( fontCache[i] = NULL; } -#if HAVE_T1LIB_H - if (enableT1lib) { - t1Engine = SplashT1FontEngine::init(aa); - } else { - t1Engine = NULL; - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H if (enableFreeType) { ftEngine = SplashFTFontEngine::init(aa, enableFreeTypeHinting, enableSlightHinting); } else { ftEngine = NULL; } -#endif } SplashFontEngine::~SplashFontEngine() { @@ -106,16 +88,9 @@ SplashFontEngine::~SplashFontEngine() { } } -#if HAVE_T1LIB_H - if (t1Engine) { - delete t1Engine; - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H if (ftEngine) { delete ftEngine; } -#endif } SplashFontFile *SplashFontEngine::getFontFile(SplashFontFileID *id) { @@ -139,16 +114,9 @@ SplashFontFile *SplashFontEngine::loadType1Font(SplashFontFileID *idA, SplashFontFile *fontFile; fontFile = NULL; -#if HAVE_T1LIB_H - if (!fontFile && t1Engine) { - fontFile = t1Engine->loadType1Font(idA, src, enc); - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H if (!fontFile && ftEngine) { fontFile = ftEngine->loadType1Font(idA, src, enc); } -#endif // delete the (temporary) font file -- with Unix hard link // semantics, this will remove the last link; otherwise it will @@ -166,16 +134,9 @@ SplashFontFile *SplashFontEngine::loadType1CFont(SplashFontFileID *idA, SplashFontFile *fontFile; fontFile = NULL; -#if HAVE_T1LIB_H - if (!fontFile && t1Engine) { - fontFile = t1Engine->loadType1CFont(idA, src, enc); - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H if (!fontFile && ftEngine) { fontFile = ftEngine->loadType1CFont(idA, src, enc); } -#endif // delete the (temporary) font file -- with Unix hard link // semantics, this will remove the last link; otherwise it will @@ -193,11 +154,9 @@ SplashFontFile *SplashFontEngine::loadOpenTypeT1CFont(SplashFontFileID *idA, SplashFontFile *fontFile; fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H if (!fontFile && ftEngine) { fontFile = ftEngine->loadOpenTypeT1CFont(idA, src, enc); } -#endif // delete the (temporary) font file -- with Unix hard link // semantics, this will remove the last link; otherwise it will @@ -214,11 +173,9 @@ SplashFontFile *SplashFontEngine::loadCIDFont(SplashFontFileID *idA, SplashFontFile *fontFile; fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H if (!fontFile && ftEngine) { fontFile = ftEngine->loadCIDFont(idA, src); } -#endif // delete the (temporary) font file -- with Unix hard link // semantics, this will remove the last link; otherwise it will @@ -237,11 +194,9 @@ SplashFontFile *SplashFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA, SplashFontFile *fontFile; fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H if (!fontFile && ftEngine) { fontFile = ftEngine->loadOpenTypeCFFFont(idA, src, codeToGID, codeToGIDLen); } -#endif // delete the (temporary) font file -- with Unix hard link // semantics, this will remove the last link; otherwise it will @@ -261,12 +216,10 @@ SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA, SplashFontFile *fontFile; fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H if (!fontFile && ftEngine) { fontFile = ftEngine->loadTrueTypeFont(idA, src, codeToGID, codeToGIDLen, faceIndex); } -#endif if (!fontFile) { gfree(codeToGID); @@ -282,7 +235,6 @@ SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA, return fontFile; } -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H GBool SplashFontEngine::getAA() { return (ftEngine == NULL) ? gFalse : ftEngine->getAA(); } @@ -292,7 +244,6 @@ void SplashFontEngine::setAA(GBool aa) { ftEngine->setAA(aa); } } -#endif SplashFont *SplashFontEngine::getFont(SplashFontFile *fontFile, SplashCoord *textMat, diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashFontEngine.h b/Build/source/libs/poppler/poppler-src/splash/SplashFontEngine.h index 6502ea5a7fa..e3ee1ce600d 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashFontEngine.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashFontEngine.h @@ -16,6 +16,7 @@ // Copyright (C) 2009, 2011 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2011 Andreas Hartmetz <ahartmetz@gmail.com> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -54,14 +55,9 @@ public: // Create a font engine. SplashFontEngine( -#if HAVE_T1LIB_H - GBool enableT1lib, -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H GBool enableFreeType, GBool enableFreeTypeHinting, GBool enableSlightHinting, -#endif GBool aa); ~SplashFontEngine(); @@ -90,21 +86,14 @@ public: // Note that the Splash y axis points downward. SplashFont *getFont(SplashFontFile *fontFile, SplashCoord *textMat, SplashCoord *ctm); -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H GBool getAA(); void setAA(GBool aa); -#endif private: SplashFont *fontCache[splashFontCacheSize]; -#if HAVE_T1LIB_H - SplashT1FontEngine *t1Engine; -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H SplashFTFontEngine *ftEngine; -#endif }; #endif diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashMath.h b/Build/source/libs/poppler/poppler-src/splash/SplashMath.h index ca73c2bd1f3..36793ea3fcd 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashMath.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashMath.h @@ -12,6 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2009-2011 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -23,7 +24,7 @@ #include "poppler-config.h" -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT #include "goo/FixedPoint.h" #else #include <math.h> @@ -31,9 +32,9 @@ #include "SplashTypes.h" static inline SplashCoord splashAbs(SplashCoord x) { -#if USE_FIXEDPOINT +#if defined(USE_FIXEDPOINT) return FixedPoint::abs(x); -#elif USE_FLOAT +#elif defined(USE_FLOAT) return fabsf(x); #else return fabs(x); @@ -41,11 +42,11 @@ static inline SplashCoord splashAbs(SplashCoord x) { } static inline int splashFloor(SplashCoord x) { - #if USE_FIXEDPOINT +#if defined(USE_FIXEDPOINT) return FixedPoint::floor(x); - #elif USE_FLOAT +#elif defined(USE_FLOAT) return (int)floorf(x); - #elif __GNUC__ && __i386__ +#elif defined(__GNUC__) && defined(__i386__) // floor() and (int)() are implemented separately, which results // in changing the FPCW multiple times - so we optimize it with // some inline assembly @@ -64,7 +65,7 @@ static inline int splashFloor(SplashCoord x) { : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t) : "m" (x)); return result; - #elif defined(WIN32) && defined(_M_IX86) +#elif defined(_WIN32) && defined(_M_IX86) // floor() and (int)() are implemented separately, which results // in changing the FPCW multiple times - so we optimize it with // some inline assembly @@ -81,18 +82,18 @@ static inline int splashFloor(SplashCoord x) { __asm fistp DWORD PTR result __asm fldcw WORD PTR oldCW return result; - #else +#else if (x > 0) return (int)x; else return (int)floor(x); - #endif +#endif } static inline int splashCeil(SplashCoord x) { -#if USE_FIXEDPOINT +#if defined(USE_FIXEDPOINT) return FixedPoint::ceil(x); -#elif USE_FLOAT +#elif defined(USE_FLOAT) return (int)ceilf(x); -#elif __GNUC__ && __i386__ +#elif defined(__GNUC__) && defined(__i386__) // ceil() and (int)() are implemented separately, which results // in changing the FPCW multiple times - so we optimize it with // some inline assembly @@ -111,7 +112,7 @@ static inline int splashCeil(SplashCoord x) { : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t) : "m" (x)); return result; -#elif defined(WIN32) && defined(_M_IX86) +#elif defined(_WIN32) && defined(_M_IX86) // ceil() and (int)() are implemented separately, which results // in changing the FPCW multiple times - so we optimize it with // some inline assembly @@ -134,9 +135,9 @@ static inline int splashCeil(SplashCoord x) { } static inline int splashRound(SplashCoord x) { -#if USE_FIXEDPOINT +#if defined(USE_FIXEDPOINT) return FixedPoint::round(x); -#elif __GNUC__ && __i386__ +#elif 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) @@ -156,7 +157,7 @@ static inline int splashRound(SplashCoord x) { : "=m" (oldCW), "=m" (newCW), "=m" (result), "=r" (t) : "m" (x)); return result; -#elif defined(WIN32) && defined(_M_IX86) +#elif defined(_WIN32) && defined(_M_IX86) // 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) @@ -180,7 +181,7 @@ static inline int splashRound(SplashCoord x) { } static inline SplashCoord splashAvg(SplashCoord x, SplashCoord y) { -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT return FixedPoint::avg(x, y); #else return 0.5 * (x + y); @@ -188,9 +189,9 @@ static inline SplashCoord splashAvg(SplashCoord x, SplashCoord y) { } static inline SplashCoord splashSqrt(SplashCoord x) { -#if USE_FIXEDPOINT +#if defined(USE_FIXEDPOINT) return FixedPoint::sqrt(x); -#elif USE_FLOAT +#elif defined(USE_FLOAT) return sqrtf(x); #else return sqrt(x); @@ -198,9 +199,9 @@ static inline SplashCoord splashSqrt(SplashCoord x) { } static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) { -#if USE_FIXEDPOINT +#if defined(USE_FIXEDPOINT) return FixedPoint::pow(x, y); -#elif USE_FLOAT +#elif defined(USE_FLOAT) return powf(x, y); #else return pow(x, y); @@ -212,7 +213,7 @@ static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0, SplashCoord dx, dy; dx = x1 - x0; dy = y1 - y0; -#if USE_FIXEDPOINT +#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; @@ -235,7 +236,7 @@ static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0, static inline GBool splashCheckDet(SplashCoord m11, SplashCoord m12, SplashCoord m21, SplashCoord m22, SplashCoord epsilon) { -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT return FixedPoint::checkDet(m11, m12, m21, m22, epsilon); #else return fabs(m11 * m22 - m12 * m21) >= epsilon; diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashPattern.h b/Build/source/libs/poppler/poppler-src/splash/SplashPattern.h index e678c9e20e6..1e2881c812e 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashPattern.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashPattern.h @@ -66,17 +66,17 @@ public: SplashSolidColor(SplashColorPtr colorA); - virtual SplashPattern *copy() { return new SplashSolidColor(color); } + SplashPattern *copy() override { return new SplashSolidColor(color); } - virtual ~SplashSolidColor(); + ~SplashSolidColor(); - virtual GBool getColor(int x, int y, SplashColorPtr c); + GBool getColor(int x, int y, SplashColorPtr c) override; - virtual GBool testPosition(int x, int y) { return gFalse; } + GBool testPosition(int x, int y) override { return gFalse; } - virtual GBool isStatic() { return gTrue; } + GBool isStatic() override { return gTrue; } - virtual GBool isCMYK() { return gFalse; } + GBool isCMYK() override { return gFalse; } private: diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashState.cc b/Build/source/libs/poppler/poppler-src/splash/SplashState.cc index f0c98c5eff7..abd940842ae 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashState.cc +++ b/Build/source/libs/poppler/poppler-src/splash/SplashState.cc @@ -12,6 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2009, 2011, 2012, 2015 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -39,7 +40,7 @@ // number of components in each color mode int splashColorModeNComps[] = { 1, 1, 3, 3, 4 -#if SPLASH_CMYK +#ifdef SPLASH_CMYK , 4, 4 + SPOT_NCOMPS #endif }; @@ -83,7 +84,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, rgbTransferG[i] = (Guchar)i; rgbTransferB[i] = (Guchar)i; grayTransfer[i] = (Guchar)i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK cmykTransferC[i] = (Guchar)i; cmykTransferM[i] = (Guchar)i; cmykTransferY[i] = (Guchar)i; @@ -136,7 +137,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, rgbTransferG[i] = (Guchar)i; rgbTransferB[i] = (Guchar)i; grayTransfer[i] = (Guchar)i; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK cmykTransferC[i] = (Guchar)i; cmykTransferM[i] = (Guchar)i; cmykTransferY[i] = (Guchar)i; @@ -187,7 +188,7 @@ SplashState::SplashState(SplashState *state) { memcpy(rgbTransferG, state->rgbTransferG, 256); memcpy(rgbTransferB, state->rgbTransferB, 256); memcpy(grayTransfer, state->grayTransfer, 256); -#if SPLASH_CMYK +#ifdef SPLASH_CMYK memcpy(cmykTransferC, state->cmykTransferC, 256); memcpy(cmykTransferM, state->cmykTransferM, 256); memcpy(cmykTransferY, state->cmykTransferY, 256); @@ -249,7 +250,7 @@ void SplashState::setSoftMask(SplashBitmap *softMaskA) { void SplashState::setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray) { -#if SPLASH_CMYK +#ifdef SPLASH_CMYK int i; for (i = 0; i < 256; ++i) { diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashState.h b/Build/source/libs/poppler/poppler-src/splash/SplashState.h index fea7603500e..32270382037 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashState.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashState.h @@ -12,6 +12,7 @@ // under GPL version 2 or later // // Copyright (C) 2011, 2012, 2015 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -124,7 +125,7 @@ private: rgbTransferG[256], rgbTransferB[256]; Guchar grayTransfer[256]; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK Guchar cmykTransferC[256], cmykTransferM[256], cmykTransferY[256], diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashT1Font.cc b/Build/source/libs/poppler/poppler-src/splash/SplashT1Font.cc deleted file mode 100644 index 0fdfaaf5150..00000000000 --- a/Build/source/libs/poppler/poppler-src/splash/SplashT1Font.cc +++ /dev/null @@ -1,309 +0,0 @@ -//======================================================================== -// -// SplashT1Font.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2007 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <t1lib.h> -#include "goo/gmem.h" -#include "SplashMath.h" -#include "SplashGlyphBitmap.h" -#include "SplashPath.h" -#include "SplashT1FontEngine.h" -#include "SplashT1FontFile.h" -#include "SplashT1Font.h" - -//------------------------------------------------------------------------ - -static Guchar bitReverse[256] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -//------------------------------------------------------------------------ -// SplashT1Font -//------------------------------------------------------------------------ - -SplashT1Font::SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA, - SplashCoord *textMatA): - SplashFont(fontFileA, matA, textMatA, fontFileA->engine->aa) -{ - T1_TMATRIX matrix; - BBox bbox; - SplashCoord bbx0, bby0, bbx1, bby1; - int x, y; - - t1libID = T1_CopyFont(fontFileA->t1libID); - outlineID = -1; - - // compute font size - size = (float)splashDist(0, 0, mat[2], mat[3]); - - // transform the four corners of the font bounding box -- the min - // and max values form the bounding box of the transformed font - bbox = T1_GetFontBBox(t1libID); - bbx0 = 0.001 * bbox.llx; - bby0 = 0.001 * bbox.lly; - bbx1 = 0.001 * bbox.urx; - bby1 = 0.001 * bbox.ury; - // some fonts are completely broken, so we fake it (with values - // large enough that most glyphs should fit) - if (bbx0 == 0 && bby0 == 0 && bbx1 == 0 && bby1 == 0) { - bbx0 = bby0 = -0.5; - bbx1 = bby1 = 1.5; - } - x = (int)(mat[0] * bbx0 + mat[2] * bby0); - xMin = xMax = x; - y = (int)(mat[1] * bbx0 + mat[3] * bby0); - yMin = yMax = y; - x = (int)(mat[0] * bbx0 + mat[2] * bby1); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)(mat[1] * bbx0 + mat[3] * bby1); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)(mat[0] * bbx1 + mat[2] * bby0); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)(mat[1] * bbx1 + mat[3] * bby0); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)(mat[0] * bbx1 + mat[2] * bby1); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)(mat[1] * bbx1 + mat[3] * bby1); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - // This is a kludge: some buggy PDF generators embed fonts with - // zero bounding boxes. - if (xMax == xMin) { - xMin = 0; - xMax = (int)size; - } - if (yMax == yMin) { - yMin = 0; - yMax = (int)(1.2 * size); - } - // Another kludge: an unusually large xMin or yMin coordinate is - // probably wrong. - if (xMin > 0) { - xMin = 0; - } - if (yMin > 0) { - yMin = 0; - } - // Another kludge: t1lib doesn't correctly handle fonts with - // real (non-integer) bounding box coordinates. - if (xMax - xMin > 5000) { - xMin = 0; - xMax = (int)size; - } - if (yMax - yMin > 5000) { - yMin = 0; - yMax = (int)(1.2 * size); - } - - // transform the font - matrix.cxx = (double)mat[0] / size; - matrix.cxy = (double)mat[1] / size; - matrix.cyx = (double)mat[2] / size; - matrix.cyy = (double)mat[3] / size; - T1_TransformFont(t1libID, &matrix); -} - -SplashT1Font::~SplashT1Font() { - T1_DeleteFont(t1libID); - if (outlineID >= 0) { - T1_DeleteFont(outlineID); - } -} - -GBool SplashT1Font::getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { - return SplashFont::getGlyph(c, 0, 0, bitmap, x0, y0, clip, clipRes); -} - -GBool SplashT1Font::makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { - GLYPH *glyph; - int n, i; - - if (aa) { - glyph = T1_AASetChar(t1libID, c, size, NULL); - } else { - glyph = T1_SetChar(t1libID, c, size, NULL); - } - if (!glyph) { - return gFalse; - } - - bitmap->x = -glyph->metrics.leftSideBearing; - bitmap->y = glyph->metrics.ascent; - bitmap->w = glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing; - bitmap->h = glyph->metrics.ascent - glyph->metrics.descent; - bitmap->aa = aa; - if (aa) { - bitmap->data = (Guchar *)glyph->bits; - bitmap->freeData = gFalse; - } else { - n = bitmap->h * ((bitmap->w + 7) >> 3); - bitmap->data = (Guchar *)gmalloc(n); - for (i = 0; i < n; ++i) { - bitmap->data[i] = bitReverse[glyph->bits[i] & 0xff]; - } - bitmap->freeData = gTrue; - } - - *clipRes = clip->testRect(x0 - bitmap->x, - y0 - bitmap->y, - x0 - bitmap->x + bitmap->w - 1, - y0 - bitmap->y + bitmap->h - 1); - - return gTrue; -} - -SplashPath *SplashT1Font::getGlyphPath(int c) { - T1_TMATRIX matrix; - SplashPath *path; - T1_OUTLINE *outline; - T1_PATHSEGMENT *seg; - T1_BEZIERSEGMENT *bez; - int x, y, x1, y1; - GBool needClose; - - if (outlineID < 0) { - outlineID = T1_CopyFont(((SplashT1FontFile *)fontFile)->t1libID); - outlineSize = (float)splashDist(0, 0, textMat[2], textMat[3]); - matrix.cxx = (double)textMat[0] / outlineSize; - matrix.cxy = (double)textMat[1] / outlineSize; - matrix.cyx = (double)textMat[2] / outlineSize; - matrix.cyy = (double)textMat[3] / outlineSize; - // t1lib doesn't seem to handle small sizes correctly here, so set - // the size to 1000, and scale the resulting coordinates later - outlineMul = (float)(outlineSize / 65536000.0); - outlineSize = 1000; - T1_TransformFont(outlineID, &matrix); - } - - path = new SplashPath(); - if ((outline = T1_GetCharOutline(outlineID, c, outlineSize, NULL))) { - // NB: t1lib uses integer coordinates here; we keep a running - // (x,y) total as integers, so that the final point in the path is - // exactly the same as the first point, thus avoiding weird - // mitered join glitches - x = y = 0; - needClose = gFalse; - for (seg = outline; seg; seg = seg->link) { - switch (seg->type) { - case T1_PATHTYPE_MOVE: - if (needClose) { - path->close(); - needClose = gFalse; - } - x += seg->dest.x; - y += seg->dest.y; - path->moveTo(outlineMul * x, -outlineMul * y); - break; - case T1_PATHTYPE_LINE: - x += seg->dest.x; - y += seg->dest.y; - path->lineTo(outlineMul * x, -outlineMul * y); - needClose = gTrue; - break; - case T1_PATHTYPE_BEZIER: - bez = (T1_BEZIERSEGMENT *)seg; - x1 = x + bez->dest.x; - y1 = y + bez->dest.y; - path->curveTo(outlineMul * (x + bez->B.x), - -outlineMul * (y + bez->B.y), - outlineMul * (x + bez->C.x), - -outlineMul * (y + bez->C.y), - outlineMul * x1, - -outlineMul * y1); - x = x1; - y = y1; - needClose = gTrue; - break; - } - } - if (needClose) { - path->close(); - } - T1_FreeOutline(outline); - } - - return path; -} - -#endif // HAVE_T1LIB_H diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashT1Font.h b/Build/source/libs/poppler/poppler-src/splash/SplashT1Font.h deleted file mode 100644 index 1dbe66cd7fc..00000000000 --- a/Build/source/libs/poppler/poppler-src/splash/SplashT1Font.h +++ /dev/null @@ -1,69 +0,0 @@ -//======================================================================== -// -// SplashT1Font.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2007 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHT1FONT_H -#define SPLASHT1FONT_H - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashFont.h" - -class SplashT1FontFile; - -//------------------------------------------------------------------------ -// SplashT1Font -//------------------------------------------------------------------------ - -class SplashT1Font: public SplashFont { -public: - - SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA, - SplashCoord *textMatA); - - virtual ~SplashT1Font(); - - // Munge xFrac and yFrac before calling SplashFont::getGlyph. - virtual GBool getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); - - // Rasterize a glyph. The <xFrac> and <yFrac> values are the same - // as described for getGlyph. - virtual GBool makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); - - // Return the path for a glyph. - virtual SplashPath *getGlyphPath(int c); - -private: - - int t1libID; // t1lib font ID - int outlineID; // t1lib font ID for glyph outlines - float size; - float outlineSize; // size for glyph outlines - float outlineMul; -}; - -#endif // HAVE_T1LIB_H - -#endif diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashT1FontEngine.cc b/Build/source/libs/poppler/poppler-src/splash/SplashT1FontEngine.cc deleted file mode 100644 index fb4b38dae88..00000000000 --- a/Build/source/libs/poppler/poppler-src/splash/SplashT1FontEngine.cc +++ /dev/null @@ -1,138 +0,0 @@ -//======================================================================== -// -// SplashT1FontEngine.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <stdio.h> -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif -#include <t1lib.h> -#include "goo/GooString.h" -#include "goo/gfile.h" -#include "fofi/FoFiType1C.h" -#include "SplashT1FontFile.h" -#include "SplashT1FontEngine.h" - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -//------------------------------------------------------------------------ - -int SplashT1FontEngine::t1libInitCount = 0; - -//------------------------------------------------------------------------ - -static void fileWrite(void *stream, const char *data, int len) { - fwrite(data, 1, len, (FILE *)stream); -} - -//------------------------------------------------------------------------ -// SplashT1FontEngine -//------------------------------------------------------------------------ - -SplashT1FontEngine::SplashT1FontEngine(GBool aaA) { - aa = aaA; -} - -SplashT1FontEngine *SplashT1FontEngine::init(GBool aaA) { - // grayVals[i] = round(i * 255 / 16) - static unsigned long grayVals[17] = { - 0, 16, 32, 48, 64, 80, 96, 112, 128, 143, 159, 175, 191, 207, 223, 239, 255 - }; - - //~ for multithreading: need a mutex here - if (t1libInitCount == 0) { - T1_SetBitmapPad(8); - if (!T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE | - T1_NO_AFM)) { - return NULL; - } - if (aaA) { - T1_AASetBitsPerPixel(8); - T1_AASetLevel(T1_AA_HIGH); - T1_AAHSetGrayValues(grayVals); - } else { - T1_AANSetGrayValues(0, 1); - } - } - ++t1libInitCount; - - return new SplashT1FontEngine(aaA); -} - -SplashT1FontEngine::~SplashT1FontEngine() { - //~ for multithreading: need a mutex here - if (--t1libInitCount == 0) { - T1_CloseLib(); - } -} - -SplashFontFile *SplashT1FontEngine::loadType1Font(SplashFontFileID *idA, - SplashFontSrc *src, - const char **enc) { - return SplashT1FontFile::loadType1Font(this, idA, src, enc); -} - -SplashFontFile *SplashT1FontEngine::loadType1CFont(SplashFontFileID *idA, - SplashFontSrc *src, - const char **enc) { - FoFiType1C *ff; - GooString *tmpFileName; - FILE *tmpFile; - SplashFontFile *ret; - - SplashFontSrc *newsrc; - - if (src->isFile) - ff = FoFiType1C::load(src->fileName->getCString()); - else - ff = FoFiType1C::make(src->buf, src->bufLen); - if (! ff) - return NULL; - - tmpFileName = NULL; - if (!openTempFile(&tmpFileName, &tmpFile, "wb")) { - delete ff; - return NULL; - } - ff->convertToType1(NULL, NULL, gTrue, &fileWrite, tmpFile); - delete ff; - fclose(tmpFile); - newsrc = new SplashFontSrc; - newsrc->setFile(tmpFileName, gTrue); - delete tmpFileName; - ret = SplashT1FontFile::loadType1Font(this, idA, newsrc, enc); - newsrc->unref(); - return ret; -} - -#endif // HAVE_T1LIB_H diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashT1FontEngine.h b/Build/source/libs/poppler/poppler-src/splash/SplashT1FontEngine.h deleted file mode 100644 index 268a01479b0..00000000000 --- a/Build/source/libs/poppler/poppler-src/splash/SplashT1FontEngine.h +++ /dev/null @@ -1,50 +0,0 @@ -//======================================================================== -// -// SplashT1FontEngine.h -// -//======================================================================== - -#ifndef SPLASHT1FONTENGINE_H -#define SPLASHT1FONTENGINE_H - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "goo/gtypes.h" - -class SplashFontFile; -class SplashFontFileID; -class SplashFontSrc; - -//------------------------------------------------------------------------ -// SplashT1FontEngine -//------------------------------------------------------------------------ - -class SplashT1FontEngine { -public: - - static SplashT1FontEngine *init(GBool aaA); - - ~SplashT1FontEngine(); - - // Load fonts. - SplashFontFile *loadType1Font(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); - SplashFontFile *loadType1CFont(SplashFontFileID *idA, SplashFontSrc *src, const char **enc); - -private: - - SplashT1FontEngine(GBool aaA); - - static int t1libInitCount; - GBool aa; - - friend class SplashT1FontFile; - friend class SplashT1Font; -}; - -#endif // HAVE_T1LIB_H - -#endif diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashT1FontFile.cc b/Build/source/libs/poppler/poppler-src/splash/SplashT1FontFile.cc deleted file mode 100644 index 1832a916d9a..00000000000 --- a/Build/source/libs/poppler/poppler-src/splash/SplashT1FontFile.cc +++ /dev/null @@ -1,134 +0,0 @@ -//======================================================================== -// -// SplashT1FontFile.cc -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <string.h> -#include <t1lib.h> -#include "goo/GooString.h" -#include "goo/gfile.h" -#include "goo/gmem.h" -#include "SplashT1FontEngine.h" -#include "SplashT1Font.h" -#include "SplashT1FontFile.h" - -//------------------------------------------------------------------------ -// SplashT1FontFile -//------------------------------------------------------------------------ - -SplashFontFile *SplashT1FontFile::loadType1Font(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - const char **encA) { - int t1libIDA; - const char **encTmp; - char *encStrTmp; - int encStrSize; - char *encPtr; - int i; - - GooString *fileNameA; - SplashFontSrc *newsrc = NULL; - SplashFontFile *ff; - - if (! src->isFile) { - GooString *tmpFileName; - FILE *tmpFile; - if (!openTempFile(&tmpFileName, &tmpFile, "wb")) - return NULL; - fwrite(src->buf, 1, src->bufLen, tmpFile); - fclose(tmpFile); - newsrc = new SplashFontSrc; - newsrc->setFile(tmpFileName, gTrue); - src = newsrc; - delete tmpFileName; - } - fileNameA = src->fileName; - // load the font file - if ((t1libIDA = T1_AddFont(fileNameA->getCString())) < 0) { - delete newsrc; - return NULL; - } - T1_LoadFont(t1libIDA); - - // reencode it - encStrSize = 0; - for (i = 0; i < 256; ++i) { - if (encA[i]) { - encStrSize += strlen(encA[i]) + 1; - } - } - encTmp = (const char **)gmallocn(257, sizeof(char *)); - encStrTmp = (char *)gmallocn(encStrSize, sizeof(char)); - encPtr = encStrTmp; - for (i = 0; i < 256; ++i) { - if (encA[i]) { - strcpy(encPtr, encA[i]); - encTmp[i] = encPtr; - encPtr += strlen(encPtr) + 1; - } else { - encTmp[i] = ".notdef"; - } - } - encTmp[256] = "custom"; - T1_ReencodeFont(t1libIDA, (char **)encTmp); - - ff = new SplashT1FontFile(engineA, idA, src, - t1libIDA, encTmp, encStrTmp); - if (newsrc) - newsrc->unref(); - return ff; -} - -SplashT1FontFile::SplashT1FontFile(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *srcA, - int t1libIDA, const char **encA, char *encStrA): - SplashFontFile(idA, srcA) -{ - engine = engineA; - t1libID = t1libIDA; - enc = encA; - encStr = encStrA; -} - -SplashT1FontFile::~SplashT1FontFile() { - gfree(encStr); - gfree(enc); - T1_DeleteFont(t1libID); -} - -SplashFont *SplashT1FontFile::makeFont(SplashCoord *mat, - SplashCoord *textMat) { - SplashFont *font; - - font = new SplashT1Font(this, mat, textMat); - font->initCache(); - return font; -} - -#endif // HAVE_T1LIB_H diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashT1FontFile.h b/Build/source/libs/poppler/poppler-src/splash/SplashT1FontFile.h deleted file mode 100644 index c094b6d8b29..00000000000 --- a/Build/source/libs/poppler/poppler-src/splash/SplashT1FontFile.h +++ /dev/null @@ -1,70 +0,0 @@ -//======================================================================== -// -// SplashT1FontFile.h -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef SPLASHT1FONTFILE_H -#define SPLASHT1FONTFILE_H - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashFontFile.h" - -class SplashT1FontEngine; - -//------------------------------------------------------------------------ -// SplashT1FontFile -//------------------------------------------------------------------------ - -class SplashT1FontFile: public SplashFontFile { -public: - - static SplashFontFile *loadType1Font(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - const char **encA); - - virtual ~SplashT1FontFile(); - - // Create a new SplashT1Font, i.e., a scaled instance of this font - // file. - virtual SplashFont *makeFont(SplashCoord *mat, - SplashCoord *textMat); - -private: - - SplashT1FontFile(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - SplashFontSrc *src, - int t1libIDA, const char **encA, char *encStrA); - - SplashT1FontEngine *engine; - int t1libID; // t1lib font ID - const char **enc; - char *encStr; - - friend class SplashT1Font; -}; - -#endif // HAVE_T1LIB_H - -#endif diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashTypes.h b/Build/source/libs/poppler/poppler-src/splash/SplashTypes.h index 5ea816007f8..ca0e3bc0916 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashTypes.h +++ b/Build/source/libs/poppler/poppler-src/splash/SplashTypes.h @@ -16,6 +16,7 @@ // Copyright (C) 2009, 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de> // Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> // Copyright (C) 2010 William Bader <williambader@hotmail.com> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -31,10 +32,10 @@ // coordinates //------------------------------------------------------------------------ -#if USE_FIXEDPOINT +#if defined(USE_FIXEDPOINT) #include "goo/FixedPoint.h" typedef FixedPoint SplashCoord; -#elif USE_FLOAT +#elif defined(USE_FLOAT) typedef float SplashCoord; #else typedef double SplashCoord; @@ -64,7 +65,7 @@ enum SplashColorMode { // BGRBGR... splashModeXBGR8 // 1 byte per component, 4 bytes per pixel: // XBGRXBGR... -#if SPLASH_CMYK +#ifdef SPLASH_CMYK , splashModeCMYK8, // 1 byte per component, 4 bytes per pixel: // CMYKCMYK... @@ -85,7 +86,7 @@ enum SplashThinLineMode { extern int splashColorModeNComps[]; // max number of components in any SplashColor -#if SPLASH_CMYK +#ifdef SPLASH_CMYK #define splashMaxColorComps SPOT_NCOMPS+4 #else #define splashMaxColorComps 4 @@ -104,7 +105,7 @@ static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; } static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; } static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; } -#if SPLASH_CMYK +#ifdef SPLASH_CMYK // CMYK8 static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; } static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; } @@ -123,7 +124,7 @@ static inline void splashClearColor(SplashColorPtr dest) { dest[0] = 0; dest[1] = 0; dest[2] = 0; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK dest[3] = 0; for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++) dest[i] = 0; @@ -134,7 +135,7 @@ static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) { dest[0] = src[0]; dest[1] = src[1]; dest[2] = src[2]; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK dest[3] = src[3]; for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++) dest[i] = src[i]; @@ -145,7 +146,7 @@ static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) { dest[0] ^= src[0]; dest[1] ^= src[1]; dest[2] ^= src[2]; -#if SPLASH_CMYK +#ifdef SPLASH_CMYK dest[3] ^= src[3]; for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++) dest[i] ^= src[i]; diff --git a/Build/source/libs/poppler/poppler-src/splash/SplashXPath.cc b/Build/source/libs/poppler/poppler-src/splash/SplashXPath.cc index 27106ee3d14..9c5c8813a2c 100644 --- a/Build/source/libs/poppler/poppler-src/splash/SplashXPath.cc +++ b/Build/source/libs/poppler/poppler-src/splash/SplashXPath.cc @@ -14,6 +14,7 @@ // Copyright (C) 2010 PaweÅ‚ Wiejacha <pawel.wiejacha@gmail.com> // Copyright (C) 2010, 2011 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> +// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -289,7 +290,7 @@ void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0, SplashCoord dx, dy, mx, my, d1, d2, flatness2; int p1, p2, p3; -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT flatness2 = flatness; #else flatness2 = flatness * flatness; @@ -333,7 +334,7 @@ void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0, // line) mx = (xl0 + xr3) * 0.5; my = (yl0 + yr3) * 0.5; -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT d1 = splashDist(xx1, yy1, mx, my); d2 = splashDist(xx2, yy2, mx, my); #else @@ -411,7 +412,7 @@ void SplashXPath::addSegment(SplashCoord x0, SplashCoord y0, segs[length].dxdy = segs[length].dydx = 0; segs[length].flags |= splashXPathVert; } else { -#if USE_FIXEDPOINT +#ifdef USE_FIXEDPOINT if (FixedPoint::divCheck(x1 - x0, y1 - y0, &segs[length].dxdy)) { segs[length].dydx = (SplashCoord)1 / segs[length].dxdy; } else { |