poppler/SplashOutputDev.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
New commits: commit 42ef2ac51543fabb5f5f5c3a19c79020d4fb1238 Author: Thomas Freitag <[email protected]> Date: Wed Nov 30 00:14:46 2016 +0100 Read softmask into memstrean in case of matte In case of matte the softmask has to be read twice. This is not possible when read from stdin. So this patch allocate a memstream first and read the softmask into this memstream. Bug #97803 diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 7b6e14a..093baa9 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -4015,6 +4015,16 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, //----- set up the soft mask + if (maskColorMap->getMatteColor() != NULL) { + Guchar *data = (Guchar *) gmalloc(maskWidth * maskHeight); + maskStr->reset(); + maskStr->doGetChars(maskWidth * maskHeight, data); + maskStr->close(); + Object *maskDict = new Object(); + maskDict->initDict(maskStr->getDict()); + maskStr = new MemStream((char *)data, 0, maskWidth * maskHeight, maskDict); + ((MemStream *) maskStr)->setNeedFree(gTrue); + } imgMaskData.imgStr = new ImageStream(maskStr, maskWidth, maskColorMap->getNumPixelComps(), maskColorMap->getBits()); @@ -4042,6 +4052,9 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, maskSplash->drawImage(&imageSrc, NULL, &imgMaskData, splashModeMono8, gFalse, maskWidth, maskHeight, mat, maskInterpolate); delete imgMaskData.imgStr; + if (maskColorMap->getMatteColor() == NULL) { + maskStr->close(); + } gfree(imgMaskData.lookup); delete maskSplash; splash->setSoftMask(maskBitmap); @@ -4141,7 +4154,10 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, gfree(imgData.lookup); delete imgData.maskStr; delete imgData.imgStr; - maskStr->close(); + if (maskColorMap->getMatteColor() != NULL) { + maskStr->close(); + delete maskStr; + } str->close(); } _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
