From 7c45653cc0504bc02a837a2e8050ca8f42705b09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= Date: Wed, 9 Jun 2010 15:21:08 +0000 Subject: [PATCH] poppler: fix drawImage*() parameters --- lib/pdf/BitmapOutputDev.cc | 25 ++++++++++++++----------- lib/pdf/BitmapOutputDev.h | 10 ++++++++-- lib/pdf/FullBitmapOutputDev.cc | 28 ++++++++++++++++------------ lib/pdf/FullBitmapOutputDev.h | 10 ++++++++-- lib/pdf/InfoOutputDev.cc | 31 +++++++++++++------------------ lib/pdf/InfoOutputDev.h | 30 ++++++++++++++++++++---------- lib/pdf/popplercompat.h | 12 ++++++++++++ 7 files changed, 91 insertions(+), 55 deletions(-) diff --git a/lib/pdf/BitmapOutputDev.cc b/lib/pdf/BitmapOutputDev.cc index 1191cc0..14a42dd 100644 --- a/lib/pdf/BitmapOutputDev.cc +++ b/lib/pdf/BitmapOutputDev.cc @@ -1713,7 +1713,7 @@ GBool invalid_size(int width, int height) } void BitmapOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, + int width, int height, GBool invert, POPPLER_INTERPOLATE GBool inlineImg) { msg(" drawImageMask streamkind=%d", str->getKind()); @@ -1722,15 +1722,16 @@ void BitmapOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, CopyStream*cpystr = new CopyStream(str, height * ((width + 7) / 8)); str = cpystr->getStream(); - boolpolydev->drawImageMask(state, ref, str, width, height, invert, inlineImg); + boolpolydev->drawImageMask(state, ref, str, width, height, invert, POPPLER_INTERPOLATE_ARG inlineImg); gfxbbox_t bbox = getImageBBox(state); checkNewBitmap(bbox.xmin, bbox.ymin, ceil(bbox.xmax), ceil(bbox.ymax)); - rgbdev->drawImageMask(state, ref, str, width, height, invert, inlineImg); + rgbdev->drawImageMask(state, ref, str, width, height, invert, POPPLER_INTERPOLATE_ARG inlineImg); delete cpystr; dbg_newdata("imagemask"); } void BitmapOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE int *maskColors, GBool inlineImg) { msg(" drawImage streamkind=%d", str->getKind()); @@ -1739,18 +1740,19 @@ void BitmapOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, CopyStream*cpystr = new CopyStream(str, height * ((width * colorMap->getNumPixelComps() * colorMap->getBits() + 7) / 8)); str = cpystr->getStream(); - boolpolydev->drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg); + boolpolydev->drawImage(state, ref, str, width, height, colorMap, POPPLER_INTERPOLATE_ARG maskColors, inlineImg); gfxbbox_t bbox=getImageBBox(state); checkNewBitmap(bbox.xmin, bbox.ymin, ceil(bbox.xmax), ceil(bbox.ymax)); - rgbdev->drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg); + rgbdev->drawImage(state, ref, str, width, height, colorMap, POPPLER_INTERPOLATE_ARG maskColors, inlineImg); delete cpystr; dbg_newdata("image"); } void BitmapOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert) + GBool maskInvert POPPLER_MASK_INTERPOLATE) { msg(" drawMaskedImage streamkind=%d", str->getKind()); if(invalid_size(width,height)) return; @@ -1758,19 +1760,20 @@ void BitmapOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, CopyStream*cpystr = new CopyStream(str, height * ((width * colorMap->getNumPixelComps() * colorMap->getBits() + 7) / 8)); str = cpystr->getStream(); - boolpolydev->drawMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert); + boolpolydev->drawMaskedImage(state, ref, str, width, height, colorMap, POPPLER_INTERPOLATE_ARG maskStr, maskWidth, maskHeight, maskInvert POPPLER_MASK_INTERPOLATE_ARG); gfxbbox_t bbox=getImageBBox(state); checkNewBitmap(bbox.xmin, bbox.ymin, ceil(bbox.xmax), ceil(bbox.ymax)); - rgbdev->drawMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert); + rgbdev->drawMaskedImage(state, ref, str, width, height, colorMap, POPPLER_INTERPOLATE_ARG maskStr, maskWidth, maskHeight, maskInvert POPPLER_MASK_INTERPOLATE_ARG); delete cpystr; dbg_newdata("maskedimage"); } void BitmapOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) + GfxImageColorMap *maskColorMap POPPLER_MASK_INTERPOLATE) { msg(" drawSoftMaskedImage %dx%d (%dx%d) streamkind=%d", width, height, maskWidth, maskHeight, str->getKind()); if(invalid_size(width,height)) return; @@ -1778,10 +1781,10 @@ void BitmapOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream * CopyStream*cpystr = new CopyStream(str, height * ((width * colorMap->getNumPixelComps() * colorMap->getBits() + 7) / 8)); str = cpystr->getStream(); - boolpolydev->drawSoftMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap); + boolpolydev->drawSoftMaskedImage(state, ref, str, width, height, colorMap, POPPLER_INTERPOLATE_ARG maskStr, maskWidth, maskHeight, maskColorMap POPPLER_MASK_INTERPOLATE_ARG); gfxbbox_t bbox=getImageBBox(state); checkNewBitmap(bbox.xmin, bbox.ymin, ceil(bbox.xmax), ceil(bbox.ymax)); - rgbdev->drawSoftMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap); + rgbdev->drawSoftMaskedImage(state, ref, str, width, height, colorMap, POPPLER_INTERPOLATE_ARG maskStr, maskWidth, maskHeight, maskColorMap POPPLER_MASK_INTERPOLATE_ARG); delete cpystr; dbg_newdata("softmaskimage"); } diff --git a/lib/pdf/BitmapOutputDev.h b/lib/pdf/BitmapOutputDev.h index 21ddb6d..2869d09 100644 --- a/lib/pdf/BitmapOutputDev.h +++ b/lib/pdf/BitmapOutputDev.h @@ -145,21 +145,27 @@ public: virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, + POPPLER_INTERPOLATE GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert + POPPLER_MASK_INTERPOLATE); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap + POPPLER_MASK_INTERPOLATE); virtual void type3D0(GfxState *state, double wx, double wy); virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury); diff --git a/lib/pdf/FullBitmapOutputDev.cc b/lib/pdf/FullBitmapOutputDev.cc index 90a3985..320a46d 100644 --- a/lib/pdf/FullBitmapOutputDev.cc +++ b/lib/pdf/FullBitmapOutputDev.cc @@ -530,37 +530,41 @@ void FullBitmapOutputDev::endType3Char(GfxState *state) rgbdev->endType3Char(state); } void FullBitmapOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, + int width, int height, GBool invert, POPPLER_INTERPOLATE GBool inlineImg) { msg(" drawImageMask"); - rgbdev->drawImageMask(state, ref, str, width, height, invert, inlineImg); + rgbdev->drawImageMask(state, ref, str, width, height, invert, POPPLER_INTERPOLATE_ARG inlineImg); } void FullBitmapOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, + int width, int height, GfxImageColorMap *colorMap, POPPLER_INTERPOLATE int *maskColors, GBool inlineImg) { msg(" drawImage"); - rgbdev->drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg); + rgbdev->drawImage(state, ref, str, width, height, colorMap, + POPPLER_INTERPOLATE_ARG maskColors, inlineImg); } void FullBitmapOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, - GfxImageColorMap *colorMap, + GfxImageColorMap *colorMap, POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert) + GBool maskInvert POPPLER_MASK_INTERPOLATE) { msg(" drawMaskedImage"); - rgbdev->drawMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert); + rgbdev->drawMaskedImage(state, ref, str, width, height, colorMap, + POPPLER_INTERPOLATE_ARG maskStr, maskWidth, maskHeight, + maskInvert POPPLER_MASK_INTERPOLATE_ARG); } void FullBitmapOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) + GfxImageColorMap *colorMap, POPPLER_INTERPOLATE + Stream *maskStr, int maskWidth, int maskHeight, + GfxImageColorMap *maskColorMap POPPLER_MASK_INTERPOLATE) { msg(" drawSoftMaskedImage"); - rgbdev->drawSoftMaskedImage(state, ref, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap); + rgbdev->drawSoftMaskedImage(state, ref, str, width, height, colorMap, + POPPLER_INTERPOLATE_ARG maskStr, maskWidth, maskHeight, + maskColorMap POPPLER_MASK_INTERPOLATE_ARG); } void FullBitmapOutputDev::drawForm(Ref id) { diff --git a/lib/pdf/FullBitmapOutputDev.h b/lib/pdf/FullBitmapOutputDev.h index b31e3da..4936afb 100644 --- a/lib/pdf/FullBitmapOutputDev.h +++ b/lib/pdf/FullBitmapOutputDev.h @@ -133,21 +133,27 @@ public: virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, + POPPLER_INTERPOLATE GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert + POPPLER_MASK_INTERPOLATE); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap + POPPLER_MASK_INTERPOLATE); virtual void type3D0(GfxState *state, double wx, double wy); virtual void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury); diff --git a/lib/pdf/InfoOutputDev.cc b/lib/pdf/InfoOutputDev.cc index aa253be..053a8e3 100644 --- a/lib/pdf/InfoOutputDev.cc +++ b/lib/pdf/InfoOutputDev.cc @@ -1,18 +1,7 @@ -#include "config.h" +#include "../../config.h" #include "Object.h" #include "InfoOutputDev.h" #include "SplashOutputDev.h" -#ifdef HAVE_POPPLER -#include -#include -#include -#include -#else -#include "SplashTypes.h" -#include "SplashPath.h" -#include "SplashFont.h" -#include "SplashFontFile.h" -#endif #include "GfxState.h" #include "../log.h" #include "../types.h" @@ -569,42 +558,48 @@ void InfoOutputDev::restoreState(GfxState *state) void InfoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, + POPPLER_INTERPOLATE GBool inlineImg) { if(str->getKind()==strDCT) num_jpeg_images++; else num_ppm_images++; - OutputDev::drawImageMask(state,ref,str,width,height,invert,inlineImg); + OutputDev::drawImageMask(state,ref,str,width,height,invert, POPPLER_INTERPOLATE_ARG inlineImg); } void InfoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE int *maskColors, GBool inlineImg) { if(str->getKind()==strDCT) num_jpeg_images++; else num_ppm_images++; - OutputDev::drawImage(state,ref,str,width,height,colorMap,maskColors,inlineImg); + OutputDev::drawImage(state,ref,str,width,height,colorMap, POPPLER_INTERPOLATE_ARG maskColors,inlineImg); } void InfoOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert) + GBool maskInvert + POPPLER_MASK_INTERPOLATE) { if(str->getKind()==strDCT) num_jpeg_images++; else num_ppm_images++; - OutputDev::drawMaskedImage(state,ref,str,width,height,colorMap,maskStr,maskWidth,maskHeight,maskInvert); + OutputDev::drawMaskedImage(state,ref,str,width,height,colorMap, POPPLER_INTERPOLATE_ARG maskStr,maskWidth,maskHeight,maskInvert POPPLER_MASK_INTERPOLATE_ARG); } void InfoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) + GfxImageColorMap *maskColorMap + POPPLER_MASK_INTERPOLATE) { if(str->getKind()==strDCT) num_jpeg_images++; else num_ppm_images++; - OutputDev::drawSoftMaskedImage(state,ref,str,width,height,colorMap,maskStr,maskWidth,maskHeight,maskColorMap); + OutputDev::drawSoftMaskedImage(state,ref,str,width,height,colorMap, POPPLER_INTERPOLATE_ARG maskStr,maskWidth,maskHeight,maskColorMap POPPLER_MASK_INTERPOLATE_ARG); } void InfoOutputDev::dumpfonts(gfxdevice_t*dev) diff --git a/lib/pdf/InfoOutputDev.h b/lib/pdf/InfoOutputDev.h index ec3cdb1..93451f8 100644 --- a/lib/pdf/InfoOutputDev.h +++ b/lib/pdf/InfoOutputDev.h @@ -21,20 +21,23 @@ #ifndef __infooutputdev_h__ #define __infooutputdev_h__ +#include "popplercompat.h" #include "GfxFont.h" #include "OutputDev.h" #include "SplashOutputDev.h" #include "Page.h" + #ifdef HAVE_POPPLER -#include -#include -#include -#include + #include + #include + #include + #include #else -#include "SplashTypes.h" -#include "SplashPath.h" -#include "SplashFont.h" -#include "SplashFontFile.h" + #include "xpdf/config.h" + #include "SplashTypes.h" + #include "SplashPath.h" + #include "SplashFont.h" + #include "SplashFontFile.h" #endif #ifdef HAVE_POPPLER @@ -146,24 +149,31 @@ class InfoOutputDev: public OutputDev double dx, double dy, double originX, double originY, CharCode code, int nBytes, Unicode *u, int uLen); + virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, + POPPLER_INTERPOLATE GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert + POPPLER_MASK_INTERPOLATE); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + POPPLER_INTERPOLATE Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap + POPPLER_MASK_INTERPOLATE); virtual FontInfo* getFont(char*id); }; diff --git a/lib/pdf/popplercompat.h b/lib/pdf/popplercompat.h index b76df7e..ab2f07b 100644 --- a/lib/pdf/popplercompat.h +++ b/lib/pdf/popplercompat.h @@ -4,6 +4,18 @@ #include "../../config.h" #ifdef HAVE_POPPLER + #define POPPLER_INTERPOLATE GBool interpolate, + #define POPPLER_INTERPOLATE_ARG interpolate, + #define POPPLER_MASK_INTERPOLATE , GBool maskInterpolate + #define POPPLER_MASK_INTERPOLATE_ARG , maskInterpolate +#else + #define POPPLER_INTERPOLATE + #define POPPLER_INTERPOLATE_ARG + #define POPPLER_MASK_INTERPOLATE + #define POPPLER_MASK_INTERPOLATE_ARG +#endif + +#ifdef HAVE_POPPLER #define POPPLER_TILING_PATERN_RETURN GBool #define POPPLER_TILING_PATERN_GFX #define POPPLER_TILING_PATERN_GFX_ARG -- 1.7.10.4