Kaydet (Commit) 6b18d7d2 authored tarafından Thorsten Behrens's avatar Thorsten Behrens

Fix import of images from pdf.

Seems poppler changed outputdev virt func signatures with version
12, so with system poppler, we never got any image import functions
called. Added override annotation to prevent this from happening in
the future.

Change-Id: I565de80ce218e831e276d3a1d88ded3baee876e7
üst 37193966
...@@ -846,6 +846,9 @@ void PDFOutDev::endTextObject(GfxState*) ...@@ -846,6 +846,9 @@ void PDFOutDev::endTextObject(GfxState*)
void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str, void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str,
int width, int height, GBool invert, int width, int height, GBool invert,
#if POPPLER_CHECK_VERSION(0, 12, 0)
GBool /*interpolate*/,
#endif
GBool /*inlineImg*/ ) GBool /*inlineImg*/ )
{ {
OutputBuffer aBuf; initBuf(aBuf); OutputBuffer aBuf; initBuf(aBuf);
...@@ -872,6 +875,9 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str, ...@@ -872,6 +875,9 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str,
void PDFOutDev::drawImage(GfxState*, Object*, Stream* str, void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
int width, int height, GfxImageColorMap* colorMap, int width, int height, GfxImageColorMap* colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0)
GBool /*interpolate*/,
#endif
int* maskColors, GBool /*inlineImg*/ ) int* maskColors, GBool /*inlineImg*/ )
{ {
OutputBuffer aBuf; initBuf(aBuf); OutputBuffer aBuf; initBuf(aBuf);
...@@ -918,9 +924,16 @@ void PDFOutDev::drawImage(GfxState*, Object*, Stream* str, ...@@ -918,9 +924,16 @@ void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
void PDFOutDev::drawMaskedImage(GfxState*, Object*, Stream* str, void PDFOutDev::drawMaskedImage(GfxState*, Object*, Stream* str,
int width, int height, int width, int height,
GfxImageColorMap* colorMap, GfxImageColorMap* colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0)
GBool /*interpolate*/,
#endif
Stream* maskStr, Stream* maskStr,
int maskWidth, int maskHeight, int maskWidth, int maskHeight,
GBool maskInvert) GBool maskInvert
#if POPPLER_CHECK_VERSION(0, 12, 0)
, GBool /*maskInterpolate*/
#endif
)
{ {
OutputBuffer aBuf; initBuf(aBuf); OutputBuffer aBuf; initBuf(aBuf);
printf( "drawImage %d %d 0", width, height ); printf( "drawImage %d %d 0", width, height );
...@@ -931,9 +944,16 @@ void PDFOutDev::drawMaskedImage(GfxState*, Object*, Stream* str, ...@@ -931,9 +944,16 @@ void PDFOutDev::drawMaskedImage(GfxState*, Object*, Stream* str,
void PDFOutDev::drawSoftMaskedImage(GfxState*, Object*, Stream* str, void PDFOutDev::drawSoftMaskedImage(GfxState*, Object*, Stream* str,
int width, int height, int width, int height,
GfxImageColorMap* colorMap, GfxImageColorMap* colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0)
GBool /*interpolate*/,
#endif
Stream* maskStr, Stream* maskStr,
int maskWidth, int maskHeight, int maskWidth, int maskHeight,
GfxImageColorMap* maskColorMap ) GfxImageColorMap* maskColorMap
#if POPPLER_CHECK_VERSION(0, 12, 0)
, GBool /*maskInterpolate*/
#endif
)
{ {
OutputBuffer aBuf; initBuf(aBuf); OutputBuffer aBuf; initBuf(aBuf);
printf( "drawImage %d %d 0", width, height ); printf( "drawImage %d %d 0", width, height );
......
...@@ -46,6 +46,12 @@ ...@@ -46,6 +46,12 @@
#pragma warning(pop) #pragma warning(pop)
#endif #endif
#if HAVE_CXX11_OVERRIDE
#define SAL_OVERRIDE override
#else
#define SAL_OVERRIDE
#endif
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include <vector> #include <vector>
...@@ -158,125 +164,116 @@ namespace pdfi ...@@ -158,125 +164,116 @@ namespace pdfi
// Does this device use upside-down coordinates? // Does this device use upside-down coordinates?
// (Upside-down means (0,0) is the top left corner of the page.) // (Upside-down means (0,0) is the top left corner of the page.)
virtual GBool upsideDown() { return gTrue; } virtual GBool upsideDown() SAL_OVERRIDE { return gTrue; }
// Does this device use drawChar() or drawString()? // Does this device use drawChar() or drawString()?
virtual GBool useDrawChar() { return gTrue; } virtual GBool useDrawChar() SAL_OVERRIDE { return gTrue; }
// Does this device use beginType3Char/endType3Char? Otherwise, // Does this device use beginType3Char/endType3Char? Otherwise,
// text in Type 3 fonts will be drawn with drawChar/drawString. // text in Type 3 fonts will be drawn with drawChar/drawString.
virtual GBool interpretType3Chars() { return gFalse; } virtual GBool interpretType3Chars() SAL_OVERRIDE { return gFalse; }
// Does this device need non-text content? // Does this device need non-text content?
virtual GBool needNonText() { return gTrue; } virtual GBool needNonText() SAL_OVERRIDE { return gTrue; }
//----- initialization and control //----- initialization and control
// Set default transform matrix. // Set default transform matrix.
virtual void setDefaultCTM(double *ctm); virtual void setDefaultCTM(double *ctm) SAL_OVERRIDE;
// Start a page. // Start a page.
virtual void startPage(int pageNum, GfxState *state); virtual void startPage(int pageNum, GfxState *state) SAL_OVERRIDE;
// End a page. // End a page.
virtual void endPage(); virtual void endPage() SAL_OVERRIDE;
// Dump page contents to display.
// virtual void dump() {}
//----- coordinate conversion
// Convert between device and user coordinates.
// virtual void cvtDevToUser(double dx, double dy, double *ux, double *uy);
// virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy);
//----- link borders //----- link borders
#if POPPLER_CHECK_VERSION(0, 19, 0) #if POPPLER_CHECK_VERSION(0, 19, 0)
virtual void processLink(AnnotLink *link); virtual void processLink(AnnotLink *link) SAL_OVERRIDE;
#elif POPPLER_CHECK_VERSION(0, 17, 0) #elif POPPLER_CHECK_VERSION(0, 17, 0)
virtual void processLink(AnnotLink *link, Catalog *catalog); virtual void processLink(AnnotLink *link, Catalog *catalog) SAL_OVERRIDE;
#else #else
virtual void processLink(Link *link, Catalog *catalog); virtual void processLink(Link *link, Catalog *catalog) SAL_OVERRIDE;
#endif #endif
//----- save/restore graphics state //----- save/restore graphics state
virtual void saveState(GfxState *state); virtual void saveState(GfxState *state) SAL_OVERRIDE;
virtual void restoreState(GfxState *state); virtual void restoreState(GfxState *state) SAL_OVERRIDE;
//----- update graphics state //----- update graphics state
// virtual void updateAll(GfxState *state);
virtual void updateCTM(GfxState *state, double m11, double m12, virtual void updateCTM(GfxState *state, double m11, double m12,
double m21, double m22, double m31, double m32); double m21, double m22, double m31, double m32) SAL_OVERRIDE;
virtual void updateLineDash(GfxState *state); virtual void updateLineDash(GfxState *state) SAL_OVERRIDE;
virtual void updateFlatness(GfxState *state); virtual void updateFlatness(GfxState *state) SAL_OVERRIDE;
virtual void updateLineJoin(GfxState *state); virtual void updateLineJoin(GfxState *state) SAL_OVERRIDE;
virtual void updateLineCap(GfxState *state); virtual void updateLineCap(GfxState *state) SAL_OVERRIDE;
virtual void updateMiterLimit(GfxState *state); virtual void updateMiterLimit(GfxState *state) SAL_OVERRIDE;
virtual void updateLineWidth(GfxState *state); virtual void updateLineWidth(GfxState *state) SAL_OVERRIDE;
virtual void updateFillColor(GfxState *state); virtual void updateFillColor(GfxState *state) SAL_OVERRIDE;
virtual void updateStrokeColor(GfxState *state); virtual void updateStrokeColor(GfxState *state) SAL_OVERRIDE;
virtual void updateFillOpacity(GfxState *state); virtual void updateFillOpacity(GfxState *state) SAL_OVERRIDE;
virtual void updateStrokeOpacity(GfxState *state); virtual void updateStrokeOpacity(GfxState *state) SAL_OVERRIDE;
virtual void updateBlendMode(GfxState *state); virtual void updateBlendMode(GfxState *state) SAL_OVERRIDE;
//----- update text state //----- update text state
virtual void updateFont(GfxState *state); virtual void updateFont(GfxState *state) SAL_OVERRIDE;
// virtual void updateTextMat(GfxState *state); virtual void updateRender(GfxState *state) SAL_OVERRIDE;
// virtual void updateCharSpace(GfxState *state) {}
virtual void updateRender(GfxState *state);
// virtual void updateRise(GfxState *state) {}
// virtual void updateWordSpace(GfxState *state) {}
// virtual void updateHorizScaling(GfxState *state) {}
// virtual void updateTextPos(GfxState *state) {}
// virtual void updateTextShift(GfxState *state, double shift) {}
//----- path painting //----- path painting
virtual void stroke(GfxState *state); virtual void stroke(GfxState *state) SAL_OVERRIDE;
virtual void fill(GfxState *state); virtual void fill(GfxState *state) SAL_OVERRIDE;
virtual void eoFill(GfxState *state); virtual void eoFill(GfxState *state) SAL_OVERRIDE;
//----- path clipping //----- path clipping
virtual void clip(GfxState *state); virtual void clip(GfxState *state) SAL_OVERRIDE;
virtual void eoClip(GfxState *state); virtual void eoClip(GfxState *state) SAL_OVERRIDE;
//----- text drawing //----- text drawing
virtual void drawChar(GfxState *state, double x, double y, virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy, double dx, double dy,
double originX, double originY, double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen); CharCode code, int nBytes, Unicode *u, int uLen) SAL_OVERRIDE;
virtual void drawString(GfxState *state, GooString *s); virtual void drawString(GfxState *state, GooString *s) SAL_OVERRIDE;
virtual void endTextObject(GfxState *state); virtual void endTextObject(GfxState *state) SAL_OVERRIDE;
//----- image drawing //----- image drawing
virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
int width, int height, GBool invert, int width, int height, GBool invert,
GBool inlineImg); #if POPPLER_CHECK_VERSION(0, 12, 0)
GBool interpolate,
#endif
GBool inlineImg) SAL_OVERRIDE;
virtual void drawImage(GfxState *state, Object *ref, Stream *str, virtual void drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height, GfxImageColorMap *colorMap, int width, int height, GfxImageColorMap *colorMap,
int *maskColors, GBool inlineImg); #if POPPLER_CHECK_VERSION(0, 12, 0)
GBool interpolate,
#endif
int *maskColors, GBool inlineImg) SAL_OVERRIDE;
virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height, int width, int height,
GfxImageColorMap *colorMap, GfxImageColorMap *colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0)
GBool interpolate,
#endif
Stream *maskStr, int maskWidth, int maskHeight, Stream *maskStr, int maskWidth, int maskHeight,
GBool maskInvert); GBool maskInvert
#if POPPLER_CHECK_VERSION(0, 12, 0)
, GBool maskInterpolate
#endif
) SAL_OVERRIDE;
virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height, int width, int height,
GfxImageColorMap *colorMap, GfxImageColorMap *colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0)
GBool interpolate,
#endif
Stream *maskStr, Stream *maskStr,
int maskWidth, int maskHeight, int maskWidth, int maskHeight,
GfxImageColorMap *maskColorMap); GfxImageColorMap *maskColorMap
#if POPPLER_CHECK_VERSION(0, 12, 0)
//----- OPI functions , GBool maskInterpolate
// virtual void opiBegin(GfxState *state, Dict *opiDict); #endif
// virtual void opiEnd(GfxState *state, Dict *opiDict); ) SAL_OVERRIDE;
//----- Type 3 font operators
// 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) {}
//----- PostScript XObjects
// virtual void psXObject(Stream *psStream, Stream *level1Stream) {}
void setPageNum( int nNumPages ); void setPageNum( int nNumPages );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment