Remove poppler 0.63 ifdefs since we require 0.86 now

remotes/origin/work/aacid/shorcutslost_2008
Albert Astals Cid 6 years ago
parent c17127b018
commit bcd36d6374
  1. 11
      generators/poppler/CMakeLists.txt
  2. 3
      generators/poppler/config-okular-poppler.h.cmake
  3. 29
      generators/poppler/generator_pdf.cpp

@ -5,17 +5,6 @@ add_subdirectory( conf )
set(CMAKE_REQUIRED_LIBRARIES Poppler::Qt5 Qt5::Core Qt5::Gui) set(CMAKE_REQUIRED_LIBRARIES Poppler::Qt5 Qt5::Core Qt5::Gui)
check_cxx_source_compiles("
#include <poppler-qt5.h>
#include <QImage>
int main()
{
Poppler::Page *p = nullptr;
p->renderToImage(0, 0, 0, 0, 0, 0, Poppler::Page::Rotate0, nullptr, nullptr, nullptr, QVariant());
return 0;
}
" HAVE_POPPLER_0_63)
check_cxx_source_compiles(" check_cxx_source_compiles("
#include <poppler-qt5.h> #include <poppler-qt5.h>
#include <poppler-form.h> #include <poppler-form.h>

@ -1,6 +1,3 @@
/* Defined if we have the 0.63 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_63 1
/* Defined if we have the 0.64 version of the Poppler library */ /* Defined if we have the 0.64 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_64 1 #cmakedefine HAVE_POPPLER_0_64 1

@ -569,9 +569,7 @@ PDFGenerator::PDFGenerator(QObject *parent, const QVariantList &args)
setFeature(ReadRawData); setFeature(ReadRawData);
setFeature(TiledRendering); setFeature(TiledRendering);
setFeature(SwapBackingFile); setFeature(SwapBackingFile);
#ifdef HAVE_POPPLER_0_63
setFeature(SupportsCancelling); setFeature(SupportsCancelling);
#endif
// You only need to do it once not for each of the documents but it is cheap enough // You only need to do it once not for each of the documents but it is cheap enough
// so doing it all the time won't hurt either // so doing it all the time won't hurt either
@ -1066,13 +1064,11 @@ static void partialUpdateCallback(const QImage &image, const QVariant &vPayload)
// clang-format on // clang-format on
} }
#ifdef HAVE_POPPLER_0_63
static bool shouldAbortRenderCallback(const QVariant &vPayload) static bool shouldAbortRenderCallback(const QVariant &vPayload)
{ {
auto payload = vPayload.value<RenderImagePayload *>(); auto payload = vPayload.value<RenderImagePayload *>();
return payload->request->shouldAbortRender(); return payload->request->shouldAbortRender();
} }
#endif
QImage PDFGenerator::image(Okular::PixmapRequest *request) QImage PDFGenerator::image(Okular::PixmapRequest *request)
{ {
@ -1108,7 +1104,6 @@ QImage PDFGenerator::image(Okular::PixmapRequest *request)
// 2. Take data from outputdev and attach it to the Page // 2. Take data from outputdev and attach it to the Page
QImage img; QImage img;
if (p) { if (p) {
#ifdef HAVE_POPPLER_0_63
if (request->isTile()) { if (request->isTile()) {
const QRect rect = request->normalizedRect().geometry(request->width(), request->height()); const QRect rect = request->normalizedRect().geometry(request->width(), request->height());
if (request->partialUpdatesWanted()) { if (request->partialUpdatesWanted()) {
@ -1128,24 +1123,6 @@ QImage PDFGenerator::image(Okular::PixmapRequest *request)
img = p->renderToImage(fakeDpiX, fakeDpiY, -1, -1, -1, -1, Poppler::Page::Rotate0, nullptr, nullptr, shouldAbortRenderCallback, QVariant::fromValue(&payload)); img = p->renderToImage(fakeDpiX, fakeDpiY, -1, -1, -1, -1, Poppler::Page::Rotate0, nullptr, nullptr, shouldAbortRenderCallback, QVariant::fromValue(&payload));
} }
} }
#else
if (request->isTile()) {
const QRect rect = request->normalizedRect().geometry(request->width(), request->height());
if (request->partialUpdatesWanted()) {
RenderImagePayload payload(this, request);
img = p->renderToImage(fakeDpiX, fakeDpiY, rect.x(), rect.y(), rect.width(), rect.height(), Poppler::Page::Rotate0, partialUpdateCallback, shouldDoPartialUpdateCallback, QVariant::fromValue(&payload));
} else {
img = p->renderToImage(fakeDpiX, fakeDpiY, rect.x(), rect.y(), rect.width(), rect.height(), Poppler::Page::Rotate0);
}
} else {
if (request->partialUpdatesWanted()) {
RenderImagePayload payload(this, request);
img = p->renderToImage(fakeDpiX, fakeDpiY, -1, -1, -1, -1, Poppler::Page::Rotate0, partialUpdateCallback, shouldDoPartialUpdateCallback, QVariant::fromValue(&payload));
} else {
img = p->renderToImage(fakeDpiX, fakeDpiY, -1, -1, -1, -1, Poppler::Page::Rotate0);
}
}
#endif
} else { } else {
img = QImage(request->width(), request->height(), QImage::Format_Mono); img = QImage(request->width(), request->height(), QImage::Format_Mono);
img.fill(Qt::white); img.fill(Qt::white);
@ -1231,7 +1208,6 @@ void PDFGenerator::resolveMediaLinkReferences(Okular::Page *page)
} }
} }
#ifdef HAVE_POPPLER_0_63
struct TextExtractionPayload { struct TextExtractionPayload {
TextExtractionPayload(Okular::TextRequest *r) TextExtractionPayload(Okular::TextRequest *r)
: request(r) : request(r)
@ -1247,7 +1223,6 @@ static bool shouldAbortTextExtractionCallback(const QVariant &vPayload)
auto payload = vPayload.value<TextExtractionPayload *>(); auto payload = vPayload.value<TextExtractionPayload *>();
return payload->request->shouldAbortExtraction(); return payload->request->shouldAbortExtraction();
} }
#endif
Okular::TextPage *PDFGenerator::textPage(Okular::TextRequest *request) Okular::TextPage *PDFGenerator::textPage(Okular::TextRequest *request)
{ {
@ -1261,12 +1236,8 @@ Okular::TextPage *PDFGenerator::textPage(Okular::TextRequest *request)
userMutex()->lock(); userMutex()->lock();
Poppler::Page *pp = pdfdoc->page(page->number()); Poppler::Page *pp = pdfdoc->page(page->number());
if (pp) { if (pp) {
#ifdef HAVE_POPPLER_0_63
TextExtractionPayload payload(request); TextExtractionPayload payload(request);
textList = pp->textList(Poppler::Page::Rotate0, shouldAbortTextExtractionCallback, QVariant::fromValue(&payload)); textList = pp->textList(Poppler::Page::Rotate0, shouldAbortTextExtractionCallback, QVariant::fromValue(&payload));
#else
textList = pp->textList();
#endif
const QSizeF s = pp->pageSizeF(); const QSizeF s = pp->pageSizeF();
pageWidth = s.width(); pageWidth = s.width();
pageHeight = s.height(); pageHeight = s.height();

Loading…
Cancel
Save