From c73fce0d6691eb05e02fc527ac699e259c237250 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= Date: Wed, 9 Jun 2010 13:34:34 +0000 Subject: [PATCH] poppler: fix tilingPatternFill() --- lib/pdf/BitmapOutputDev.cc | 43 ++++++++++++++++++++-------------------- lib/pdf/BitmapOutputDev.h | 14 ++++--------- lib/pdf/FullBitmapOutputDev.cc | 36 ++++++++++++++++----------------- lib/pdf/FullBitmapOutputDev.h | 13 +++--------- lib/pdf/GFXOutputDev.cc | 35 +++++++++++++++++--------------- lib/pdf/GFXOutputDev.h | 13 +++--------- lib/pdf/popplercompat.h | 21 ++++++++++++++++++++ 7 files changed, 89 insertions(+), 86 deletions(-) create mode 100644 lib/pdf/popplercompat.h diff --git a/lib/pdf/BitmapOutputDev.cc b/lib/pdf/BitmapOutputDev.cc index 52aa798..1191cc0 100644 --- a/lib/pdf/BitmapOutputDev.cc +++ b/lib/pdf/BitmapOutputDev.cc @@ -20,12 +20,20 @@ #include #include #include -#include "config.h" #include "BitmapOutputDev.h" #include "GFXOutputDev.h" -#include "SplashBitmap.h" -#include "SplashPattern.h" -#include "Splash.h" + +#ifdef HAVE_POPPLER + #include "splash/SplashBitmap.h" + #include "splash/SplashPattern.h" + #include "splash/Splash.h" +#else + #include "xpdf/config.h" + #include "SplashBitmap.h" + #include "SplashPattern.h" + #include "Splash.h" +#endif + #include "../log.h" #include "../png.h" #include "../devices/record.h" @@ -1400,33 +1408,24 @@ void BitmapOutputDev::eoFill(GfxState *state) rgbdev->eoFill(state); dbg_newdata("eofill"); } -#if (xpdfMajorVersion*10000 + xpdfMinorVersion*100 + xpdfUpdateVersion) < 30207 -void BitmapOutputDev::tilingPatternFill(GfxState *state, Object *str, - int paintType, Dict *resDict, - double *mat, double *bbox, - int x0, int y0, int x1, int y1, - double xStep, double yStep) -{ - msg(" tilingPatternFill"); - boolpolydev->tilingPatternFill(state, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep); - checkNewBitmap(UNKNOWN_BOUNDING_BOX); - rgbdev->tilingPatternFill(state, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep); - dbg_newdata("tilingpatternfill"); -} -#else -void BitmapOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Object *str, + +POPPLER_TILING_PATERN_RETURN BitmapOutputDev::tilingPatternFill(GfxState *state, POPPLER_TILING_PATERN_GFX Object *str, int paintType, Dict *resDict, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) { msg(" tilingPatternFill"); - boolpolydev->tilingPatternFill(state, gfx, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep); + boolpolydev->tilingPatternFill(state, POPPLER_TILING_PATERN_GFX_ARG str, paintType, resDict, mat, + bbox, x0, y0, x1, y1, xStep, yStep); checkNewBitmap(UNKNOWN_BOUNDING_BOX); - rgbdev->tilingPatternFill(state, gfx, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep); + rgbdev->tilingPatternFill(state, POPPLER_TILING_PATERN_GFX_ARG str, paintType, resDict, mat, + bbox, x0, y0, x1, y1, xStep, yStep); dbg_newdata("tilingpatternfill"); -} +#ifdef HAVE_POPPLER + return gTrue; #endif +} GBool BitmapOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) { diff --git a/lib/pdf/BitmapOutputDev.h b/lib/pdf/BitmapOutputDev.h index c5c9375..21ddb6d 100644 --- a/lib/pdf/BitmapOutputDev.h +++ b/lib/pdf/BitmapOutputDev.h @@ -24,11 +24,12 @@ #include "../gfxsource.h" #include "../gfxtools.h" -#include "config.h" +#include "../../config.h" #include "GFXOutputDev.h" #include "InfoOutputDev.h" #include "PDFDoc.h" #include "CommonOutputDev.h" +#include "popplercompat.h" struct ClipState { @@ -111,19 +112,12 @@ public: virtual void stroke(GfxState *state); virtual void fill(GfxState *state); virtual void eoFill(GfxState *state); -#if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7) - virtual void tilingPatternFill(GfxState *state, Object *str, + virtual POPPLER_TILING_PATERN_RETURN tilingPatternFill( + GfxState *state, POPPLER_TILING_PATERN_GFX Object *str, int paintType, Dict *resDict, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep); -#else - virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str, - int paintType, Dict *resDict, - double *mat, double *bbox, - int x0, int y0, int x1, int y1, - double xStep, double yStep); -#endif virtual GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading); diff --git a/lib/pdf/FullBitmapOutputDev.cc b/lib/pdf/FullBitmapOutputDev.cc index 6b80802..90a3985 100644 --- a/lib/pdf/FullBitmapOutputDev.cc +++ b/lib/pdf/FullBitmapOutputDev.cc @@ -19,12 +19,20 @@ #include #include #include -#include "config.h" #include "FullBitmapOutputDev.h" #include "GFXOutputDev.h" -#include "SplashBitmap.h" -#include "SplashPattern.h" -#include "Splash.h" + +#ifdef HAVE_POPPLER + #include "splash/SplashBitmap.h" + #include "splash/SplashPattern.h" + #include "splash/Splash.h" +#else + #include "xpdf/config.h" + #include "SplashBitmap.h" + #include "SplashPattern.h" + #include "Splash.h" +#endif + #include "../log.h" #include "../png.h" #include "../devices/record.h" @@ -408,27 +416,19 @@ void FullBitmapOutputDev::eoFill(GfxState *state) msg(" eoFill"); rgbdev->eoFill(state); } -#if (xpdfMajorVersion*10000 + xpdfMinorVersion*100 + xpdfUpdateVersion) < 30207 -void FullBitmapOutputDev::tilingPatternFill(GfxState *state, Object *str, +POPPLER_TILING_PATERN_RETURN FullBitmapOutputDev::tilingPatternFill(GfxState *state, POPPLER_TILING_PATERN_GFX + Object *str, int paintType, Dict *resDict, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) { msg(" tilingPatternFill"); - rgbdev->tilingPatternFill(state, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep); -} -#else -void FullBitmapOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Object *str, - int paintType, Dict *resDict, - double *mat, double *bbox, - int x0, int y0, int x1, int y1, - double xStep, double yStep) -{ - msg(" tilingPatternFill"); - rgbdev->tilingPatternFill(state, gfx, str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep); -} +#ifdef HAVE_POPPLER + return #endif + rgbdev->tilingPatternFill(state, POPPLER_TILING_PATERN_GFX_ARG str, paintType, resDict, mat, bbox, x0, y0, x1, y1, xStep, yStep); +} GBool FullBitmapOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) { diff --git a/lib/pdf/FullBitmapOutputDev.h b/lib/pdf/FullBitmapOutputDev.h index ab49f5c..b31e3da 100644 --- a/lib/pdf/FullBitmapOutputDev.h +++ b/lib/pdf/FullBitmapOutputDev.h @@ -24,7 +24,7 @@ #include "../gfxsource.h" #include "../gfxtools.h" -#include "config.h" +#include "../../config.h" #include "GFXOutputDev.h" #include "InfoOutputDev.h" #include "PDFDoc.h" @@ -100,19 +100,12 @@ public: virtual void stroke(GfxState *state); virtual void fill(GfxState *state); virtual void eoFill(GfxState *state); -#if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7) - virtual void tilingPatternFill(GfxState *state, Object *str, + virtual POPPLER_TILING_PATERN_RETURN tilingPatternFill(GfxState *state, + POPPLER_TILING_PATERN_GFX Object *str, int paintType, Dict *resDict, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep); -#else - virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str, - int paintType, Dict *resDict, - double *mat, double *bbox, - int x0, int y0, int x1, int y1, - double xStep, double yStep); -#endif virtual GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading); diff --git a/lib/pdf/GFXOutputDev.cc b/lib/pdf/GFXOutputDev.cc index 5439923..b6cef65 100644 --- a/lib/pdf/GFXOutputDev.cc +++ b/lib/pdf/GFXOutputDev.cc @@ -36,15 +36,20 @@ #ifdef HAVE_FONTCONFIG #include #endif + +#include "../../config.h" + //xpdf header files -#include "config.h" -#ifdef HAVE_POPPLER -#include -#include +#include "popplercompat.h" + #ifdef HAVE_POPPLER + #include + #include #else -#include "gfile.h" -#include "GString.h" + #include "xpdf/config.h" + #include "gfile.h" + #include "GString.h" #endif + #include "Object.h" #include "Stream.h" #include "Array.h" @@ -962,23 +967,21 @@ void GFXOutputDev::transformXY(GfxState*state, double x, double y, double*nx, do *ny += user_movey + clipmovey; } - -#if (xpdfMajorVersion*10000 + xpdfMinorVersion*100 + xpdfUpdateVersion) < 30207 -void GFXOutputDev::tilingPatternFill(GfxState *state, Object *str, - int paintType, Dict *resDict, - double *mat, double *bbox, - int x0, int y0, int x1, int y1, - double xStep, double yStep) -#else -void GFXOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Object *str, +POPPLER_TILING_PATERN_RETURN GFXOutputDev::tilingPatternFill(GfxState *state, + POPPLER_TILING_PATERN_GFX + Object *str, int paintType, Dict *resDict, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) -#endif { msg(" tilingPatternFill"); infofeature("tiling pattern fills"); +#ifdef HAVE_POPPLER + // since we don't implement this method yet, + // reduce it to a series of other drawing operations. + return gFalse; +#endif } GBool GFXOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) diff --git a/lib/pdf/GFXOutputDev.h b/lib/pdf/GFXOutputDev.h index 56bb67d..f062e15 100644 --- a/lib/pdf/GFXOutputDev.h +++ b/lib/pdf/GFXOutputDev.h @@ -5,7 +5,6 @@ #include "../gfxsource.h" #include "../gfxtools.h" -#include "config.h" #include "InfoOutputDev.h" #include "PDFDoc.h" #include "GlobalParams.h" @@ -136,19 +135,13 @@ public: virtual GBool useTilingPatternFill(); virtual GBool useShadedFills(); -#if (xpdfMajorVersion < 3) || (xpdfMinorVersion < 2) || (xpdfUpdateVersion < 7) - virtual void tilingPatternFill(GfxState *state, Object *str, +virtual POPPLER_TILING_PATERN_RETURN tilingPatternFill(GfxState *state, + POPPLER_TILING_PATERN_GFX + Object *str, int paintType, Dict *resDict, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep); -#else - virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *str, - int paintType, Dict *resDict, - double *mat, double *bbox, - int x0, int y0, int x1, int y1, - double xStep, double yStep); -#endif virtual GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading); virtual GBool axialShadedFill(GfxState *state, GfxAxialShading *shading); diff --git a/lib/pdf/popplercompat.h b/lib/pdf/popplercompat.h new file mode 100644 index 0000000..cf8bfca --- /dev/null +++ b/lib/pdf/popplercompat.h @@ -0,0 +1,21 @@ +#ifndef __popplercompat_h__ +#define __popplercompat_h__ + +#include "../../config.h" + +#ifdef HAVE_POPPLER + #define POPPLER_TILING_PATERN_RETURN GBool + #define POPPLER_TILING_PATERN_GFX + #define POPPLER_TILING_PATERN_GFX_ARG +#else + #define POPPLER_TILING_PATERN_RETURN void + #if (xpdfMajorVersion*10000 + xpdfMinorVersion*100 + xpdfUpdateVersion) < 30207 + #define POPPLER_TILING_PATERN_GFX + #define POPPLER_TILING_PATERN_GFX_ARG + #else + #define POPPLER_TILING_PATERN_GFX Gfx *gfx, + #define POPPLER_TILING_PATERN_GFX_ARG gfx, + #endif +#endif + +#endif -- 1.7.10.4