1 diff -urN kitinerary-19.04.1/src/CMakeLists.txt kitinerary-19.04.1-poppler-0.83/src/CMakeLists.txt
2 --- kitinerary-19.04.1/src/CMakeLists.txt 2019-04-29 07:13:27.000000000 +0200
3 +++ kitinerary-19.04.1-poppler-0.83/src/CMakeLists.txt 2020-03-23 22:04:40.513590800 +0100
8 + popplerglobalparams.cpp
9 qimageluminancesource.cpp
10 qimagepurebinarizer.cpp
12 diff -urN kitinerary-19.04.1/src/pdfdocument.cpp kitinerary-19.04.1-poppler-0.83/src/pdfdocument.cpp
13 --- kitinerary-19.04.1/src/pdfdocument.cpp 2020-03-23 22:12:02.086930170 +0100
14 +++ kitinerary-19.04.1-poppler-0.83/src/pdfdocument.cpp 2020-03-23 22:06:52.540259271 +0100
17 #include "config-kitinerary.h"
18 #include "pdfdocument.h"
19 +#include "popplerglobalparams_p.h"
23 #include <QScopedValueRollback>
26 -#include <GlobalParams.h>
29 #include <TextOutputDev.h>
34 -static std::unique_ptr<GlobalParams> s_globalParams;
35 -static GlobalParams* popplerGlobalParams()
37 - if (!s_globalParams) {
38 - s_globalParams.reset(new GlobalParams);
40 - return s_globalParams.get();
43 class ExtractorOutputDevice : public TextOutputDev
50 - QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
51 + PopplerGlobalParams gp;
53 #ifdef HAVE_POPPLER_0_69
54 const auto xref = d->m_page->m_doc->m_popplerDoc->getXRef();
59 - QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
60 + PopplerGlobalParams gp;
61 ExtractorOutputDevice device;
62 m_doc->m_popplerDoc->displayPageSlice(&device, m_pageNum + 1, 72, 72, 0, false, true, false, -1, -1, -1, -1);
63 const auto pageRect = m_doc->m_popplerDoc->getPage(m_pageNum + 1)->getCropBox();
65 QString PdfPage::textInRect(double left, double top, double right, double bottom) const
68 - QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
69 + PopplerGlobalParams gp;
71 ExtractorOutputDevice device;
72 d->m_doc->m_popplerDoc->displayPageSlice(&device, d->m_pageNum + 1, 72, 72, 0, false, true, false, -1, -1, -1, -1);
77 - QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
78 + PopplerGlobalParams gp;
79 const auto pageRect = d->m_doc->m_popplerDoc->getPage(d->m_pageNum + 1)->getCropBox();
81 for (const auto &img : d->m_images) {
83 PdfDocument* PdfDocument::fromData(const QByteArray &data, QObject *parent)
86 - QScopedValueRollback<GlobalParams*> globalParamResetter(globalParams, popplerGlobalParams());
87 + PopplerGlobalParams gp;
89 std::unique_ptr<PdfDocument> doc(new PdfDocument(parent));
90 doc->d->m_pdfData = data;
91 diff -urN kitinerary-19.04.1/src/popplerglobalparams.cpp kitinerary-19.04.1-poppler-0.83/src/popplerglobalparams.cpp
92 --- kitinerary-19.04.1/src/popplerglobalparams.cpp 1970-01-01 01:00:00.000000000 +0100
93 +++ kitinerary-19.04.1-poppler-0.83/src/popplerglobalparams.cpp 2020-03-23 22:10:40.633595724 +0100
96 + Copyright (C) 2019 Volker Krause <vkrause@kde.org>
98 + This program is free software; you can redistribute it and/or modify it
99 + under the terms of the GNU Library General Public License as published by
100 + the Free Software Foundation; either version 2 of the License, or (at your
101 + option) any later version.
103 + This program is distributed in the hope that it will be useful, but WITHOUT
104 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
105 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
106 + License for more details.
108 + You should have received a copy of the GNU General Public License
109 + along with this program. If not, see <https://www.gnu.org/licenses/>.
112 +#include "config-kitinerary.h"
113 +#include "popplerglobalparams_p.h"
115 +#include <qglobal.h>
118 +#include <GlobalParams.h>
120 +using namespace KItinerary;
122 +static std::unique_ptr<GlobalParams> s_globalParams;
124 +PopplerGlobalParams::PopplerGlobalParams()
126 + if (!s_globalParams) {
127 + s_globalParams.reset(new GlobalParams);
130 +#ifdef HAVE_POPPLER_0_82
131 + std::swap(globalParams, m_prev);
132 + std::swap(s_globalParams, globalParams);
134 + m_prev.reset(globalParams);
135 + globalParams = s_globalParams.get();
139 +PopplerGlobalParams::~PopplerGlobalParams()
141 +#ifdef HAVE_POPPLER_0_82
142 + std::swap(s_globalParams, globalParams);
143 + std::swap(globalParams, m_prev);
145 + globalParams = m_prev.release();
150 diff -urN kitinerary-19.04.1/src/popplerglobalparams_p.h kitinerary-19.04.1-poppler-0.83/src/popplerglobalparams_p.h
151 --- kitinerary-19.04.1/src/popplerglobalparams_p.h 1970-01-01 01:00:00.000000000 +0100
152 +++ kitinerary-19.04.1-poppler-0.83/src/popplerglobalparams_p.h 2020-03-23 22:04:09.146923695 +0100
155 + Copyright (C) 2019 Volker Krause <vkrause@kde.org>
157 + This program is free software; you can redistribute it and/or modify it
158 + under the terms of the GNU Library General Public License as published by
159 + the Free Software Foundation; either version 2 of the License, or (at your
160 + option) any later version.
162 + This program is distributed in the hope that it will be useful, but WITHOUT
163 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
164 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
165 + License for more details.
167 + You should have received a copy of the GNU General Public License
168 + along with this program. If not, see <https://www.gnu.org/licenses/>.
171 +#ifndef KITINERARY_POPPLERGLOBALPARAMS_H
172 +#define KITINERARY_POPPLERGLOBALPARAMS_H
178 +namespace KItinerary {
180 +/** RAII wrapper of the globalParams object. */
181 +class PopplerGlobalParams
184 + PopplerGlobalParams();
185 + ~PopplerGlobalParams();
188 + std::unique_ptr<GlobalParams> m_prev;
193 +#endif // KITINERARY_POPPLERGLOBALPARAMS_H