From 89cfef32de157570ce7f6498a0f8da5d18ec29f3 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Fri, 27 Sep 2019 08:10:04 +0100 Subject: [PATCH] initial copy of poppler-0.78.0 Cairo files --- 3rdparty/poppler/git/CairoOutputDev.cc | 92 +++++++++++++------------- 3rdparty/poppler/git/CairoOutputDev.h | 4 +- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/3rdparty/poppler/git/CairoOutputDev.cc b/3rdparty/poppler/git/CairoOutputDev.cc index 61a4fd2..aa4f1cc 100644 --- a/3rdparty/poppler/git/CairoOutputDev.cc +++ b/3rdparty/poppler/git/CairoOutputDev.cc @@ -87,12 +87,12 @@ // CairoImage //------------------------------------------------------------------------ -CairoImage::CairoImage (double x1, double y1, double x2, double y2) { - this->image = nullptr; - this->x1 = x1; - this->y1 = y1; - this->x2 = x2; - this->y2 = y2; +CairoImage::CairoImage (double x1A, double y1A, double x2A, double y2A) { + image = nullptr; + x1 = x1A; + y1 = y1A; + x2 = x2A; + y2 = y2A; } CairoImage::~CairoImage () { @@ -100,10 +100,10 @@ CairoImage::~CairoImage () { cairo_surface_destroy (image); } -void CairoImage::setImage (cairo_surface_t *image) { - if (this->image) - cairo_surface_destroy (this->image); - this->image = cairo_surface_reference (image); +void CairoImage::setImage (cairo_surface_t *i) { + if (image) + cairo_surface_destroy (image); + image = cairo_surface_reference (i); } //------------------------------------------------------------------------ @@ -161,7 +161,7 @@ CairoOutputDev::CairoOutputDev() { cairo_shape = nullptr; knockoutCount = 0; - text = nullptr; + textPage = nullptr; actualText = nullptr; // the SA parameter supposedly defaults to false, but Acrobat @@ -187,53 +187,53 @@ CairoOutputDev::~CairoOutputDev() { cairo_pattern_destroy (mask); if (shape) cairo_pattern_destroy (shape); - if (text) - text->decRefCnt(); + if (textPage) + textPage->decRefCnt(); if (actualText) delete actualText; } -void CairoOutputDev::setCairo(cairo_t *cairo) +void CairoOutputDev::setCairo(cairo_t *c) { - if (this->cairo != nullptr) { - cairo_status_t status = cairo_status (this->cairo); + if (cairo != nullptr) { + cairo_status_t status = cairo_status (cairo); if (status) { error(errInternal, -1, "cairo context error: {0:s}\n", cairo_status_to_string(status)); } - cairo_destroy (this->cairo); + cairo_destroy (cairo); assert(!cairo_shape); } - if (cairo != nullptr) { - this->cairo = cairo_reference (cairo); + if (c != nullptr) { + cairo = cairo_reference (c); /* save the initial matrix so that we can use it for type3 fonts. */ //XXX: is this sufficient? could we miss changes to the matrix somehow? cairo_get_matrix(cairo, &orig_matrix); setContextAntialias(cairo, antialias); } else { - this->cairo = nullptr; - this->cairo_shape = nullptr; + cairo = nullptr; + cairo_shape = nullptr; } } void CairoOutputDev::setTextPage(TextPage *text) { - if (this->text) - this->text->decRefCnt(); + if (textPage) + textPage->decRefCnt(); if (actualText) delete actualText; if (text) { - this->text = text; - this->text->incRefCnt(); + textPage = text; + textPage->incRefCnt(); actualText = new ActualText(text); } else { - this->text = nullptr; + textPage = nullptr; actualText = nullptr; } } -void CairoOutputDev::setAntialias(cairo_antialias_t antialias) +void CairoOutputDev::setAntialias(cairo_antialias_t a) { - this->antialias = antialias; + antialias = a; if (cairo) setContextAntialias (cairo, antialias); if (cairo_shape) @@ -276,17 +276,17 @@ void CairoOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { stroke_pattern = cairo_pattern_reference(fill_pattern); stroke_color.r = stroke_color.g = stroke_color.b = 0; - if (text) - text->startPage(state); + if (textPage) + textPage->startPage(state); if (xrefA != nullptr) { xref = xrefA; } } void CairoOutputDev::endPage() { - if (text) { - text->endPage(); - text->coalesce(true, 0, false); + if (textPage) { + textPage->endPage(); + textPage->coalesce(true, 0, false); } } @@ -354,8 +354,8 @@ void CairoOutputDev::updateAll(GfxState *state) { updateStrokeOpacity(state); updateBlendMode(state); needFontUpdate = true; - if (text) - text->updateFont(state); + if (textPage) + textPage->updateFont(state); } void CairoOutputDev::setDefaultCTM(const double *ctm) { @@ -659,8 +659,8 @@ void CairoOutputDev::updateFont(GfxState *state) { needFontUpdate = false; //FIXME: use cairo font engine? - if (text) - text->updateFont(state); + if (textPage) + textPage->updateFont(state); currentFont = fontEngine->getFont (state->getFont(), doc, printing, xref); @@ -751,11 +751,11 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do #undef STROKE_COORD_TOLERANCE -void CairoOutputDev::doPath(cairo_t *cairo, GfxState *state, GfxPath *path) { +void CairoOutputDev::doPath(cairo_t *c, GfxState *state, GfxPath *path) { GfxSubpath *subpath; int i, j; double x, y; - cairo_new_path (cairo); + cairo_new_path (c); for (i = 0; i < path->getNumSubpaths(); ++i) { subpath = path->getSubpath(i); if (subpath->getNumPoints() > 0) { @@ -765,7 +765,7 @@ void CairoOutputDev::doPath(cairo_t *cairo, GfxState *state, GfxPath *path) { x = subpath->getX(0); y = subpath->getY(0); } - cairo_move_to (cairo, x, y); + cairo_move_to (c, x, y); j = 1; while (j < subpath->getNumPoints()) { if (subpath->getCurve(j)) { @@ -775,7 +775,7 @@ void CairoOutputDev::doPath(cairo_t *cairo, GfxState *state, GfxPath *path) { x = subpath->getX(j+2); y = subpath->getY(j+2); } - cairo_curve_to( cairo, + cairo_curve_to( c, subpath->getX(j), subpath->getY(j), subpath->getX(j+1), subpath->getY(j+1), x, y); @@ -788,13 +788,13 @@ void CairoOutputDev::doPath(cairo_t *cairo, GfxState *state, GfxPath *path) { x = subpath->getX(j); y = subpath->getY(j); } - cairo_line_to (cairo, x, y); + cairo_line_to (c, x, y); ++j; } } if (subpath->isClosed()) { LOG (printf ("close\n")); - cairo_close_path (cairo); + cairo_close_path (c); } } } @@ -1423,7 +1423,7 @@ void CairoOutputDev::drawChar(GfxState *state, double x, double y, } } - if (!text) + if (!textPage) return; actualText->addChar (state, x, y, dx, dy, code, nBytes, u, uLen); } @@ -1580,13 +1580,13 @@ void CairoOutputDev::endTextObject(GfxState *state) { void CairoOutputDev::beginActualText(GfxState *state, const GooString *text) { - if (this->text) + if (textPage) actualText->begin(state, text); } void CairoOutputDev::endActualText(GfxState *state) { - if (text) + if (textPage) actualText->end(state); } diff --git a/3rdparty/poppler/git/CairoOutputDev.h b/3rdparty/poppler/git/CairoOutputDev.h index b59a9e2..0fbbf0d 100644 --- a/3rdparty/poppler/git/CairoOutputDev.h +++ b/3rdparty/poppler/git/CairoOutputDev.h @@ -23,7 +23,7 @@ // Copyright (C) 2010-2013 Thomas Freitag // Copyright (C) 2015 Suzuki Toshiya // Copyright (C) 2016 Jason Crain -// Copyright (C) 2018 Albert Astals Cid +// Copyright (C) 2018, 2019 Albert Astals Cid // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, . Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that @@ -347,7 +347,7 @@ protected: cairo_antialias_t antialias; bool prescaleImages; - TextPage *text; // text for the current page + TextPage *textPage; // text for the current page ActualText *actualText; cairo_pattern_t *group;