From 6e9f8aa5f760949f6e072d56e0de40bfd3614d0e Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Tue, 2 Jun 2009 20:43:36 +0200 Subject: [PATCH] Use Interpolate flag to decide whether applying image interpolation during rendering Fixes bug #9860 --- poppler/CairoOutputDev.cc | 92 ++++++++++++++++++++++++++------------------ poppler/CairoOutputDev.h | 46 ++++++++++++--------- poppler/Gfx.cc | 47 +++++++++++++++++++--- poppler/OutputDev.cc | 16 +++++--- poppler/OutputDev.h | 12 +++-- poppler/SplashOutputDev.cc | 15 +++++-- poppler/SplashOutputDev.h | 11 +++-- utils/HtmlOutputDev.cc | 16 ++++---- utils/HtmlOutputDev.h | 6 +- utils/ImageOutputDev.cc | 20 +++++----- utils/ImageOutputDev.h | 11 +++-- 11 files changed, 183 insertions(+), 109 deletions(-) diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 5d4cb82..cc8d80a 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -474,8 +474,6 @@ void CairoOutputDev::updateFont(GfxState *state) { if (!currentFont) return; - LOG(printf ("font matrix: %f %f %f %f\n", m11, m12, m21, m22)); - font_face = currentFont->getFontFace(); cairo_set_font_face (cairo, font_face); @@ -492,6 +490,8 @@ void CairoOutputDev::updateFont(GfxState *state) { matrix.x0 = 0; matrix.y0 = 0; + LOG(printf ("font matrix: %f %f %f %f\n", matrix.xx, matrix.yx, matrix.xy, matrix.yy)); + /* Make sure the font matrix is invertible before setting it. cairo * will blow up if we give it a matrix that's not invertible, so we * need to check before passing it to cairo_set_font_matrix. Ignoring it @@ -1058,8 +1058,8 @@ void CairoOutputDev::clearSoftMask(GfxState * /*state*/) { } void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg) { + int width, int height, GBool invert, + GBool interpolate, GBool inlineImg) { /* FIXME: Doesn't the image mask support any colorspace? */ cairo_set_source (cairo, fill_pattern); @@ -1086,15 +1086,15 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, //XXX: it is possible that we should only do sub pixel positioning if // we are rendering fonts */ if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) { - drawImageMaskPrescaled(state, ref, str, width, height, invert, inlineImg); + drawImageMaskPrescaled(state, ref, str, width, height, invert, interpolate, inlineImg); } else { - drawImageMaskRegular(state, ref, str, width, height, invert, inlineImg); + drawImageMaskRegular(state, ref, str, width, height, invert, interpolate, inlineImg); } } void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg) { + int width, int height, GBool invert, + GBool interpolate, GBool inlineImg) { unsigned char *buffer; unsigned char *dest; cairo_surface_t *image; @@ -1153,7 +1153,8 @@ void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream * /* we should actually be using CAIRO_FILTER_NEAREST here. However, * cairo doesn't yet do minifaction filtering causing scaled down * images with CAIRO_FILTER_NEAREST to look really bad */ - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BEST); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BEST : CAIRO_FILTER_FAST); cairo_mask (cairo, pattern); @@ -1183,8 +1184,8 @@ void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream * void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg) { + int width, int height, GBool invert, + GBool interpolate, GBool inlineImg) { unsigned char *buffer; cairo_surface_t *image; cairo_pattern_t *pattern; @@ -1411,7 +1412,8 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream /* we should actually be using CAIRO_FILTER_NEAREST here. However, * cairo doesn't yet do minifaction filtering causing scaled down * images with CAIRO_FILTER_NEAREST to look really bad */ - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BEST); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BEST : CAIRO_FILTER_FAST); cairo_save (cairo); @@ -1456,10 +1458,12 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream } void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, - Stream *str, int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, int maskWidth, - int maskHeight, GBool maskInvert) + Stream *str, int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + Stream *maskStr, int maskWidth, + int maskHeight, GBool maskInvert, + GBool maskInterpolate) { ImageStream *maskImgStr; maskImgStr = new ImageStream(maskStr, maskWidth, 1, 1); @@ -1547,7 +1551,10 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, cairo_pattern_set_matrix (pattern, &matrix); cairo_pattern_set_matrix (maskPattern, &matrix); - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BILINEAR); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); + cairo_pattern_set_filter (maskPattern, + maskInterpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); cairo_set_source (cairo, pattern); cairo_mask (cairo, maskPattern); @@ -1580,11 +1587,13 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, //XXX: is this affect by AIS(alpha is shape)? void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) + int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + Stream *maskStr, + int maskWidth, int maskHeight, + GfxImageColorMap *maskColorMap, + GBool maskInterpolate) { ImageStream *maskImgStr; maskImgStr = new ImageStream(maskStr, maskWidth, @@ -1669,8 +1678,10 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s cairo_pattern_set_matrix (maskPattern, &maskMatrix); //XXX: should set mask filter - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BILINEAR); - cairo_pattern_set_filter (maskPattern, CAIRO_FILTER_BILINEAR); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); + cairo_pattern_set_filter (maskPattern, + maskInterpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); cairo_set_source (cairo, pattern); cairo_mask (cairo, maskPattern); @@ -1701,9 +1712,10 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s delete imgStr; } void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) + int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + int *maskColors, GBool inlineImg) { unsigned char *buffer; unsigned int *dest; @@ -1783,7 +1795,8 @@ void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, cairo_pattern_set_matrix (pattern, &matrix); - cairo_pattern_set_filter (pattern, CAIRO_FILTER_BILINEAR); + cairo_pattern_set_filter (pattern, + interpolate ? CAIRO_FILTER_BILINEAR : CAIRO_FILTER_FAST); cairo_set_source (cairo, pattern); cairo_paint (cairo); @@ -1844,7 +1857,7 @@ void CairoImageOutputDev::saveImage(CairoImage *image) void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) + GBool interpolate, GBool inlineImg) { cairo_t *cr; cairo_surface_t *surface; @@ -1876,7 +1889,7 @@ void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *st cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg); + CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); image->setImage (surface); setCairo (NULL); @@ -1887,7 +1900,7 @@ void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *st void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) + GBool interpolate, int *maskColors, GBool inlineImg) { cairo_t *cr; cairo_surface_t *surface; @@ -1919,7 +1932,7 @@ void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg); + CairoOutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, maskColors, inlineImg); image->setImage (surface); setCairo (NULL); @@ -1931,9 +1944,11 @@ void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) + GfxImageColorMap *maskColorMap, + GBool maskInterpolate) { cairo_t *cr; cairo_surface_t *surface; @@ -1965,8 +1980,8 @@ void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stre cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawSoftMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskColorMap); + CairoOutputDev::drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate); image->setImage (surface); setCairo (NULL); @@ -1978,9 +1993,10 @@ void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stre void CairoImageOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert) + GBool maskInvert, GBool maskInterpolate) { cairo_t *cr; cairo_surface_t *surface; @@ -2012,8 +2028,8 @@ void CairoImageOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream * cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskInvert); + CairoOutputDev::drawMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate); image->setImage (surface); setCairo (NULL); diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h index 5ec2bf0..6b575f4 100644 --- a/poppler/CairoOutputDev.h +++ b/poppler/CairoOutputDev.h @@ -165,31 +165,34 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, + int width, int height, GBool invert, GBool interpolate, GBool inlineImg); void drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg); + int width, int height, GBool invert, GBool interpolate, + GBool inlineImg); void drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg); + int width, int height, GBool invert, GBool interpolate, + GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + Stream *maskStr, + int maskWidth, int maskHeight, + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, - int maskWidth, int maskHeight, - GBool maskInvert); + int width, int height, + GfxImageColorMap *colorMap, + GBool interpolate, + Stream *maskStr, + int maskWidth, int maskHeight, + GBool maskInvert, GBool maskInterpolate); //----- transparency groups and soft masks virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/, @@ -346,22 +349,25 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert, GBool maskInterpolate); //----- transparency groups and soft masks virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/, diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 72b1068..9bcb22a 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -3589,6 +3589,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { Dict *dict, *maskDict; int width, height; int bits, maskBits; + GBool interpolate; StreamColorSpaceMode csMode; GBool mask; GBool invert; @@ -3599,6 +3600,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { int maskColors[2*gfxColorMaxComps]; int maskWidth, maskHeight; GBool maskInvert; + GBool maskInterpolate; Stream *maskStr; Object obj1, obj2; int i; @@ -3640,6 +3642,19 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { if (width < 1 || height < 1) goto err1; + // image interpolation + dict->lookup("Interpolate", &obj1); + if (obj1.isNull()) { + obj1.free(); + dict->lookup("I", &obj1); + } + if (obj1.isBool()) + interpolate = obj1.getBool(); + else + interpolate = gFalse; + obj1.free(); + maskInterpolate = gFalse; + // image or mask? dict->lookup("ImageMask", &obj1); if (obj1.isNull()) { @@ -3694,7 +3709,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { // draw it if (!contentIsHidden()) - out->drawImageMask(state, ref, str, width, height, invert, inlineImg); + out->drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); } else { @@ -3775,6 +3790,16 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { } maskHeight = obj1.getInt(); obj1.free(); + maskDict->lookup("Interpolate", &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup("I", &obj1); + } + if (obj1.isBool()) + maskInterpolate = obj1.getBool(); + else + maskInterpolate = gFalse; + obj1.free(); maskDict->lookup("BitsPerComponent", &obj1); if (obj1.isNull()) { obj1.free(); @@ -3863,6 +3888,16 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { } maskHeight = obj1.getInt(); obj1.free(); + maskDict->lookup("Interpolate", &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup("I", &obj1); + } + if (obj1.isBool()) + maskInterpolate = obj1.getBool(); + else + maskInterpolate = gFalse; + obj1.free(); maskDict->lookup("ImageMask", &obj1); if (obj1.isNull()) { obj1.free(); @@ -3894,15 +3929,15 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { // draw it if (haveSoftMask) { if (!contentIsHidden()) { - out->drawSoftMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskColorMap); + out->drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate); } delete maskColorMap; } else if (haveExplicitMask && !contentIsHidden ()) { - out->drawMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskInvert); + out->drawMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate); } else if (!contentIsHidden()) { - out->drawImage(state, ref, str, width, height, colorMap, + out->drawImage(state, ref, str, width, height, colorMap, interpolate, haveColorKeyMask ? maskColors : (int *)NULL, inlineImg); } delete colorMap; diff --git a/poppler/OutputDev.cc b/poppler/OutputDev.cc index 627ab06..32c1281 100644 --- a/poppler/OutputDev.cc +++ b/poppler/OutputDev.cc @@ -94,7 +94,7 @@ GBool OutputDev::beginType3Char(GfxState *state, double x, double y, void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) { + GBool interpolate, GBool inlineImg) { int i, j; if (inlineImg) { @@ -108,7 +108,7 @@ void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) { + GBool interpolate, int *maskColors, GBool inlineImg) { int i, j; if (inlineImg) { @@ -124,19 +124,23 @@ void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void OutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert) { - drawImage(state, ref, str, width, height, colorMap, NULL, gFalse); + GBool maskInvert, + GBool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, NULL, gFalse); } void OutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) { - drawImage(state, ref, str, width, height, colorMap, NULL, gFalse); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, NULL, gFalse); } void OutputDev::endMarkedContent(GfxState *state) { diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h index 66b5c38..536c2de 100644 --- a/poppler/OutputDev.h +++ b/poppler/OutputDev.h @@ -208,22 +208,24 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, + int width, int height, GBool invert, GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, - GfxImageColorMap *colorMap, + GfxImageColorMap *colorMap, GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert, GBool maskInterpolate); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); //----- grouping operators diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index ca44682..2e83a61 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -1708,7 +1708,7 @@ GBool SplashOutputDev::imageMaskSrc(void *data, SplashColorPtr line) { void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) { + GBool inlineImg, GBool interpolate) { double *ctm; SplashCoord mat[6]; SplashOutImageMaskData imgMaskData; @@ -1965,6 +1965,7 @@ GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, int *maskColors, GBool inlineImg) { double *ctm; SplashCoord mat[6]; @@ -2179,8 +2180,10 @@ GBool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine, void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, - int maskHeight, GBool maskInvert) { + int maskHeight, GBool maskInvert, + GBool maskInterpolate) { GfxImageColorMap *maskColorMap; Object maskDecode, decodeLow, decodeHigh; double *ctm; @@ -2210,8 +2213,8 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, maskColorMap = new GfxImageColorMap(1, &maskDecode, new GfxDeviceGrayColorSpace()); maskDecode.free(); - drawSoftMaskedImage(state, ref, str, width, height, colorMap, - maskStr, maskWidth, maskHeight, maskColorMap); + drawSoftMaskedImage(state, ref, str, width, height, colorMap, interpolate, + maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate); delete maskColorMap; } else { @@ -2334,9 +2337,11 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) { + GfxImageColorMap *maskColorMap, + GBool maskInterpolate) { double *ctm; SplashCoord mat[6]; SplashOutImageData imgData; diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index 02c7f9a..d060e2d 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -135,21 +135,24 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert, GBool maskInterpolate); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); //----- Type 3 font operators virtual void type3D0(GfxState *state, double wx, double wy); diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc index 6095e10..97b229d 100644 --- a/utils/HtmlOutputDev.cc +++ b/utils/HtmlOutputDev.cc @@ -1144,11 +1144,11 @@ void HtmlOutputDev::drawChar(GfxState *state, double x, double y, } void HtmlOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg) { + int width, int height, GBool invert, + GBool interpolate, GBool inlineImg) { if (ignore||complexMode) { - OutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg); + OutputDev::drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); return; } @@ -1222,16 +1222,16 @@ void HtmlOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, if (fName) imgList->append(fName); } else { - OutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg); + OutputDev::drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); } } void HtmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) { + int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, int *maskColors, GBool inlineImg) { if (ignore||complexMode) { - OutputDev::drawImage(state, ref, str, width, height, colorMap, + OutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, maskColors, inlineImg); return; } @@ -1418,7 +1418,7 @@ void HtmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, imgStr->close(); delete imgStr; #else - OutputDev::drawImage(state, ref, str, width, height, colorMap, + OutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, maskColors, inlineImg); #endif } diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h index a048a72..9d31774 100644 --- a/utils/HtmlOutputDev.h +++ b/utils/HtmlOutputDev.h @@ -279,10 +279,10 @@ public: virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, int *maskColors, GBool inlineImg); //new feature virtual int DevType() {return 1234;} diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc index 5d4876f..da54fd6 100644 --- a/utils/ImageOutputDev.cc +++ b/utils/ImageOutputDev.cc @@ -60,7 +60,7 @@ ImageOutputDev::~ImageOutputDev() { void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg) { + GBool interpolate, GBool inlineImg) { FILE *f; int c; int size, i; @@ -117,7 +117,7 @@ void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) { + GBool interpolate, int *maskColors, GBool inlineImg) { FILE *f; ImageStream *imgStr; Guchar *p; @@ -227,19 +227,19 @@ void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void ImageOutputDev::drawMaskedImage( GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert) { - drawImage(state, ref, str, width, height, colorMap, NULL, gFalse); - drawImageMask(state, ref, maskStr, maskWidth, maskHeight, + int width, int height, GfxImageColorMap *colorMap, GBool interpolate, + Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GBool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, NULL, gFalse); + drawImageMask(state, ref, maskStr, maskWidth, maskHeight, maskInterpolate, maskInvert, gFalse); } void ImageOutputDev::drawSoftMaskedImage( GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, + int width, int height, GfxImageColorMap *colorMap, GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) { - drawImage(state, ref, str, width, height, colorMap, NULL, gFalse); + GfxImageColorMap *maskColorMap, GBool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, NULL, gFalse); drawImage(state, ref, maskStr, maskWidth, maskHeight, - maskColorMap, NULL, gFalse); + maskColorMap, maskInterpolate, NULL, gFalse); } diff --git a/utils/ImageOutputDev.h b/utils/ImageOutputDev.h index e64cf56..3b07636 100644 --- a/utils/ImageOutputDev.h +++ b/utils/ImageOutputDev.h @@ -74,21 +74,24 @@ public: //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, GBool invert, - GBool inlineImg); + GBool interpolate, GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); + GBool interpolate, int *maskColors, GBool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); + GBool maskInvert, GBool maskInterpolate); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, + GBool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); + GfxImageColorMap *maskColorMap, + GBool maskInterpolate); private: -- 1.6.0.4