diff --git a/.gitignore b/.gitignore index 81be867..c49977f 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,3 @@ Testing/* DartConfiguration.tcl test/test.py *.swp - diff --git a/3rdparty/poppler/git/CairoFontEngine.cc b/3rdparty/poppler/git/CairoFontEngine.cc index b894000..45ef764 100644 --- a/3rdparty/poppler/git/CairoFontEngine.cc +++ b/3rdparty/poppler/git/CairoFontEngine.cc @@ -28,6 +28,8 @@ // Copyright (C) 2012 Hib Eris // Copyright (C) 2013 Thomas Freitag // Copyright (C) 2015, 2016 Jason Crain +// Copyright (C) 2018 Adam Reichold +// Copyright (C) 2019 Christian Persch // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -55,16 +57,6 @@ #define CAN_CHECK_OPEN_FACES 1 #endif -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#ifdef MULTITHREADED -# define fontEngineLocker() MutexLocker locker(&mutex) -#else -# define fontEngineLocker() -#endif - //------------------------------------------------------------------------ // CairoFont //------------------------------------------------------------------------ @@ -72,9 +64,9 @@ CairoFont::CairoFont(Ref refA, cairo_font_face_t *cairo_font_faceA, int *codeToGIDA, - Guint codeToGIDLenA, - GBool substituteA, - GBool printingA) : ref(refA), + unsigned int codeToGIDLenA, + bool substituteA, + bool printingA) : ref(refA), cairo_font_face(cairo_font_faceA), codeToGID(codeToGIDA), codeToGIDLen(codeToGIDLenA), @@ -86,8 +78,8 @@ CairoFont::~CairoFont() { gfree(codeToGID); } -GBool -CairoFont::matches(Ref &other, GBool printingA) { +bool +CairoFont::matches(Ref &other, bool printingA) { return (other.num == ref.num && other.gen == ref.gen); } @@ -114,7 +106,7 @@ CairoFont::getSubstitutionCorrection(GfxFont *gfxFont) { double w1, w2, w3; CharCode code; - char *name; + const char *name; // for substituted fonts: adjust the font matrix -- compare the // width of 'm' in the original font and the substituted font @@ -169,7 +161,7 @@ _ft_done_face_uncached (void *closure) FT_Done_Face (face); } -static GBool +static bool _ft_new_face_uncached (FT_Library lib, const char *filename, char *font_data, @@ -182,10 +174,10 @@ _ft_new_face_uncached (FT_Library lib, if (font_data == nullptr) { if (FT_New_Face (lib, filename, 0, &face)) - return gFalse; + return false; } else { if (FT_New_Memory_Face (lib, (unsigned char *)font_data, font_data_len, 0, &face)) - return gFalse; + return false; } font_face = cairo_ft_font_face_create_for_ft_face (face, @@ -198,12 +190,12 @@ _ft_new_face_uncached (FT_Library lib, { _ft_done_face_uncached (face); cairo_font_face_destroy (font_face); - return gFalse; + return false; } *face_out = face; *font_face_out = font_face; - return gTrue; + return true; } #ifdef CAN_CHECK_OPEN_FACES @@ -232,15 +224,15 @@ _djb_hash (const unsigned char *bytes, size_t len) return hash; } -static GBool +static bool _ft_face_data_equal (struct _ft_face_data *a, struct _ft_face_data *b) { if (a->lib != b->lib) - return gFalse; + return false; if (a->size != b->size) - return gFalse; + return false; if (a->hash != b->hash) - return gFalse; + return false; return memcmp (a->bytes, b->bytes, a->size) == 0; } @@ -272,7 +264,7 @@ _ft_done_face (void *closure) gfree (data); } -static GBool +static bool _ft_new_face (FT_Library lib, const char *filename, char *font_data, @@ -288,7 +280,7 @@ _ft_new_face (FT_Library lib, if (font_data == nullptr) { /* if we fail to mmap the file, just pass it to FreeType instead */ - tmpl.fd = open (filename, O_RDONLY); + tmpl.fd = openFileDescriptor (filename, O_RDONLY); if (tmpl.fd == -1) return _ft_new_face_uncached (lib, filename, font_data, font_data_len, face_out, font_face_out); @@ -328,7 +320,7 @@ _ft_new_face (FT_Library lib, } *face_out = l->face; *font_face_out = cairo_font_face_reference (l->font_face); - return gTrue; + return true; } } @@ -346,7 +338,7 @@ _ft_new_face (FT_Library lib, close (tmpl.fd); } - return gFalse; + return false; } l = (struct _ft_face_data *) gmallocn (1, sizeof (struct _ft_face_data)); @@ -367,12 +359,12 @@ _ft_new_face (FT_Library lib, { cairo_font_face_destroy (l->font_face); _ft_done_face (l); - return gFalse; + return false; } *face_out = l->face; *font_face_out = l->font_face; - return gTrue; + return true; } #else #define _ft_new_face _ft_new_face_uncached @@ -381,20 +373,20 @@ _ft_new_face (FT_Library lib, CairoFreeTypeFont::CairoFreeTypeFont(Ref refA, cairo_font_face_t *cairo_font_faceA, int *codeToGIDA, - Guint codeToGIDLenA, - GBool substituteA) : CairoFont(refA, + unsigned int codeToGIDLenA, + bool substituteA) : CairoFont(refA, cairo_font_faceA, codeToGIDA, codeToGIDLenA, substituteA, - gTrue) { } + true) { } CairoFreeTypeFont::~CairoFreeTypeFont() { } CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, - FT_Library lib, GBool useCIDs) { + FT_Library lib, bool useCIDs) { GooString *fileName; - char *fileNameC; + const char *fileNameC; char *font_data; int font_data_len; int i, n; @@ -409,7 +401,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, cairo_font_face_t *font_face; int *codeToGID; - Guint codeToGIDLen; + unsigned int codeToGIDLen; codeToGID = nullptr; codeToGIDLen = 0; @@ -418,14 +410,14 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, fileName = nullptr; fileNameC = nullptr; - GBool substitute = gFalse; + bool substitute = false; ref = *gfxFont->getID(); fontType = gfxFont->getType(); if (!(fontLoc = gfxFont->locateFont(xref, nullptr))) { error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -440,11 +432,11 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, } else { // gfxFontLocExternal fileName = fontLoc->path; fontType = fontLoc->fontType; - substitute = gTrue; + substitute = true; } if (fileName != nullptr) { - fileNameC = fileName->getCString(); + fileNameC = fileName->c_str(); } switch (fontType) { @@ -615,7 +607,7 @@ typedef struct _type3_font_info { GfxFont *font; PDFDoc *doc; CairoFontEngine *fontEngine; - GBool printing; + bool printing; XRef *xref; } type3_font_info_t; @@ -635,13 +627,12 @@ _init_type3_glyph (cairo_scaled_font_t *scaled_font, { type3_font_info_t *info; GfxFont *font; - double *mat; info = (type3_font_info_t *) cairo_font_face_get_user_data (cairo_scaled_font_get_font_face (scaled_font), &type3_font_key); font = info->font; - mat = font->getFontBBox(); + const double *mat = font->getFontBBox(); extents->ascent = mat[3]; /* y2 */ extents->descent = -mat[3]; /* -y1 */ extents->height = extents->ascent + extents->descent; @@ -661,7 +652,7 @@ _render_type3_glyph (cairo_scaled_font_t *scaled_font, Object charProc; CairoOutputDev *output_dev; cairo_matrix_t matrix, invert_y_axis; - double *mat; + const double *mat; double wx, wy; PDFRectangle box; type3_font_info_t *info; @@ -705,7 +696,7 @@ _render_type3_glyph (cairo_scaled_font_t *scaled_font, gfx = new Gfx(info->doc, output_dev, resDict, &box, nullptr); output_dev->startDoc(info->doc, info->fontEngine); output_dev->startPage (1, gfx->getState(), gfx->getXRef()); - output_dev->setInType3Char(gTrue); + output_dev->setInType3Char(true); charProc = charProcs->getVal(glyph); gfx->display(&charProc); @@ -733,12 +724,12 @@ _render_type3_glyph (cairo_scaled_font_t *scaled_font, CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc, CairoFontEngine *fontEngine, - GBool printing, XRef *xref) { + bool printing, XRef *xref) { type3_font_info_t *info; cairo_font_face_t *font_face; Ref ref; int *codeToGID; - Guint codeToGIDLen; + unsigned int codeToGIDLen; int i, j; char **enc; Dict *charProcs; @@ -773,26 +764,25 @@ CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc, } } - return new CairoType3Font(ref, doc, font_face, codeToGID, codeToGIDLen, printing, xref); + return new CairoType3Font(ref, font_face, codeToGID, codeToGIDLen, printing, xref); } CairoType3Font::CairoType3Font(Ref refA, - PDFDoc *docA, cairo_font_face_t *cairo_font_faceA, int *codeToGIDA, - Guint codeToGIDLenA, - GBool printingA, XRef *xref) : CairoFont(refA, + unsigned int codeToGIDLenA, + bool printingA, XRef *xref) : CairoFont(refA, cairo_font_faceA, codeToGIDA, codeToGIDLenA, - gFalse, - printingA), - doc(docA) { } + false, + printingA) +{ } CairoType3Font::~CairoType3Font() { } -GBool -CairoType3Font::matches(Ref &other, GBool printingA) { +bool +CairoType3Font::matches(Ref &other, bool printingA) { return (other.num == ref.num && other.gen == ref.gen && printing == printingA); } @@ -801,6 +791,8 @@ CairoType3Font::matches(Ref &other, GBool printingA) { // CairoFontEngine //------------------------------------------------------------------------ +#define fontEngineLocker() std::unique_lock locker(mutex) + CairoFontEngine::CairoFontEngine(FT_Library libA) { int i; @@ -814,9 +806,6 @@ CairoFontEngine::CairoFontEngine(FT_Library libA) { FT_Library_Version(lib, &major, &minor, &patch); useCIDs = major > 2 || (major == 2 && (minor > 1 || (minor == 1 && patch > 7))); -#ifdef MULTITHREADED - gInitMutex(&mutex); -#endif } CairoFontEngine::~CairoFontEngine() { @@ -826,13 +815,10 @@ CairoFontEngine::~CairoFontEngine() { if (fontCache[i]) delete fontCache[i]; } -#ifdef MULTITHREADED - gDestroyMutex(&mutex); -#endif } CairoFont * -CairoFontEngine::getFont(GfxFont *gfxFont, PDFDoc *doc, GBool printing, XRef *xref) { +CairoFontEngine::getFont(GfxFont *gfxFont, PDFDoc *doc, bool printing, XRef *xref) { int i, j; Ref ref; CairoFont *font; diff --git a/3rdparty/poppler/git/CairoFontEngine.h b/3rdparty/poppler/git/CairoFontEngine.h index 601fbae..2a55af1 100644 --- a/3rdparty/poppler/git/CairoFontEngine.h +++ b/3rdparty/poppler/git/CairoFontEngine.h @@ -20,6 +20,7 @@ // Copyright (C) 2006, 2010 Carlos Garcia Campos // Copyright (C) 2008, 2017 Adrian Johnson // Copyright (C) 2013 Thomas Freitag +// Copyright (C) 2018 Adam Reichold // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -29,12 +30,9 @@ #ifndef CAIROFONTENGINE_H #define CAIROFONTENGINE_H -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif +#include #include "poppler-config.h" -#include "goo/gtypes.h" #include #include "GfxFont.h" @@ -47,40 +45,40 @@ public: CairoFont(Ref ref, cairo_font_face_t *face, int *codeToGID, - Guint codeToGIDLen, - GBool substitute, - GBool printing); + unsigned int codeToGIDLen, + bool substitute, + bool printing); virtual ~CairoFont(); CairoFont(const CairoFont &) = delete; CairoFont& operator=(const CairoFont &other) = delete; - virtual GBool matches(Ref &other, GBool printing); + virtual bool matches(Ref &other, bool printing); cairo_font_face_t *getFontFace(void); unsigned long getGlyph(CharCode code, Unicode *u, int uLen); double getSubstitutionCorrection(GfxFont *gfxFont); - GBool isSubstitute() { return substitute; } + bool isSubstitute() { return substitute; } protected: Ref ref; cairo_font_face_t *cairo_font_face; int *codeToGID; - Guint codeToGIDLen; + unsigned int codeToGIDLen; - GBool substitute; - GBool printing; + bool substitute; + bool printing; }; //------------------------------------------------------------------------ class CairoFreeTypeFont : public CairoFont { public: - static CairoFreeTypeFont *create(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs); + static CairoFreeTypeFont *create(GfxFont *gfxFont, XRef *xref, FT_Library lib, bool useCIDs); ~CairoFreeTypeFont(); private: CairoFreeTypeFont(Ref ref, cairo_font_face_t *cairo_font_face, - int *codeToGID, Guint codeToGIDLen, GBool substitute); + int *codeToGID, unsigned int codeToGIDLen, bool substitute); }; //------------------------------------------------------------------------ @@ -89,17 +87,16 @@ class CairoType3Font : public CairoFont { public: static CairoType3Font *create(GfxFont *gfxFont, PDFDoc *doc, CairoFontEngine *fontEngine, - GBool printing, XRef *xref); + bool printing, XRef *xref); ~CairoType3Font(); - GBool matches(Ref &other, GBool printing) override; + bool matches(Ref &other, bool printing) override; private: - CairoType3Font(Ref ref, PDFDoc *doc, + CairoType3Font(Ref ref, cairo_font_face_t *cairo_font_face, - int *codeToGID, Guint codeToGIDLen, - GBool printing, XRef *xref); - PDFDoc *doc; + int *codeToGID, unsigned int codeToGIDLen, + bool printing, XRef *xref); }; //------------------------------------------------------------------------ @@ -119,15 +116,13 @@ public: CairoFontEngine(const CairoFontEngine &) = delete; CairoFontEngine& operator=(const CairoFontEngine &other) = delete; - CairoFont *getFont(GfxFont *gfxFont, PDFDoc *doc, GBool printing, XRef *xref); + CairoFont *getFont(GfxFont *gfxFont, PDFDoc *doc, bool printing, XRef *xref); private: CairoFont *fontCache[cairoFontCacheSize]; FT_Library lib; - GBool useCIDs; -#ifdef MULTITHREADED - GooMutex mutex; -#endif + bool useCIDs; + mutable std::recursive_mutex mutex; }; #endif diff --git a/3rdparty/poppler/git/CairoOutputDev.cc b/3rdparty/poppler/git/CairoOutputDev.cc index 1de6ddd..61a4fd2 100644 --- a/3rdparty/poppler/git/CairoOutputDev.cc +++ b/3rdparty/poppler/git/CairoOutputDev.cc @@ -16,11 +16,11 @@ // // Copyright (C) 2005-2008 Jeff Muizelaar // Copyright (C) 2005, 2006 Kristian Høgsberg -// Copyright (C) 2005, 2009, 2012, 2017, 2018 Albert Astals Cid +// Copyright (C) 2005, 2009, 2012, 2017-2019 Albert Astals Cid // Copyright (C) 2005 Nickolay V. Shmyrev // Copyright (C) 2006-2011, 2013, 2014, 2017, 2018 Carlos Garcia Campos // Copyright (C) 2008 Carl Worth -// Copyright (C) 2008-2017 Adrian Johnson +// Copyright (C) 2008-2018 Adrian Johnson // Copyright (C) 2008 Michael Vrable // Copyright (C) 2008, 2009 Chris Wilson // Copyright (C) 2008, 2012 Hib Eris @@ -30,6 +30,7 @@ // Copyright (C) 2012, 2015, 2016 Jason Crain // Copyright (C) 2015 Suzuki Toshiya // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich +// Copyright (C) 2018 Adam Reichold // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -38,10 +39,6 @@ #include -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - #include #include #include @@ -81,12 +78,6 @@ #define LOG(x) #endif -static inline void printMatrix(cairo_matrix_t *matrix){ - printf("%f %f, %f %f (%f %f)\n", matrix->xx, matrix->yx, - matrix->xy, matrix->yy, - matrix->x0, matrix->y0); -} - #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) @@ -126,18 +117,18 @@ void CairoImage::setImage (cairo_surface_t *image) { // FT_Library instance; to avoid leaks, just use a single global instance // initialized the first time it is needed. FT_Library CairoOutputDev::ft_lib; -GBool CairoOutputDev::ft_lib_initialized = gFalse; +bool CairoOutputDev::ft_lib_initialized = false; CairoOutputDev::CairoOutputDev() { doc = nullptr; if (!ft_lib_initialized) { FT_Init_FreeType(&ft_lib); - ft_lib_initialized = gTrue; + ft_lib_initialized = true; } fontEngine = nullptr; - fontEngine_owner = gFalse; + fontEngine_owner = false; glyphs = nullptr; fill_pattern = nullptr; fill_color.r = fill_color.g = fill_color.b = 0; @@ -150,16 +141,16 @@ CairoOutputDev::CairoOutputDev() { cairo = nullptr; currentFont = nullptr; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) - prescaleImages = gFalse; + prescaleImages = false; #else - prescaleImages = gTrue; + prescaleImages = true; #endif - printing = gTrue; - use_show_text_glyphs = gFalse; - inUncoloredPattern = gFalse; - inType3Char = gFalse; - t3_glyph_has_bbox = gFalse; - text_matrix_valid = gTrue; + printing = true; + use_show_text_glyphs = false; + inUncoloredPattern = false; + inType3Char = false; + t3_glyph_has_bbox = false; + text_matrix_valid = true; antialias = CAIRO_ANTIALIAS_DEFAULT; groupColorSpaceStack = nullptr; @@ -175,9 +166,9 @@ CairoOutputDev::CairoOutputDev() { // the SA parameter supposedly defaults to false, but Acrobat // apparently hardwires it to true - stroke_adjust = gTrue; - align_stroke_coords = gFalse; - adjusted_stroke_width = gFalse; + stroke_adjust = true; + align_stroke_coords = false; + adjusted_stroke_width = false; xref = nullptr; } @@ -270,7 +261,7 @@ void CairoOutputDev::startDoc(PDFDoc *docA, delete fontEngine; } fontEngine = new CairoFontEngine(ft_lib); - fontEngine_owner = gTrue; + fontEngine_owner = true; } xref = doc->getXRef(); } @@ -295,7 +286,7 @@ void CairoOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { void CairoOutputDev::endPage() { if (text) { text->endPage(); - text->coalesce(gTrue, 0, gFalse); + text->coalesce(true, 0, false); } } @@ -321,7 +312,7 @@ void CairoOutputDev::restoreState(GfxState *state) { if (cairo_shape) cairo_restore (cairo_shape); - text_matrix_valid = gTrue; + text_matrix_valid = true; /* These aren't restored by cairo_restore() since we keep them in * the output device. */ @@ -362,12 +353,12 @@ void CairoOutputDev::updateAll(GfxState *state) { updateFillOpacity(state); updateStrokeOpacity(state); updateBlendMode(state); - needFontUpdate = gTrue; + needFontUpdate = true; if (text) text->updateFont(state); } -void CairoOutputDev::setDefaultCTM(double *ctm) { +void CairoOutputDev::setDefaultCTM(const double *ctm) { cairo_matrix_t matrix; matrix.xx = ctm[0]; matrix.yx = ctm[1]; @@ -473,7 +464,7 @@ void CairoOutputDev::updateMiterLimit(GfxState *state) { void CairoOutputDev::updateLineWidth(GfxState *state) { LOG(printf ("line width: %f\n", state->getLineWidth())); - adjusted_stroke_width = gFalse; + adjusted_stroke_width = false; double width = state->getLineWidth(); if (stroke_adjust && !printing) { double x, y; @@ -486,7 +477,7 @@ void CairoOutputDev::updateLineWidth(GfxState *state) { x = y = 1.0; cairo_device_to_user_distance(cairo, &x, &y); width = MIN(fabs(x),fabs(y)); - adjusted_stroke_width = gTrue; + adjusted_stroke_width = true; } } else if (width == 0.0) { /* Cairo does not support 0 line width == 1 device pixel. Find out @@ -663,9 +654,9 @@ void CairoOutputDev::updateFont(GfxState *state) { cairo_font_face_t *font_face; cairo_matrix_t matrix, invert_matrix; - LOG(printf ("updateFont() font=%s\n", state->getFont()->getName()->getCString())); + LOG(printf ("updateFont() font=%s\n", state->getFont()->getName()->c_str())); - needFontUpdate = gFalse; + needFontUpdate = false; //FIXME: use cairo font engine? if (text) @@ -683,7 +674,7 @@ void CairoOutputDev::updateFont(GfxState *state) { cairo_surface_has_show_text_glyphs (cairo_get_target (cairo)); double fontSize = state->getFontSize(); - double *m = state->getTextMat(); + const double *m = state->getTextMat(); /* NOTE: adjusting by a constant is hack. The correct solution * is probably to use user-fonts and compute the scale on a per * glyph basis instead of for the entire font */ @@ -706,12 +697,12 @@ void CairoOutputDev::updateFont(GfxState *state) { invert_matrix = matrix; if (cairo_matrix_invert(&invert_matrix)) { error(errSyntaxWarning, -1, "font matrix not invertible"); - text_matrix_valid = gFalse; + text_matrix_valid = false; return; } cairo_set_font_matrix (cairo, &matrix); - text_matrix_valid = gTrue; + text_matrix_valid = true; } /* Tolerance in pixels for checking if strokes are horizontal or vertical @@ -723,7 +714,7 @@ void CairoOutputDev::updateFont(GfxState *state) { void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y) { double x1, y1, x2, y2; - GBool align = gFalse; + bool align = false; x1 = subpath->getX(i); y1 = subpath->getY(i); @@ -735,7 +726,7 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do y2 = subpath->getY(i - 1); cairo_user_to_device (cairo, &x2, &y2); if (fabs(x2 - x1) < STROKE_COORD_TOLERANCE || fabs(y2 - y1) < STROKE_COORD_TOLERANCE) - align = gTrue; + align = true; } // Does the current coord and next coord form a horiz or vert line? @@ -744,7 +735,7 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do y2 = subpath->getY(i + 1); cairo_user_to_device (cairo, &x2, &y2); if (fabs(x2 - x1) < STROKE_COORD_TOLERANCE || fabs(y2 - y1) < STROKE_COORD_TOLERANCE) - align = gTrue; + align = true; } *x = subpath->getX(i); @@ -818,9 +809,9 @@ void CairoOutputDev::stroke(GfxState *state) { } if (adjusted_stroke_width) - align_stroke_coords = gTrue; + align_stroke_coords = true; doPath (cairo, state, state->getPath()); - align_stroke_coords = gFalse; + align_stroke_coords = false; cairo_set_source (cairo, stroke_pattern); LOG(printf ("stroke\n")); if (strokePathClip) { @@ -896,9 +887,9 @@ void CairoOutputDev::eoFill(GfxState *state) { } -GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str, - double *pmat, int paintType, int /*tilingType*/, Dict *resDict, - double *mat, double *bbox, +bool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str, + const double *pmat, int paintType, int /*tilingType*/, Dict *resDict, + const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) { @@ -914,14 +905,14 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat double scaleX, scaleY; int surface_width, surface_height; StrokePathClip *strokePathTmp; - GBool adjusted_stroke_width_tmp; + bool adjusted_stroke_width_tmp; cairo_pattern_t *maskTmp; width = bbox[2] - bbox[0]; height = bbox[3] - bbox[1]; if (xStep != width || yStep != height) - return gFalse; + return false; /* TODO: implement the other cases here too */ // Find the width and height of the transformed pattern @@ -943,7 +934,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat CAIRO_CONTENT_COLOR_ALPHA, surface_width, surface_height); if (cairo_surface_status (surface)) - return gFalse; + return false; old_cairo = cairo; cairo = cairo_create (surface); @@ -962,10 +953,10 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat mask = nullptr; gfx = new Gfx(doc, this, resDict, &box, nullptr, nullptr, nullptr, gfxA); if (paintType == 2) - inUncoloredPattern = gTrue; + inUncoloredPattern = true; gfx->display(str); if (paintType == 2) - inUncoloredPattern = gFalse; + inUncoloredPattern = false; delete gfx; strokePathClip = strokePathTmp; adjusted_stroke_width = adjusted_stroke_width_tmp; @@ -975,7 +966,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat cairo_destroy (cairo); cairo = old_cairo; if (cairo_pattern_status (pattern)) - return gFalse; + return false; state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); cairo_rectangle (cairo, xMin, yMin, xMax - xMin, yMax - yMin); @@ -995,11 +986,11 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat cairo_pattern_destroy (pattern); - return gTrue; + return true; } #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) -GBool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) +bool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) { // Function shaded fills are subdivided to rectangles that are the // following size in device space. Note when printing this size is @@ -1012,10 +1003,9 @@ GBool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *sh double y_step; GfxColor color; GfxRGB rgb; - double *matrix; cairo_matrix_t mat; - matrix = shading->getMatrix(); + const double *matrix = shading->getMatrix(); mat.xx = matrix[0]; mat.yx = matrix[1]; mat.xy = matrix[2]; @@ -1024,7 +1014,7 @@ GBool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *sh mat.y0 = matrix[5]; if (cairo_matrix_invert(&mat)) { error(errSyntaxWarning, -1, "matrix not invertible\n"); - return gFalse; + return false; } // get cell size in pattern space @@ -1095,11 +1085,11 @@ GBool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *sh fill(state); state->clearPath(); - return gTrue; + return true; } #endif /* CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) */ -GBool CairoOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) { +bool CairoOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) { double x0, y0, x1, y1; double dx, dy; @@ -1119,15 +1109,15 @@ GBool CairoOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, // TODO: use the actual stops in the shading in the case // of linear interpolation (Type 2 Exponential functions with N=1) - return gFalse; + return false; } -GBool CairoOutputDev::axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) +bool CairoOutputDev::axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) { return (shading->getExtend0() == shading->getExtend1()); } -GBool CairoOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) { +bool CairoOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) { double x0, y0, r0, x1, y1, r1; double dx, dy, dr; cairo_matrix_t matrix; @@ -1163,16 +1153,16 @@ GBool CairoOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shadin LOG (printf ("radial-sh\n")); - return gFalse; + return false; } -GBool CairoOutputDev::radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) +bool CairoOutputDev::radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) { return (shading->getExtend0() == shading->getExtend1()); } #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) -GBool CairoOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) +bool CairoOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) { double x0, y0, x1, y1, x2, y2; GfxColor color[3]; @@ -1227,10 +1217,10 @@ GBool CairoOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTrian fill(state); state->clearPath(); - return gTrue; + return true; } -GBool CairoOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) +bool CairoOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) { int i, j, k; @@ -1238,7 +1228,7 @@ GBool CairoOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading * fill_pattern = cairo_pattern_create_mesh (); for (i = 0; i < shading->getNPatches(); i++) { - GfxPatch *patch = shading->getPatch(i); + const GfxPatch *patch = shading->getPatch(i); GfxColor color; GfxRGB rgb; @@ -1317,7 +1307,7 @@ GBool CairoOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading * fill(state); state->clearPath(); - return gTrue; + return true; } #endif /* CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) */ @@ -1519,15 +1509,14 @@ finish: } -GBool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, +bool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { cairo_save (cairo); - double *ctm; cairo_matrix_t matrix; - ctm = state->getCTM(); + const double *ctm = state->getCTM(); matrix.xx = ctm[0]; matrix.yx = ctm[1]; matrix.xy = ctm[2]; @@ -1546,7 +1535,7 @@ GBool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, cairo_pattern_destroy(stroke_pattern); cairo_pattern_reference(fill_pattern); stroke_pattern = fill_pattern; - return gFalse; + return false; } void CairoOutputDev::endType3Char(GfxState *state) { @@ -1569,7 +1558,7 @@ void CairoOutputDev::type3D1(GfxState *state, double wx, double wy, t3_glyph_bbox[1] = lly; t3_glyph_bbox[2] = urx; t3_glyph_bbox[3] = ury; - t3_glyph_has_bbox = gTrue; + t3_glyph_has_bbox = true; } void CairoOutputDev::beginTextObject(GfxState *state) { @@ -1629,10 +1618,10 @@ cairo_surface_t *cairo_surface_create_similar_clip (cairo_t *cairo, cairo_conten -void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/, +void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, GfxColorSpace * blendingColorSpace, - GBool /*isolated*/, GBool knockout, - GBool forSoftMask) { + bool /*isolated*/, bool knockout, + bool forSoftMask) { /* push color space */ ColorSpaceStack* css = new ColorSpaceStack; css->cs = blendingColorSpace; @@ -1656,7 +1645,6 @@ void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, double * /*bbo cairo_set_source_rgb (cairo_shape, 0, 0, 0); cairo_matrix_t matrix; cairo_get_matrix (cairo, &matrix); - //printMatrix(&matrix); cairo_set_matrix (cairo_shape, &matrix); } } @@ -1692,7 +1680,7 @@ void CairoOutputDev::endTransparencyGroup(GfxState * /*state*/) { } } -void CairoOutputDev::paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) { +void CairoOutputDev::paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) { LOG(printf ("paint transparency group\n")); cairo_save (cairo); @@ -1758,7 +1746,7 @@ static int luminocity(uint32_t x) /* XXX: do we need to deal with shape here? */ -void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha, +void CairoOutputDev::setSoftMask(GfxState * state, const double * bbox, bool alpha, Function * transferFunc, GfxColor * backdropColor) { cairo_pattern_destroy(mask); @@ -1838,7 +1826,7 @@ void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha, cairo_destroy(maskCtx); /* convert to a luminocity map */ - uint32_t *source_data = (uint32_t*)cairo_image_surface_get_data(source); + uint32_t *source_data = reinterpret_cast(cairo_image_surface_get_data(source)); /* get stride in units of 32 bits */ ptrdiff_t stride = cairo_image_surface_get_stride(source)/4; for (int y=0; y= 0) { tx = splashRound(matrix->x0 - 0.01); tx2 = splashRound(matrix->x0 + xScale + 0.01) - 1; @@ -1968,7 +1956,7 @@ void CairoOutputDev::getScaledSize(const cairo_matrix_t *matrix, cairo_filter_t CairoOutputDev::getFilterForSurface(cairo_surface_t *image, - GBool interpolate) + bool interpolate) { if (interpolate) return CAIRO_FILTER_GOOD; @@ -1995,8 +1983,8 @@ CairoOutputDev::getFilterForSurface(cairo_surface_t *image, } void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { /* FIXME: Doesn't the image mask support any colorspace? */ cairo_set_source (cairo, fill_pattern); @@ -2004,7 +1992,7 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, /* work around a cairo bug when scaling 1x1 surfaces */ if (width == 1 && height == 1) { ImageStream *imgStr; - Guchar pix; + unsigned char pix; int invert_bit; imgStr = new ImageStream(str, width, 1, 1); @@ -2049,8 +2037,8 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, } void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) { + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) { /* FIXME: Doesn't the image mask support any colorspace? */ cairo_set_source (cairo, fill_pattern); @@ -2058,7 +2046,7 @@ void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stre /* work around a cairo bug when scaling 1x1 surfaces */ if (width == 1 && height == 1) { ImageStream *imgStr; - Guchar pix; + unsigned char pix; int invert_bit; imgStr = new ImageStream(str, width, 1, 1); @@ -2090,9 +2078,9 @@ void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stre //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, gFalse, inlineImg); + drawImageMaskPrescaled(state, ref, str, width, height, invert, false, inlineImg); } else { - drawImageMaskRegular(state, ref, str, width, height, invert, gFalse, inlineImg); + drawImageMaskRegular(state, ref, str, width, height, invert, false, inlineImg); } if (state->getFillColorSpace()->getMode() == csPattern) { @@ -2109,7 +2097,7 @@ void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stre saveState(state); double bbox[4] = {0,0,1,1}; // dummy beginTransparencyGroup(state, bbox, state->getFillColorSpace(), - gTrue, gFalse, gFalse); + true, false, false); } void CairoOutputDev::unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) { @@ -2122,15 +2110,15 @@ void CairoOutputDev::unsetSoftMaskFromImageMask(GfxState *state, double *baseMat } void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { unsigned char *buffer; unsigned char *dest; cairo_surface_t *image; cairo_pattern_t *pattern; int x, y, i, bit; ImageStream *imgStr; - Guchar *pix; + unsigned char *pix; cairo_matrix_t matrix; int invert_bit; ptrdiff_t row_stride; @@ -2231,13 +2219,13 @@ cleanup: void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { unsigned char *buffer; cairo_surface_t *image; cairo_pattern_t *pattern; ImageStream *imgStr; - Guchar *pix; + unsigned char *pix; cairo_matrix_t matrix; int invert_bit; ptrdiff_t row_stride; @@ -2254,7 +2242,7 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream /* this whole computation should be factored out */ double xScale = matrix.xx; double yScale = matrix.yy; - int tx, tx2, ty, ty2; /* the integer co-oridinates of the resulting image */ + int tx, tx2, ty, ty2; /* the integer co-ordinates of the resulting image */ int scaledHeight; int scaledWidth; if (xScale >= 0) { @@ -2527,10 +2515,10 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, - int maskHeight, GBool maskInvert, - GBool maskInterpolate) + int maskHeight, bool maskInvert, + bool maskInterpolate) { ImageStream *maskImgStr, *imgStr; ptrdiff_t row_stride; @@ -2541,7 +2529,7 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, cairo_pattern_t *maskPattern, *pattern; cairo_matrix_t matrix; cairo_matrix_t maskMatrix; - Guchar *pix; + unsigned char *pix; int x, y; int invert_bit; cairo_filter_t filter; @@ -2606,7 +2594,7 @@ void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, buffer = cairo_image_surface_get_data (image); row_stride = cairo_image_surface_get_stride (image); for (y = 0; y < height; y++) { - dest = (unsigned int *) (buffer + y * row_stride); + dest = reinterpret_cast(buffer + y * row_stride); pix = imgStr->getLine(); colorMap->getRGBLine (pix, dest, width); } @@ -2684,11 +2672,11 @@ cleanup: void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) + bool maskInterpolate) { ImageStream *maskImgStr, *imgStr; ptrdiff_t row_stride; @@ -2698,7 +2686,7 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s cairo_surface_t *maskImage, *image; cairo_pattern_t *maskPattern, *pattern; cairo_matrix_t maskMatrix, matrix; - Guchar *pix; + unsigned char *pix; int y; cairo_filter_t filter; cairo_filter_t maskFilter; @@ -2758,7 +2746,7 @@ void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *s buffer = cairo_image_surface_get_data (image); row_stride = cairo_image_surface_get_stride (image); for (y = 0; y < height; y++) { - dest = (unsigned int *) (buffer + y * row_stride); + dest = reinterpret_cast(buffer + y * row_stride); pix = imgStr->getLine(); colorMap->getRGBLine (pix, dest, width); } @@ -2845,7 +2833,7 @@ cleanup: delete imgStr; } -GBool CairoOutputDev::getStreamData (Stream *str, char **buffer, int *length) +bool CairoOutputDev::getStreamData (Stream *str, char **buffer, int *length) { int len, i; char *strBuffer; @@ -2855,7 +2843,7 @@ GBool CairoOutputDev::getStreamData (Stream *str, char **buffer, int *length) str->reset(); while (str->getChar() != EOF) len++; if (len == 0) - return gFalse; + return false; strBuffer = (char *)gmalloc (len); @@ -2867,16 +2855,16 @@ GBool CairoOutputDev::getStreamData (Stream *str, char **buffer, int *length) *buffer = strBuffer; *length = len; - return gTrue; + return true; } -static GBool colorMapHasIdentityDecodeMap(GfxImageColorMap *colorMap) +static bool colorMapHasIdentityDecodeMap(GfxImageColorMap *colorMap) { for (int i = 0; i < colorMap->getNumPixelComps(); i++) { if (colorMap->getDecodeLow(i) != 0.0 || colorMap->getDecodeHigh(i) != 1.0) - return gFalse; + return false; } - return gTrue; + return true; } #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) @@ -2896,7 +2884,7 @@ static cairo_status_t setMimeIdFromRef(cairo_surface_t *surface, mime_id->appendf("{0:d}-{1:d}", ref.gen, ref.num); - idBuffer = copyString(mime_id->getCString()); + idBuffer = copyString(mime_id->c_str()); status = cairo_surface_set_mime_data (surface, mime_type, (const unsigned char *)idBuffer, mime_id->getLength(), @@ -2909,7 +2897,7 @@ static cairo_status_t setMimeIdFromRef(cairo_surface_t *surface, #endif #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) -GBool CairoOutputDev::setMimeDataForJBIG2Globals(Stream *str, +bool CairoOutputDev::setMimeDataForJBIG2Globals(Stream *str, cairo_surface_t *image) { JBIG2Stream *jb2Str = static_cast(str); @@ -2919,14 +2907,14 @@ GBool CairoOutputDev::setMimeDataForJBIG2Globals(Stream *str, // nothing to do for JBIG2 stream without Globals if (!globalsStr->isStream()) - return gTrue; + return true; if (setMimeIdFromRef(image, CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID, nullptr, jb2Str->getGlobalsStreamRef())) - return gFalse; + return false; if (!getStreamData(globalsStr->getStream(), &globalsBuffer, &globalsLength)) - return gFalse; + return false; if (cairo_surface_set_mime_data (image, CAIRO_MIME_TYPE_JBIG2_GLOBAL, (const unsigned char*)globalsBuffer, @@ -2934,15 +2922,15 @@ GBool CairoOutputDev::setMimeDataForJBIG2Globals(Stream *str, gfree, (void*)globalsBuffer)) { gfree (globalsBuffer); - return gFalse; + return false; } - return gTrue; + return true; } #endif #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) -GBool CairoOutputDev::setMimeDataForCCITTParams(Stream *str, +bool CairoOutputDev::setMimeDataForCCITTParams(Stream *str, cairo_surface_t *image, int height) { CCITTFaxStream *ccittStr = static_cast(str); @@ -2957,17 +2945,17 @@ GBool CairoOutputDev::setMimeDataForCCITTParams(Stream *str, params.appendf(" BlackIs1={0:d}", ccittStr->getBlackIs1() ? 1 : 0); params.appendf(" DamagedRowsBeforeError={0:d}", ccittStr->getDamagedRowsBeforeError()); - char *p = strdup(params.getCString()); + char *p = strdup(params.c_str()); if (cairo_surface_set_mime_data (image, CAIRO_MIME_TYPE_CCITT_FAX_PARAMS, (const unsigned char*)p, params.getLength(), gfree, (void*)p)) { gfree (p); - return gFalse; + return false; } - return gTrue; + return true; } #endif @@ -3052,9 +3040,14 @@ void CairoOutputDev::setMimeData(GfxState *state, Stream *str, Object *ref, cairo_status_t status = CAIRO_STATUS_SUCCESS; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) - if (ref && ref->isRef()) { - status = setMimeIdFromRef(image, CAIRO_MIME_TYPE_UNIQUE_ID, - "poppler-surface-", ref->getRef()); + // Since 1.5.10 the cairo PS backend stores images with UNIQUE_ID in PS memory so the + // image can be re-used multiple times. As we don't know how large the images are or + // how many times they are used, there is no benefit in enabling this. Issue #106 + if (cairo_surface_get_type (cairo_get_target (cairo)) != CAIRO_SURFACE_TYPE_PS) { + if (ref && ref->isRef()) { + status = setMimeIdFromRef(image, CAIRO_MIME_TYPE_UNIQUE_ID, + "poppler-surface-", ref->getRef()); + } } #endif if (!status) { @@ -3076,13 +3069,13 @@ private: GfxImageColorMap *colorMap; int *maskColors; int current_row; - GBool imageError; + bool imageError; public: cairo_surface_t *getSourceImage(Stream *str, int widthA, int height, int scaledWidth, int scaledHeight, - GBool printing, + bool printing, GfxImageColorMap *colorMapA, int *maskColorsA) { cairo_surface_t *image = nullptr; @@ -3093,7 +3086,7 @@ public: maskColors = maskColorsA; width = widthA; current_row = -1; - imageError = gFalse; + imageError = false; /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, @@ -3114,12 +3107,12 @@ public: // build a lookup table here if (colorMap->getNumPixelComps() == 1) { int n; - Guchar pix; + unsigned char pix; n = 1 << colorMap->getBits(); lookup = (GfxRGB *)gmallocn(n, sizeof(GfxRGB)); for (i = 0; i < n; ++i) { - pix = (Guchar)i; + pix = (unsigned char)i; colorMap->getRGB(&pix, &lookup[i]); } @@ -3161,7 +3154,7 @@ public: buffer = cairo_image_surface_get_data (image); stride = cairo_image_surface_get_stride (image); for (int y = 0; y < height; y++) { - uint32_t *dest = (uint32_t *) (buffer + y * stride); + uint32_t *dest = reinterpret_cast(buffer + y * stride); getRow(y, dest); } } else { @@ -3194,7 +3187,7 @@ public: } void getRow(int row_num, uint32_t *row_data) override { - Guchar *pix; + unsigned char *pix; if (row_num <= current_row) return; @@ -3208,10 +3201,10 @@ public: memset(row_data, 0, width*4); if (!imageError) { error(errInternal, -1, "Bad image stream"); - imageError = gTrue; + imageError = true; } } else if (lookup) { - Guchar *p = pix; + unsigned char *p = pix; GfxRGB rgb; for (int i = 0; i < width; i++) { @@ -3251,8 +3244,8 @@ public: void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int widthA, int heightA, GfxImageColorMap *colorMap, - GBool interpolate, - int *maskColors, GBool inlineImg) + bool interpolate, + int *maskColors, bool inlineImg) { cairo_surface_t *image; cairo_pattern_t *pattern, *maskPattern; @@ -3383,7 +3376,7 @@ void CairoImageOutputDev::saveImage(CairoImage *image) void CairoImageOutputDev::getBBox(GfxState *state, int width, int height, double *x1, double *y1, double *x2, double *y2) { - double *ctm = state->getCTM(); + const double *ctm = state->getCTM(); cairo_matrix_t matrix; cairo_matrix_init(&matrix, ctm[0], ctm[1], @@ -3409,8 +3402,8 @@ void CairoImageOutputDev::getBBox(GfxState *state, int width, int height, } void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) + int width, int height, bool invert, + bool interpolate, bool inlineImg) { cairo_t *cr; cairo_surface_t *surface; @@ -3439,8 +3432,8 @@ void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *st } void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) { cairo_t *cr; cairo_surface_t *surface; @@ -3459,7 +3452,7 @@ void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg, gFalse); + CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg, false); if (state->getFillColorSpace()->getMode() == csPattern) { cairo_mask (cairo, mask); } @@ -3473,7 +3466,7 @@ void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) + bool interpolate, int *maskColors, bool inlineImg) { cairo_t *cr; cairo_surface_t *surface; @@ -3504,11 +3497,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, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) + bool maskInterpolate) { cairo_t *cr; cairo_surface_t *surface; @@ -3540,10 +3533,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, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) + bool maskInvert, bool maskInterpolate) { cairo_t *cr; cairo_surface_t *surface; diff --git a/3rdparty/poppler/git/CairoOutputDev.h b/3rdparty/poppler/git/CairoOutputDev.h index 6ee6f9e..b59a9e2 100644 --- a/3rdparty/poppler/git/CairoOutputDev.h +++ b/3rdparty/poppler/git/CairoOutputDev.h @@ -34,11 +34,6 @@ #ifndef CAIROOUTPUTDEV_H #define CAIROOUTPUTDEV_H -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "goo/gtypes.h" #include #include "OutputDev.h" #include "TextOutputDev.h" @@ -102,35 +97,35 @@ public: // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gTrue; } + bool upsideDown() override { return true; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gTrue; } + bool useDrawChar() override { return true; } // Does this device use tilingPatternFill()? If this returns false, // tiling pattern fills will be reduced to a series of other drawing // operations. - GBool useTilingPatternFill() override { return gTrue; } + bool useTilingPatternFill() override { return true; } // Does this device use functionShadedFill(), axialShadedFill(), and // radialShadedFill()? If this returns false, these shaded fills // will be reduced to a series of other drawing operations. #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - GBool useShadedFills(int type) override { return type <= 7; } + bool useShadedFills(int type) override { return type <= 7; } #else - GBool useShadedFills(int type) override { return type > 1 && type < 4; } + bool useShadedFills(int type) override { return type > 1 && type < 4; } #endif // Does this device use FillColorStop()? - GBool useFillColorStop() override { return gTrue; } + bool useFillColorStop() override { return true; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } // Does this device need to clip pages to the crop box even when the // box is the crop box? - GBool needClipToCropBox() override { return gTrue; } + bool needClipToCropBox() override { return true; } //----- initialization and control @@ -146,7 +141,7 @@ public: //----- update graphics state void updateAll(GfxState *state) override; - void setDefaultCTM(double *ctm) override; + void setDefaultCTM(const double *ctm) override; void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) override; void updateLineDash(GfxState *state) override; @@ -170,21 +165,21 @@ public: void fill(GfxState *state) override; void eoFill(GfxState *state) override; void clipToStrokePath(GfxState *state) override; - GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, - double *pmat, int paintType, int tilingType, Dict *resDict, - double *mat, double *bbox, + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, + const double *pmat, int paintType, int tilingType, Dict *resDict, + const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) override; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; + bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; #endif - GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; - GBool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) override; - GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) override; - GBool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) override; + bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; + bool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) override; + bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) override; + bool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) override; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) override; - GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override; + bool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) override; + bool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override; #endif //----- path clipping @@ -201,7 +196,7 @@ public: void beginActualText(GfxState *state, const GooString *text) override; void endActualText(GfxState *state) override; - GBool beginType3Char(GfxState *state, double x, double y, + bool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) override; void endType3Char(GfxState *state) override; @@ -210,49 +205,49 @@ public: //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, GBool interpolate, - GBool inlineImg) override; + int width, int height, bool invert, bool interpolate, + bool inlineImg) override; void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) override; + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) override; void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override; void drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, GBool interpolate, - GBool inlineImg); + int width, int height, bool invert, bool interpolate, + bool inlineImg); void drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, GBool interpolate, - GBool inlineImg); + int width, int height, bool invert, bool interpolate, + bool inlineImg); void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) override; + bool maskInterpolate) override; void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) override; + bool maskInvert, bool maskInterpolate) override; //----- transparency groups and soft masks - void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/, + void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, GfxColorSpace * /*blendingColorSpace*/, - GBool /*isolated*/, GBool /*knockout*/, - GBool /*forSoftMask*/) override; + bool /*isolated*/, bool /*knockout*/, + bool /*forSoftMask*/) override; void endTransparencyGroup(GfxState * /*state*/) override; void popTransparencyGroup(); - void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) override; - void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/, + void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) override; + void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, bool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override; void clearSoftMask(GfxState * /*state*/) override; @@ -264,18 +259,18 @@ public: //----- special access // Called to indicate that a new PDF document has been loaded. - void startDoc(PDFDoc *docA, CairoFontEngine *fontEngine = NULL); + void startDoc(PDFDoc *docA, CairoFontEngine *fontEngine = nullptr); - GBool isReverseVideo() { return gFalse; } + bool isReverseVideo() { return false; } void setCairo (cairo_t *cr); void setTextPage (TextPage *text); - void setPrinting (GBool printingA) { printing = printingA; needFontUpdate = gTrue; } + void setPrinting (bool printingA) { printing = printingA; needFontUpdate = true; } void setAntialias(cairo_antialias_t antialias); - void setInType3Char(GBool inType3CharA) { inType3Char = inType3CharA; } + void setInType3Char(bool inType3CharA) { inType3Char = inType3CharA; } void getType3GlyphWidth (double *wx, double *wy) { *wx = t3_glyph_wx; *wy = t3_glyph_wy; } - GBool hasType3GlyphBBox () { return t3_glyph_has_bbox; } + bool hasType3GlyphBBox () { return t3_glyph_has_bbox; } double *getType3GlyphBBox () { return t3_glyph_bbox; } protected: @@ -285,17 +280,17 @@ protected: int orig_width, int orig_height, int *scaledWidth, int *scaledHeight); cairo_filter_t getFilterForSurface(cairo_surface_t *image, - GBool interpolate); - GBool getStreamData (Stream *str, char **buffer, int *length); + bool interpolate); + bool getStreamData (Stream *str, char **buffer, int *length); void setMimeData(GfxState *state, Stream *str, Object *ref, GfxImageColorMap *colorMap, cairo_surface_t *image, int height); void fillToStrokePathClip(GfxState *state); void alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y); #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) - GBool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image); + bool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image); #endif #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) - GBool setMimeDataForCCITTParams(Stream *str, cairo_surface_t *image, int height); + bool setMimeDataForCCITTParams(Stream *str, cairo_surface_t *image, int height); #endif static void setContextAntialias(cairo_t *cr, cairo_antialias_t antialias); @@ -303,9 +298,9 @@ protected: cairo_pattern_t *fill_pattern, *stroke_pattern; double fill_opacity; double stroke_opacity; - GBool stroke_adjust; - GBool adjusted_stroke_width; - GBool align_stroke_coords; + bool stroke_adjust; + bool adjusted_stroke_width; + bool align_stroke_coords; CairoFont *currentFont; XRef *xref; @@ -325,17 +320,17 @@ protected: PDFDoc *doc; // the current document static FT_Library ft_lib; - static GBool ft_lib_initialized; + static bool ft_lib_initialized; CairoFontEngine *fontEngine; - GBool fontEngine_owner; + bool fontEngine_owner; cairo_t *cairo; cairo_matrix_t orig_matrix; - GBool needFontUpdate; // set when the font needs to be updated - GBool printing; - GBool use_show_text_glyphs; - GBool text_matrix_valid; + bool needFontUpdate; // set when the font needs to be updated + bool printing; + bool use_show_text_glyphs; + bool text_matrix_valid; cairo_glyph_t *glyphs; int glyphCount; cairo_text_cluster_t *clusters; @@ -344,13 +339,13 @@ protected: int utf8Count; int utf8Max; cairo_path_t *textClipPath; - GBool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2) - GBool inType3Char; // inside a Type 3 CharProc + bool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2) + bool inType3Char; // inside a Type 3 CharProc double t3_glyph_wx, t3_glyph_wy; - GBool t3_glyph_has_bbox; + bool t3_glyph_has_bbox; double t3_glyph_bbox[4]; cairo_antialias_t antialias; - GBool prescaleImages; + bool prescaleImages; TextPage *text; // text for the current page ActualText *actualText; @@ -362,7 +357,7 @@ protected: cairo_t *cairo_shape; int knockoutCount; struct ColorSpaceStack { - GBool knockout; + bool knockout; GfxColorSpace *cs; cairo_matrix_t group_matrix; struct ColorSpaceStack *next; @@ -394,34 +389,34 @@ public: // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gTrue; } + bool upsideDown() override { return true; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gFalse; } + bool useDrawChar() override { return false; } // Does this device use tilingPatternFill()? If this returns false, // tiling pattern fills will be reduced to a series of other drawing // operations. - GBool useTilingPatternFill() override { return gTrue; } + bool useTilingPatternFill() override { return true; } // Does this device use functionShadedFill(), axialShadedFill(), and // radialShadedFill()? If this returns false, these shaded fills // will be reduced to a series of other drawing operations. #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) - GBool useShadedFills(int type) override { return type <= 7; } + bool useShadedFills(int type) override { return type <= 7; } #else - GBool useShadedFills(int type) override { return type < 4; } + bool useShadedFills(int type) override { return type < 4; } #endif // Does this device use FillColorStop()? - GBool useFillColorStop() override { return gFalse; } + bool useFillColorStop() override { return false; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } // Does this device need non-text content? - GBool needNonText() override { return gTrue; } + bool needNonText() override { return true; } //----- save/restore graphics state void saveState(GfxState *state) override { } @@ -429,7 +424,7 @@ public: //----- update graphics state void updateAll(GfxState *state) override { } - void setDefaultCTM(double *ctm) override { } + void setDefaultCTM(const double *ctm) override { } void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) override { } void updateLineDash(GfxState *state) override { } @@ -452,17 +447,17 @@ public: void fill(GfxState *state) override { } void eoFill(GfxState *state) override { } void clipToStrokePath(GfxState *state) override { } - GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, - double *pmat, int paintType, int tilingType, Dict *resDict, - double *mat, double *bbox, + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, + const double *pmat, int paintType, int tilingType, Dict *resDict, + const double *mat, const double *bbox, int x0, int y0, int x1, int y1, - double xStep, double yStep) override { return gTrue; } - GBool axialShadedFill(GfxState *state, + double xStep, double yStep) override { return true; } + bool axialShadedFill(GfxState *state, GfxAxialShading *shading, - double tMin, double tMax) override { return gTrue; } - GBool radialShadedFill(GfxState *state, + double tMin, double tMax) override { return true; } + bool radialShadedFill(GfxState *state, GfxRadialShading *shading, - double sMin, double sMax) override { return gTrue; } + double sMin, double sMax) override { return true; } //----- path clipping void clip(GfxState *state) override { } @@ -470,46 +465,46 @@ public: //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) override; + int width, int height, bool invert, + bool interpolate, bool inlineImg) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) override; + bool maskInterpolate) override; void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) override; + bool maskInvert, bool maskInterpolate) override; void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) override; + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) override; void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override {} //----- transparency groups and soft masks - void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/, + void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, GfxColorSpace * /*blendingColorSpace*/, - GBool /*isolated*/, GBool /*knockout*/, - GBool /*forSoftMask*/) override {} + bool /*isolated*/, bool /*knockout*/, + bool /*forSoftMask*/) override {} void endTransparencyGroup(GfxState * /*state*/) override {} - void paintTransparencyGroup(GfxState * /*state*/, double * /*bbox*/) override {} - void setSoftMask(GfxState * /*state*/, double * /*bbox*/, GBool /*alpha*/, + void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) override {} + void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, bool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override {} void clearSoftMask(GfxState * /*state*/) override {} //----- Image list // By default images are not rendred - void setImageDrawDecideCbk(GBool (*cbk)(int img_id, void *data), + void setImageDrawDecideCbk(bool (*cbk)(int img_id, void *data), void *data) { imgDrawCbk = cbk; imgDrawCbkData = data; } // Iterate through list of images. int getNumImages() const { return numImages; } @@ -523,7 +518,7 @@ private: CairoImage **images; int numImages; int size; - GBool (*imgDrawCbk)(int img_id, void *data); + bool (*imgDrawCbk)(int img_id, void *data); void *imgDrawCbkData; }; diff --git a/3rdparty/poppler/git/CairoRescaleBox.cc b/3rdparty/poppler/git/CairoRescaleBox.cc index 251e8e6..9755438 100644 --- a/3rdparty/poppler/git/CairoRescaleBox.cc +++ b/3rdparty/poppler/git/CairoRescaleBox.cc @@ -32,6 +32,8 @@ // // Copyright (C) 2012 Hib Eris // Copyright (C) 2012, 2017 Adrian Johnson +// Copyright (C) 2018 Adam Reichold +// Copyright (C) 2019 Albert Astals Cid // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -76,7 +78,7 @@ static void downsample_row_box_filter ( box size is constant - value = a * contribtion_a * 1/box_size + b * contribution_b * 1/box_size + value = a * contribution_a * 1/box_size + b * contribution_b * 1/box_size contribution_b = (1 - contribution_a) = (1 - contribution_a_next) */ @@ -253,7 +255,7 @@ static int compute_coverage (int coverage[], int src_length, int dest_length) /* compute how much the right-most pixel contributes */ overage = ratio*(right_fract); - /* the remainder is the the amount that the left-most pixel + /* the remainder is the amount that the left-most pixel * contributes */ coverage[i] = (1<<24) - (count * ratio + overage); } @@ -262,7 +264,7 @@ static int compute_coverage (int coverage[], int src_length, int dest_length) } -GBool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, +bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, signed scaled_width, signed scaled_height, unsigned short int start_column, unsigned short int start_row, unsigned short int width, unsigned short int height, @@ -274,17 +276,17 @@ GBool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, int *x_coverage = nullptr; int *y_coverage = nullptr; uint32_t *temp_buf = nullptr; - GBool retval = gFalse; + bool retval = false; unsigned int *dest; int dst_stride; - dest = (unsigned int *)cairo_image_surface_get_data (dest_surface); + dest = reinterpret_cast(cairo_image_surface_get_data (dest_surface)); dst_stride = cairo_image_surface_get_stride (dest_surface); - scanline = (uint32_t*)gmallocn3 (orig_width, 1, sizeof(int)); + scanline = (uint32_t*)gmallocn (orig_width, sizeof(int)); - x_coverage = (int *)gmallocn3 (orig_width, 1, sizeof(int)); - y_coverage = (int *)gmallocn3 (orig_height, 1, sizeof(int)); + x_coverage = (int *)gmallocn (orig_width, sizeof(int)); + y_coverage = (int *)gmallocn (orig_height, sizeof(int)); /* we need to allocate enough room for ceil(src_height/dest_height)+1 Example: @@ -364,7 +366,7 @@ GBool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, } // assert (src_y<=orig_height); - retval = gTrue; + retval = true; cleanup: free (x_coverage); diff --git a/3rdparty/poppler/git/CairoRescaleBox.h b/3rdparty/poppler/git/CairoRescaleBox.h index ca307cb..b00ad6a 100644 --- a/3rdparty/poppler/git/CairoRescaleBox.h +++ b/3rdparty/poppler/git/CairoRescaleBox.h @@ -40,7 +40,6 @@ #ifndef CAIRO_RESCALE_BOX_H #define CAIRO_RESCALE_BOX_H -#include "goo/gtypes.h" #include class CairoRescaleBox { @@ -52,7 +51,7 @@ public: CairoRescaleBox(const CairoRescaleBox &) = delete; CairoRescaleBox& operator=(const CairoRescaleBox &) = delete; - virtual GBool downScaleImage(unsigned orig_width, unsigned orig_height, + virtual bool downScaleImage(unsigned orig_width, unsigned orig_height, signed scaled_width, signed scaled_height, unsigned short int start_column, unsigned short int start_row, unsigned short int width, unsigned short int height,