diff options
author | Mihai <mihai.varga@collabora.com> | 2015-02-13 12:56:11 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-02-17 13:31:29 +0000 |
commit | 98b27ea907517d585f5d951895ae733653a442d2 (patch) | |
tree | 34972139f7f63cbd51a7b917e4a9dc0d77a5c89c /sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | |
parent | 61e9e6d08f79a5b75674b94bccc05880256671e8 (diff) |
SkipImages option for PDF import
This option allows images and drawings to be skipped while importing
a PDF, the main reason was performance improvement where images were
not needed.
Change-Id: Ibca342ff6e7005bedf7b16869473832ce2576fb2
Reviewed-on: https://gerrit.libreoffice.org/14470
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx')
-rw-r--r-- | sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index d3e39887e32e..cf19b30834a7 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -532,7 +532,8 @@ void PDFOutDev::printPath( GfxPath* pPath ) const PDFOutDev::PDFOutDev( PDFDoc* pDoc ) : m_pDoc( pDoc ), m_aFontMap(), - m_pUtf8Map( new UnicodeMap((char*)"UTF-8", gTrue, &mapUTF8) ) + m_pUtf8Map( new UnicodeMap((char*)"UTF-8", gTrue, &mapUTF8) ), + m_bSkipImages(false) { } PDFOutDev::~PDFOutDev() @@ -632,6 +633,8 @@ void PDFOutDev::updateCTM(GfxState* state, void PDFOutDev::updateLineDash(GfxState *state) { + if (m_bSkipImages) + return; assert(state); double* dashArray; int arrayLen; double startOffset; @@ -649,36 +652,48 @@ void PDFOutDev::updateLineDash(GfxState *state) void PDFOutDev::updateFlatness(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "updateFlatness %d\n", state->getFlatness() ); } void PDFOutDev::updateLineJoin(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "updateLineJoin %d\n", state->getLineJoin() ); } void PDFOutDev::updateLineCap(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "updateLineCap %d\n", state->getLineCap() ); } void PDFOutDev::updateMiterLimit(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "updateMiterLimit %f\n", normalize(state->getMiterLimit()) ); } void PDFOutDev::updateLineWidth(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "updateLineWidth %f\n", normalize(state->getLineWidth()) ); } void PDFOutDev::updateFillColor(GfxState *state) { + if (m_bSkipImages) + return; assert(state); GfxRGB aRGB; @@ -693,6 +708,8 @@ void PDFOutDev::updateFillColor(GfxState *state) void PDFOutDev::updateStrokeColor(GfxState *state) { + if (m_bSkipImages) + return; assert(state); GfxRGB aRGB; @@ -707,11 +724,15 @@ void PDFOutDev::updateStrokeColor(GfxState *state) void PDFOutDev::updateFillOpacity(GfxState *state) { + if (m_bSkipImages) + return; updateFillColor(state); } void PDFOutDev::updateStrokeOpacity(GfxState *state) { + if (m_bSkipImages) + return; updateStrokeColor(state); } @@ -774,6 +795,8 @@ void PDFOutDev::updateRender(GfxState *state) void PDFOutDev::stroke(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "strokePath" ); @@ -783,6 +806,8 @@ void PDFOutDev::stroke(GfxState *state) void PDFOutDev::fill(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "fillPath" ); @@ -792,6 +817,8 @@ void PDFOutDev::fill(GfxState *state) void PDFOutDev::eoFill(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "eoFillPath" ); @@ -801,6 +828,8 @@ void PDFOutDev::eoFill(GfxState *state) void PDFOutDev::clip(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "clipPath" ); @@ -810,6 +839,8 @@ void PDFOutDev::clip(GfxState *state) void PDFOutDev::eoClip(GfxState *state) { + if (m_bSkipImages) + return; assert(state); printf( "eoClipPath" ); @@ -915,6 +946,8 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str, #endif GBool /*inlineImg*/ ) { + if (m_bSkipImages) + return; OutputBuffer aBuf; initBuf(aBuf); printf( "drawMask %d %d %d", width, height, invert ); @@ -944,6 +977,8 @@ void PDFOutDev::drawImage(GfxState*, Object*, Stream* str, #endif int* maskColors, GBool /*inlineImg*/ ) { + if (m_bSkipImages) + return; OutputBuffer aBuf; initBuf(aBuf); OutputBuffer aMaskBuf; @@ -999,6 +1034,8 @@ void PDFOutDev::drawMaskedImage(GfxState*, Object*, Stream* str, #endif ) { + if (m_bSkipImages) + return; OutputBuffer aBuf; initBuf(aBuf); printf( "drawImage %d %d 0", width, height ); writePng_( aBuf, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert, true ); @@ -1019,6 +1056,8 @@ void PDFOutDev::drawSoftMaskedImage(GfxState*, Object*, Stream* str, #endif ) { + if (m_bSkipImages) + return; OutputBuffer aBuf; initBuf(aBuf); printf( "drawImage %d %d 0", width, height ); writePng_( aBuf, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap, true ); @@ -1031,6 +1070,11 @@ void PDFOutDev::setPageNum( int nNumPages ) printf("setPageNum %d\n", nNumPages); } +void PDFOutDev::setSkipImages( bool bSkipImages ) +{ + m_bSkipImages = bSkipImages; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |